From 49c2ba5b122a757bf4066fdfbec427036dab55af Mon Sep 17 00:00:00 2001 From: Chris Rico Date: Thu, 28 Aug 2014 05:13:03 -0500 Subject: [PATCH 1/2] Removed hard coded purpose and coin_type (provided by Wallet.get_address_index) Only look up address when not a coinbase transaction --- plugins/trezor.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/plugins/trezor.py b/plugins/trezor.py index 79bb85e0..1607c00f 100644 --- a/plugins/trezor.py +++ b/plugins/trezor.py @@ -179,7 +179,7 @@ class TrezorWallet(NewWallet): def address_id(self, address): account_id, (change, address_index) = self.get_address_index(address) - return "44'/0'/%s'/%d/%d" % (account_id, change, address_index) + return "%s/%d/%d" % (account_id, change, address_index) def create_main_account(self, password): self.create_account('Main account', None) #name, empty password @@ -262,17 +262,17 @@ class TrezorWallet(NewWallet): for txinput in tx.inputs: txinputtype = types.TxInputType() - address = txinput['address'] - try: - address_path = self.address_id(address) - address_n = self.get_client().expand_path(address_path) - txinputtype.address_n.extend(address_n) - except: pass - if ('is_coinbase' in txinput and txinput['is_coinbase']): prev_hash = "\0"*32 prev_index = 0xffffffff # signed int -1 else: + address = txinput['address'] + try: + address_path = self.address_id(address) + address_n = self.get_client().expand_path(address_path) + txinputtype.address_n.extend(address_n) + except: pass + prev_hash = unhexlify(txinput['prevout_hash']) prev_index = txinput['prevout_n'] From 4f82fce81df01aa3d59762de9c7cc9138836ed45 Mon Sep 17 00:00:00 2001 From: Chris Rico Date: Thu, 28 Aug 2014 10:38:56 -0500 Subject: [PATCH 2/2] Reverted change to TrezorWallet.address_id() --- plugins/trezor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/trezor.py b/plugins/trezor.py index 1607c00f..a889eed0 100644 --- a/plugins/trezor.py +++ b/plugins/trezor.py @@ -179,7 +179,7 @@ class TrezorWallet(NewWallet): def address_id(self, address): account_id, (change, address_index) = self.get_address_index(address) - return "%s/%d/%d" % (account_id, change, address_index) + return "44'/0'/%s'/%d/%d" % (account_id, change, address_index) def create_main_account(self, password): self.create_account('Main account', None) #name, empty password