Skip to content

Commit

Permalink
Clarify and unify use of fingerprint and pubkey for hd keypaths
Browse files Browse the repository at this point in the history
  • Loading branch information
achow101 committed Mar 30, 2018
1 parent 40b8a8c commit 8837eca
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions serializations.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,7 @@ def deserialize(self, hexstring):
value = f.read(value_len)
keypath = []
i = 0
# Note that the first item of the keypath is actually the master key fingerprint
while i < value_len:
keypath.append(struct.unpack("<I", value[i:i + 4])[0])
i += 4
Expand Down Expand Up @@ -660,10 +661,11 @@ def serialize(self):
r += script

# write hd keypaths
for fingerprint, keypath in self.hd_keypaths.items():
r += ser_compact_size(len(fingerprint) + 1)
# Note that the first item of self.hd_keypaths is the master key fingerprint
for pubkey, keypath in self.hd_keypaths.items():
r += ser_compact_size(len(pubkey) + 1)
r += b"\x03"
r += fingerprint
r += pubkey
r += ser_compact_size(len(keypath) * 4)
for num in keypath:
r += struct.pack("<I", num)
Expand Down

0 comments on commit 8837eca

Please sign in to comment.