descriptors: wallet/transaction: construct intermediate osd
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user