hww: rm some code duplication: add "scan_and_create_client_for_device"
This commit is contained in:
@@ -703,13 +703,8 @@ class DigitalBitboxPlugin(HW_PluginBase):
|
||||
|
||||
|
||||
def setup_device(self, device_info, wizard, purpose):
|
||||
devmgr = self.device_manager()
|
||||
device_id = device_info.device.id_
|
||||
client = devmgr.client_by_id(device_id)
|
||||
if client is None:
|
||||
raise Exception(_('Failed to create a client for this device.') + '\n' +
|
||||
_('Make sure it is in the correct state.'))
|
||||
client.handler = self.create_handler(wizard)
|
||||
client = self.scan_and_create_client_for_device(device_id=device_id, wizard=wizard)
|
||||
if purpose == HWD_SETUP_NEW_WALLET:
|
||||
client.setupRunning = True
|
||||
client.get_xpub("m/44'/0'", 'standard')
|
||||
@@ -739,9 +734,7 @@ class DigitalBitboxPlugin(HW_PluginBase):
|
||||
raise ScriptTypeNotSupported(_('This type of script is not supported with {}.').format(self.device))
|
||||
if is_all_public_derivation(derivation):
|
||||
raise Exception(f"The {self.device} does not reveal xpubs corresponding to non-hardened paths. (path: {derivation})")
|
||||
devmgr = self.device_manager()
|
||||
client = devmgr.client_by_id(device_id)
|
||||
client.handler = self.create_handler(wizard)
|
||||
client = self.scan_and_create_client_for_device(device_id=device_id, wizard=wizard)
|
||||
client.check_device_dialog()
|
||||
xpub = client.get_xpub(derivation, xtype)
|
||||
return xpub
|
||||
|
||||
Reference in New Issue
Block a user