fix #2302: signing with imported wallet

This commit is contained in:
ThomasV 2017-03-20 10:47:03 +01:00
parent ded07132d2
commit 737a7f0bfb
2 changed files with 5 additions and 5 deletions

View File

@ -652,6 +652,8 @@ class Transaction:
elif _type == 'p2wpkh-p2sh':
redeem_script = segwit_script(pubkeys[0])
return push_script(redeem_script)
elif _type == 'address':
script += push_script(pubkeys[0])
else:
raise TypeError('Unknown txin type', _type)
return script
@ -822,12 +824,10 @@ class Transaction:
if len(signatures) == num:
# txin is complete
break
fd_key = 'fd00' + bitcoin.hash_160(pubkeys[j].decode('hex')).encode('hex')
if x_pubkey in keypairs.keys() or fd_key in keypairs.keys():
if x_pubkey in keypairs.keys():
print_error("adding signature for", x_pubkey)
sec = keypairs.get(x_pubkey) or keypairs.get(fd_key)
sec = keypairs.get(x_pubkey)
pubkey = public_key_from_private_key(sec)
assert pubkey == pubkeys[j]
# add signature
pre_hash = Hash(self.serialize_preimage(i).decode('hex'))
pkey = regenerate_key(sec)

View File

@ -1320,7 +1320,7 @@ class Imported_Wallet(Abstract_Wallet):
# wallet made of imported addresses
wallet_type = 'imported'
txin_type = 'unknown'
txin_type = 'address'
def __init__(self, storage):
Abstract_Wallet.__init__(self, storage)