mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-23 17:47:31 +00:00
fix #4236
This commit is contained in:
parent
0180abc179
commit
4ff3791cb9
1 changed files with 3 additions and 4 deletions
|
@ -805,18 +805,17 @@ class Transaction:
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_preimage_script(self, txin):
|
def get_preimage_script(self, txin):
|
||||||
# only for non-segwit
|
pubkeys, x_pubkeys = self.get_sorted_pubkeys(txin)
|
||||||
if txin['type'] == 'p2pkh':
|
if txin['type'] == 'p2pkh':
|
||||||
return bitcoin.address_to_script(txin['address'])
|
return bitcoin.address_to_script(txin['address'])
|
||||||
elif txin['type'] in ['p2sh', 'p2wsh', 'p2wsh-p2sh']:
|
elif txin['type'] in ['p2sh', 'p2wsh', 'p2wsh-p2sh']:
|
||||||
pubkeys, x_pubkeys = self.get_sorted_pubkeys(txin)
|
|
||||||
return multisig_script(pubkeys, txin['num_sig'])
|
return multisig_script(pubkeys, txin['num_sig'])
|
||||||
elif txin['type'] in ['p2wpkh', 'p2wpkh-p2sh']:
|
elif txin['type'] in ['p2wpkh', 'p2wpkh-p2sh']:
|
||||||
pubkey = txin['pubkeys'][0]
|
pubkey = pubkeys[0]
|
||||||
pkh = bh2u(bitcoin.hash_160(bfh(pubkey)))
|
pkh = bh2u(bitcoin.hash_160(bfh(pubkey)))
|
||||||
return '76a9' + push_script(pkh) + '88ac'
|
return '76a9' + push_script(pkh) + '88ac'
|
||||||
elif txin['type'] == 'p2pk':
|
elif txin['type'] == 'p2pk':
|
||||||
pubkey = txin['pubkeys'][0]
|
pubkey = pubkeys[0]
|
||||||
return bitcoin.public_key_to_p2pk_script(pubkey)
|
return bitcoin.public_key_to_p2pk_script(pubkey)
|
||||||
else:
|
else:
|
||||||
raise TypeError('Unknown txin type', txin['type'])
|
raise TypeError('Unknown txin type', txin['type'])
|
||||||
|
|
Loading…
Add table
Reference in a new issue