fix #2302: signing with imported wallet
This commit is contained in:
parent
ded07132d2
commit
737a7f0bfb
|
@ -652,6 +652,8 @@ class Transaction:
|
||||||
elif _type == 'p2wpkh-p2sh':
|
elif _type == 'p2wpkh-p2sh':
|
||||||
redeem_script = segwit_script(pubkeys[0])
|
redeem_script = segwit_script(pubkeys[0])
|
||||||
return push_script(redeem_script)
|
return push_script(redeem_script)
|
||||||
|
elif _type == 'address':
|
||||||
|
script += push_script(pubkeys[0])
|
||||||
else:
|
else:
|
||||||
raise TypeError('Unknown txin type', _type)
|
raise TypeError('Unknown txin type', _type)
|
||||||
return script
|
return script
|
||||||
|
@ -822,12 +824,10 @@ class Transaction:
|
||||||
if len(signatures) == num:
|
if len(signatures) == num:
|
||||||
# txin is complete
|
# txin is complete
|
||||||
break
|
break
|
||||||
fd_key = 'fd00' + bitcoin.hash_160(pubkeys[j].decode('hex')).encode('hex')
|
if x_pubkey in keypairs.keys():
|
||||||
if x_pubkey in keypairs.keys() or fd_key in keypairs.keys():
|
|
||||||
print_error("adding signature for", x_pubkey)
|
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)
|
pubkey = public_key_from_private_key(sec)
|
||||||
assert pubkey == pubkeys[j]
|
|
||||||
# add signature
|
# add signature
|
||||||
pre_hash = Hash(self.serialize_preimage(i).decode('hex'))
|
pre_hash = Hash(self.serialize_preimage(i).decode('hex'))
|
||||||
pkey = regenerate_key(sec)
|
pkey = regenerate_key(sec)
|
||||||
|
|
|
@ -1320,7 +1320,7 @@ class Imported_Wallet(Abstract_Wallet):
|
||||||
# wallet made of imported addresses
|
# wallet made of imported addresses
|
||||||
|
|
||||||
wallet_type = 'imported'
|
wallet_type = 'imported'
|
||||||
txin_type = 'unknown'
|
txin_type = 'address'
|
||||||
|
|
||||||
def __init__(self, storage):
|
def __init__(self, storage):
|
||||||
Abstract_Wallet.__init__(self, storage)
|
Abstract_Wallet.__init__(self, storage)
|
||||||
|
|
Loading…
Reference in New Issue