Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions ledgeri.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def get_pubkey_at_path(self, path):
child = struct.pack(">I", int(childstr)+hard)
# Special case for m
else:
child = "00000000".decode('hex')
child = bytearray.fromhex("00000000")
fpr = child

chainCode = pubkey["chainCode"]
Expand All @@ -55,7 +55,7 @@ def get_pubkey_at_path(self, path):
depth = len(path.split("/")) if len(path) > 0 else 0
depth = struct.pack("B", depth)

version = "0488B21E".decode('hex')
version = bytearray.fromhex("0488B21E")
extkey = version+depth+fpr+child+chainCode+publicKey
checksum = hash256(extkey)[:4]

Expand Down Expand Up @@ -88,7 +88,7 @@ def sign_tx(self, tx):
for pubkey, path in tx.hd_keypaths.items():
if struct.pack("<I", path[0]) == master_fpr and len(path) > 2 and path[-2] == 1:
# For possible matches, check if pubkey matches possible template
if hash160(pubkey) in txout.scriptPubKey or hash160("0014".decode('hex')+hash160(pubkey)) in txout.scriptPubKey:
if hash160(pubkey) in txout.scriptPubKey or hash160(bytearray.fromhex("0014")+hash160(pubkey)) in txout.scriptPubKey:
change_path = ''
for index in path[1:]:
change_path += str(index)+"/"
Expand All @@ -99,7 +99,7 @@ def sign_tx(self, tx):

seq = format(txin.nSequence, 'x')
seq = seq.zfill(8)
seq = bytearray(seq.decode('hex'))
seq = bytearray.fromhex(seq)
seq.reverse()
seq_hex = ''.join('{:02x}'.format(x) for x in seq)

Expand Down