From 737a7f0bfbfd2b674f3af2ecfcc1a411f0cadb2e Mon Sep 17 00:00:00 2001 From: ThomasV Date: Mon, 20 Mar 2017 10:47:03 +0100 Subject: [PATCH] fix #2302: signing with imported wallet --- lib/transaction.py | 8 ++++---- lib/wallet.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/transaction.py b/lib/transaction.py index 6048bac0..b80ded06 100644 --- a/lib/transaction.py +++ b/lib/transaction.py @@ -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) diff --git a/lib/wallet.py b/lib/wallet.py index 7d9fe2a2..6b6bf098 100644 --- a/lib/wallet.py +++ b/lib/wallet.py @@ -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)