From 904fb1a9cf47d4982185c54b20d3c705ca156222 Mon Sep 17 00:00:00 2001 From: Gregory Sanders Date: Tue, 3 Apr 2018 13:24:16 -0700 Subject: [PATCH] make ledger impl python3 compliant --- ledgeri.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ledgeri.py b/ledgeri.py index cea61c70c..a5827d21c 100644 --- a/ledgeri.py +++ b/ledgeri.py @@ -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"] @@ -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] @@ -88,7 +88,7 @@ def sign_tx(self, tx): for pubkey, path in tx.hd_keypaths.items(): if struct.pack(" 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)+"/" @@ -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)