1
0

psbt: put fake xpubs into globals. keystores handle xfp/der_prefix missing

This commit is contained in:
SomberNight
2019-11-01 20:33:53 +01:00
parent 7eb7eb8674
commit e6c841d05f
10 changed files with 195 additions and 95 deletions

View File

@@ -39,6 +39,7 @@ from .logging import get_logger, Logger
if TYPE_CHECKING:
from .plugins.hw_wallet import HW_PluginBase
from .keystore import Hardware_KeyStore
_logger = get_logger(__name__)
@@ -442,7 +443,7 @@ class DeviceMgr(ThreadJob):
self.scan_devices()
return self.client_lookup(id_)
def client_for_keystore(self, plugin, handler, keystore, force_pair):
def client_for_keystore(self, plugin, handler, keystore: 'Hardware_KeyStore', force_pair):
self.logger.info("getting client for keystore")
if handler is None:
raise Exception(_("Handler not found for") + ' ' + plugin.name + '\n' + _("A library is probably missing."))
@@ -450,12 +451,15 @@ class DeviceMgr(ThreadJob):
devices = self.scan_devices()
xpub = keystore.xpub
derivation = keystore.get_derivation_prefix()
assert derivation is not None
client = self.client_by_xpub(plugin, xpub, handler, devices)
if client is None and force_pair:
info = self.select_device(plugin, handler, keystore, devices)
client = self.force_pair_xpub(plugin, handler, info, xpub, derivation, devices)
if client:
handler.update_status(True)
if client:
keystore.opportunistically_fill_in_missing_info_from_device(client)
self.logger.info("end client for keystore")
return client