1
0

descriptors: wallet/transaction: construct intermediate osd

This commit is contained in:
SomberNight
2023-02-26 12:14:25 +00:00
parent 8f8dd1506e
commit f1f39f0e82
8 changed files with 223 additions and 111 deletions

View File

@@ -421,15 +421,9 @@ def p2wsh_nested_script(witness_script: str) -> str:
return construct_script([0, wsh])
def pubkey_to_address(txin_type: str, pubkey: str, *, net=None) -> str:
if txin_type == 'p2pkh':
return public_key_to_p2pkh(bfh(pubkey), net=net)
elif txin_type == 'p2wpkh':
return public_key_to_p2wpkh(bfh(pubkey), net=net)
elif txin_type == 'p2wpkh-p2sh':
scriptSig = p2wpkh_nested_script(pubkey)
return hash160_to_p2sh(hash_160(bfh(scriptSig)), net=net)
else:
raise NotImplementedError(txin_type)
from . import descriptor
desc = descriptor.get_singlesig_descriptor_from_legacy_leaf(pubkey=pubkey, script_type=txin_type)
return desc.expand().address(net=net)
# TODO this method is confusingly named