Add XFP for each derived xpub

This commit is contained in:
Peter D. Gray 2020-04-30 10:00:37 -04:00
parent 31f1b4ed7d
commit dcc4e1691b
No known key found for this signature in database
GPG Key ID: F0E6CC6AFC16CF7B
2 changed files with 6 additions and 3 deletions

View File

@ -284,14 +284,15 @@ def generate_generic_export(account_num=0):
]:
dd = deriv.format(ct=chain.b44_cointype, acc=account_num)
node = sv.derive_path(dd)
xfp = xfp2str(node.my_fingerprint())
xp = chain.serialize_public(node, AF_CLASSIC)
zp = chain.serialize_public(node, fmt) if fmt != AF_CLASSIC else None
# bonus/check: first address: 0/0
# bonus/check: first non-change address: 0/0
node.derive(0)
node.derive(0)
rv[name] = dict(deriv=dd, xpub=xp, first=chain.address(node, fmt), name=atype)
rv[name] = dict(deriv=dd, xpub=xp, xfp=xfp, first=chain.address(node, fmt), name=atype)
if zp:
rv[name]['_pub'] = zp

View File

@ -251,12 +251,14 @@ def test_export_coldcard(acct_num, dev, cap_menu, pick_menu_item, goto_home, cap
for fn in ['xfp', 'xpub', 'chain']:
assert fn in obj
assert obj[fn]
assert obj['account'] == int(acct_num or 0)
for fn in ['bip44', 'bip49', 'bip84']:
assert fn in obj
v = obj[fn]
assert all([i in v for i in ['deriv', 'name', 'first', 'xpub']])
assert all([i in v for i in ['deriv', 'name', 'first', 'xpub', 'xfp']])
assert v['deriv'].endswith(f"'/{acct_num}'")
node = BIP32Node.from_wallet_key(v['xpub'])
first = node.subkey_for_path('0/0')