commit 1bd60d4c3a30f49d25cdc26ff567b42cfb95f8a5
parent 3c7843eea531446e62788d54142d6bdff12b59eb
Author: ThomasV <thomasv@electrum.org>
Date: Sat, 23 Sep 2017 05:57:50 +0200
fix #2880
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/bitcoin.py b/lib/bitcoin.py
@@ -339,8 +339,8 @@ def address_to_script(addr):
if witprog is not None:
assert (0 <= witver <= 16)
OP_n = witver + 0x50 if witver > 0 else 0
- script = bytes([OP_n]).hex()
- script += push_script(bytes(witprog).hex())
+ script = bh2u(bytes([OP_n]))
+ script += push_script(bh2u(bytes(witprog)))
return script
addrtype, hash_160 = b58_address_to_hash160(addr)
if addrtype == ADDRTYPE_P2PKH:
@@ -358,7 +358,7 @@ def address_to_script(addr):
def address_to_scripthash(addr):
script = address_to_script(addr)
h = sha256(bytes.fromhex(script))[0:32]
- return bytes(reversed(h)).hex()
+ return bh2u(bytes(reversed(h)))
def public_key_to_p2pk_script(pubkey):
script = push_script(pubkey)