Merge #163: commands.py: use fingerprint if already captured by client

0cf6bb9 commands.py: use fingerprint if already captured by client (Peter D. Gray)

Pull request description:

  For me with a `signmessage` to the Coldcard simulator, this saves 6-7 seconds. But this should speed up all devices, since they are already capturing the fingerprint value into the enumeration information.

ACKs for commit 0cf6bb:
  achow101:
    ACK 0cf6bb9998

Tree-SHA512: db2bb8eed855b70e8f1ee68c4eaf59eae191732246525669f9e600c10bee0dca1108685f1f508c24232151a792b8178d11bf80eee8cf880f0442e5f69dd81f56
This commit is contained in:
Andrew Chow 2019-04-30 19:20:44 -04:00
commit 57a06836b9
No known key found for this signature in database
GPG Key ID: 17565732E08E5E41

View File

@ -48,8 +48,12 @@ def find_device(device_path, password='', device_type=None, fingerprint=None):
client = None
try:
client = get_client(d['type'], d['path'], password)
master_xpub = client.get_pubkey_at_path('m/0h')['xpub']
master_fpr = get_xpub_fingerprint_hex(master_xpub)
master_fpr = d.get('fingerprint', None)
if master_fpr is None:
master_xpub = client.get_pubkey_at_path('m/0h')['xpub']
master_fpr = get_xpub_fingerprint_hex(master_xpub)
if fingerprint and master_fpr != fingerprint:
client.close()
continue