diff --git a/electrum/keystore.py b/electrum/keystore.py index 985654aa6..c1c1bff65 100644 --- a/electrum/keystore.py +++ b/electrum/keystore.py @@ -847,7 +847,13 @@ class Hardware_KeyStore(Xpub, KeyStore): def has_usable_connection_with_device(self) -> bool: if not hasattr(self, 'plugin'): return False - client = self.plugin.get_client(self, force_pair=False) + # we try to create a client even if there isn't one already, + # but do not prompt the user if auto-select fails: + client = self.plugin.get_client( + self, + force_pair=True, + allow_user_interaction=False, + ) if client is None: return False return client.has_usable_connection_with_device() diff --git a/electrum/wallet.py b/electrum/wallet.py index f6867a324..e09bf8dc5 100644 --- a/electrum/wallet.py +++ b/electrum/wallet.py @@ -2100,6 +2100,9 @@ class Abstract_Wallet(AddressSynchronizer, ABC): tmp_tx = copy.deepcopy(tx) tmp_tx.add_info_from_wallet(self, include_xpubs=True) # sign. start with ready keystores. + # note: ks.ready_to_sign() side-effect: we trigger pairings with potential hw devices. + # We only do this once, before the loop, however we could rescan after each iteration, + # to see if the user connected/disconnected devices in the meantime. for k in sorted(self.get_keystores(), key=lambda ks: ks.ready_to_sign(), reverse=True): try: if k.can_sign(tmp_tx):