hw: allow bypassing "too old firmware" error when using hw wallets
The framework here is generic enough that it can be used for any hw plugin, however atm only Trezor is implemented. closes #5391
This commit is contained in:
@@ -44,6 +44,7 @@ from .util import UserCancelled, InvalidPassword, WalletFileException
|
||||
from .simple_config import SimpleConfig
|
||||
from .plugin import Plugins, HardwarePluginLibraryUnavailable
|
||||
from .logging import Logger
|
||||
from .plugins.hw_wallet.plugin import OutdatedHwFirmwareException, HW_PluginBase
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .plugin import DeviceInfo
|
||||
@@ -323,7 +324,7 @@ class BaseWizard(Logger):
|
||||
run_next=lambda *args: self.on_device(*args, purpose=purpose, storage=storage))
|
||||
|
||||
def on_device(self, name, device_info, *, purpose, storage=None):
|
||||
self.plugin = self.plugins.get_plugin(name)
|
||||
self.plugin = self.plugins.get_plugin(name) # type: HW_PluginBase
|
||||
try:
|
||||
self.plugin.setup_device(device_info, self, purpose)
|
||||
except OSError as e:
|
||||
@@ -335,6 +336,14 @@ class BaseWizard(Logger):
|
||||
devmgr.unpair_id(device_info.device.id_)
|
||||
self.choose_hw_device(purpose, storage=storage)
|
||||
return
|
||||
except OutdatedHwFirmwareException as e:
|
||||
if self.question(e.text_ignore_old_fw_and_continue(), title=_("Outdated device firmware")):
|
||||
self.plugin.set_ignore_outdated_fw()
|
||||
# will need to re-pair
|
||||
devmgr = self.plugins.device_manager
|
||||
devmgr.unpair_id(device_info.device.id_)
|
||||
self.choose_hw_device(purpose, storage=storage)
|
||||
return
|
||||
except (UserCancelled, GoBack):
|
||||
self.choose_hw_device(purpose, storage=storage)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user