commit 4ff3791cb93fcdda0b534bc2be575121f4d59705
parent 0180abc1791a169cd6c493a922900b143492bb6e
Author: SomberNight <somber.night@protonmail.com>
Date: Fri, 6 Apr 2018 16:43:11 +0200
fix #4236
Diffstat:
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/lib/transaction.py b/lib/transaction.py
@@ -805,18 +805,17 @@ class Transaction:
@classmethod
def get_preimage_script(self, txin):
- # only for non-segwit
+ pubkeys, x_pubkeys = self.get_sorted_pubkeys(txin)
if txin['type'] == 'p2pkh':
return bitcoin.address_to_script(txin['address'])
elif txin['type'] in ['p2sh', 'p2wsh', 'p2wsh-p2sh']:
- pubkeys, x_pubkeys = self.get_sorted_pubkeys(txin)
return multisig_script(pubkeys, txin['num_sig'])
elif txin['type'] in ['p2wpkh', 'p2wpkh-p2sh']:
- pubkey = txin['pubkeys'][0]
+ pubkey = pubkeys[0]
pkh = bh2u(bitcoin.hash_160(bfh(pubkey)))
return '76a9' + push_script(pkh) + '88ac'
elif txin['type'] == 'p2pk':
- pubkey = txin['pubkeys'][0]
+ pubkey = pubkeys[0]
return bitcoin.public_key_to_p2pk_script(pubkey)
else:
raise TypeError('Unknown txin type', txin['type'])