fix #2880
This commit is contained in:
parent
3c7843eea5
commit
1bd60d4c3a
|
@ -339,8 +339,8 @@ def address_to_script(addr):
|
||||||
if witprog is not None:
|
if witprog is not None:
|
||||||
assert (0 <= witver <= 16)
|
assert (0 <= witver <= 16)
|
||||||
OP_n = witver + 0x50 if witver > 0 else 0
|
OP_n = witver + 0x50 if witver > 0 else 0
|
||||||
script = bytes([OP_n]).hex()
|
script = bh2u(bytes([OP_n]))
|
||||||
script += push_script(bytes(witprog).hex())
|
script += push_script(bh2u(bytes(witprog)))
|
||||||
return script
|
return script
|
||||||
addrtype, hash_160 = b58_address_to_hash160(addr)
|
addrtype, hash_160 = b58_address_to_hash160(addr)
|
||||||
if addrtype == ADDRTYPE_P2PKH:
|
if addrtype == ADDRTYPE_P2PKH:
|
||||||
|
@ -358,7 +358,7 @@ def address_to_script(addr):
|
||||||
def address_to_scripthash(addr):
|
def address_to_scripthash(addr):
|
||||||
script = address_to_script(addr)
|
script = address_to_script(addr)
|
||||||
h = sha256(bytes.fromhex(script))[0:32]
|
h = sha256(bytes.fromhex(script))[0:32]
|
||||||
return bytes(reversed(h)).hex()
|
return bh2u(bytes(reversed(h)))
|
||||||
|
|
||||||
def public_key_to_p2pk_script(pubkey):
|
def public_key_to_p2pk_script(pubkey):
|
||||||
script = push_script(pubkey)
|
script = push_script(pubkey)
|
||||||
|
|
Loading…
Reference in New Issue