This commit is contained in:
ThomasV 2017-09-23 05:57:50 +02:00
parent 3c7843eea5
commit 1bd60d4c3a
1 changed files with 3 additions and 3 deletions

View File

@ -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)