@@ -506,10 +506,11 @@ def address_to_hash(addr: str, *, net=None) -> Tuple[OnchainOutputType, bytes]:
|
|||||||
raise BitcoinException(f"unknown address type: {addrtype}")
|
raise BitcoinException(f"unknown address type: {addrtype}")
|
||||||
|
|
||||||
|
|
||||||
def address_to_scripthash(addr: str) -> str:
|
def address_to_scripthash(addr: str, *, net=None) -> str:
|
||||||
script = address_to_script(addr)
|
script = address_to_script(addr, net=net)
|
||||||
return script_to_scripthash(script)
|
return script_to_scripthash(script)
|
||||||
|
|
||||||
|
|
||||||
def script_to_scripthash(script: str) -> str:
|
def script_to_scripthash(script: str) -> str:
|
||||||
h = sha256(bfh(script))[0:32]
|
h = sha256(bfh(script))[0:32]
|
||||||
return bh2u(bytes(reversed(h)))
|
return bh2u(bytes(reversed(h)))
|
||||||
|
|||||||
Reference in New Issue
Block a user