keystore: add note regarding xpubkeys

This commit is contained in:
SomberNight 2018-09-12 18:22:34 +02:00
parent 152c6abb86
commit 3842205b8a
No known key found for this signature in database
GPG key ID: B33B5F232C6271E9

View file

@ -253,12 +253,17 @@ class Xpub:
@classmethod
def parse_xpubkey(self, pubkey):
# type + xpub + derivation
assert pubkey[0:2] == 'ff'
pk = bfh(pubkey)
# xpub:
pk = pk[1:]
xkey = bitcoin.EncodeBase58Check(pk[0:78])
# derivation:
dd = pk[78:]
s = []
# FIXME: due to an oversight, levels in the derivation are only
# allocated 2 bytes, instead of 4 (in bip32)
while dd:
n = int(bitcoin.rev_hex(bh2u(dd[0:2])), 16)
dd = dd[2:]