tfollow up 08543584c523c382ff37454598426aa446a940a9 - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 03c66bb5f966aa1f90faab052a826cc6cea5e889 DIR parent 08543584c523c382ff37454598426aa446a940a9 HTML Author: ThomasV <thomasv@electrum.org> Date: Wed, 21 Sep 2016 16:44:21 +0200 follow up 08543584c523c382ff37454598426aa446a940a9 Diffstat: M lib/keystore.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) --- DIR diff --git a/lib/keystore.py b/lib/keystore.py t@@ -161,7 +161,7 @@ class Imported_KeyStore(Software_KeyStore): return pubkey def get_xpubkey(self, c, i): - return self.get_public_key((c,i)).encode('hex') + return self.get_public_key((c,i)) def get_private_key(self, sequence, password): for_change, i = sequence t@@ -174,13 +174,16 @@ class Imported_KeyStore(Software_KeyStore): return pk def get_pubkey_derivation(self, x_pubkey): - if x_pubkey[0:2] != 'fd': - return - # fixme: this assumes p2pkh - _, addr = xpubkey_to_address(x_pubkey) - for i, pubkey in enumerate(self.receiving_pubkeys): - if public_key_to_bc_address(pubkey.decode('hex')) == addr: + if x_pubkey[0:2] in ['02', '03', '04']: + if x_pubkey in self.receiving_pubkeys: + i = self.receiving_pubkeys.index(x_pubkey) return (False, i) + elif x_pubkey[0:2] == 'fd': + # fixme: this assumes p2pkh + _, addr = xpubkey_to_address(x_pubkey) + for i, pubkey in enumerate(self.receiving_pubkeys): + if public_key_to_bc_address(pubkey.decode('hex')) == addr: + return (False, i) def update_password(self, old_password, new_password): if old_password is not None: