hww: smarter auto-selection of which device to pair with
scenario1: - 2of2 multisig wallet with trezor1 and trezor2 keystores - only trezor2 connected - previously we would pair first keystore with connected device and then display error. now we will pair the device with the correct keystore on the first try scenario2: - standard wallet with trezor1 keystore - trezor2 connected (different device) - previously we would pair trezor2 with the keystore and then display error. now we will prompt the user to select which device to pair with (out of one) related: #5789
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
#
|
||||
import os, time, io
|
||||
import traceback
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import TYPE_CHECKING, Optional
|
||||
import struct
|
||||
|
||||
from electrum import bip32
|
||||
@@ -536,11 +536,12 @@ class ColdcardPlugin(HW_PluginBase):
|
||||
xpub = client.get_xpub(derivation, xtype)
|
||||
return xpub
|
||||
|
||||
def get_client(self, keystore, force_pair=True) -> 'CKCCClient':
|
||||
def get_client(self, keystore, force_pair=True, *,
|
||||
devices=None, allow_user_interaction=True) -> Optional['CKCCClient']:
|
||||
# Acquire a connection to the hardware device (via USB)
|
||||
devmgr = self.device_manager()
|
||||
handler = keystore.handler
|
||||
client = devmgr.client_for_keystore(self, handler, keystore, force_pair)
|
||||
client = super().get_client(keystore, force_pair,
|
||||
devices=devices,
|
||||
allow_user_interaction=allow_user_interaction)
|
||||
|
||||
if client is not None:
|
||||
client.ping_check()
|
||||
|
||||
Reference in New Issue
Block a user