ledger plugin: fix Ledger_Client.construct_new on very old btc app ver
related: https://github.com/spesmilo/electrum/issues/8568#issuecomment-1710162955
This commit is contained in:
@@ -313,7 +313,17 @@ class Ledger_Client(HardwareClientBase, ABC):
|
||||
hid_device.path = device.path
|
||||
hid_device.open()
|
||||
transport = ledger_bitcoin.TransportClient('hid', hid=hid_device)
|
||||
cl = ledger_bitcoin.createClient(transport, chain=get_chain())
|
||||
try:
|
||||
cl = ledger_bitcoin.createClient(transport, chain=get_chain())
|
||||
except (ledger_bitcoin.exception.errors.InsNotSupportedError,
|
||||
ledger_bitcoin.exception.errors.ClaNotSupportedError) as e:
|
||||
# This can happen on very old versions.
|
||||
# E.g. with a "nano s", with bitcoin app 1.1.10, SE 1.3.1, MCU 1.0,
|
||||
# - on machine one, ghost43 got InsNotSupportedError
|
||||
# - on machine two, thomasv got ClaNotSupportedError
|
||||
# unclear why the different exceptions, ledger_bitcoin version 0.2.1 in both cases
|
||||
_logger.info(f"ledger_bitcoin.createClient() got exc: {e}. falling back to old plugin.")
|
||||
cl = None
|
||||
if isinstance(cl, ledger_bitcoin.client.NewClient):
|
||||
return Ledger_Client_New(hid_device, *args, **kwargs)
|
||||
else:
|
||||
@@ -1426,7 +1436,7 @@ class LedgerPlugin(HW_PluginBase):
|
||||
try:
|
||||
return Ledger_Client.construct_new(device=device, product_key=device.product_key, plugin=self)
|
||||
except Exception as e:
|
||||
self.logger.info(f"cannot connect at {device.path} {e}")
|
||||
self.logger.info(f"cannot connect at {device.path} {e}", exc_info=e)
|
||||
return None
|
||||
|
||||
def setup_device(self, device_info, wizard, purpose):
|
||||
|
||||
Reference in New Issue
Block a user