From fe538cc31015b01e5e4b5c8e861e80223b29cd7e Mon Sep 17 00:00:00 2001 From: ThomasV Date: Mon, 2 Sep 2013 10:41:50 +0200 Subject: [PATCH] fix get_private_key for old addresses --- lib/account.py | 3 ++- lib/wallet.py | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/account.py b/lib/account.py index 303882878..12fb1490b 100644 --- a/lib/account.py +++ b/lib/account.py @@ -95,7 +95,8 @@ class OldAccount(Account): compressed = False return SecretToASecret( pk, compressed ) - def get_private_key(self, for_change, n, seed): + def get_private_key(self, seed, sequence): + for_change, n = sequence secexp = self.stretch_key(seed) return self.get_private_key_from_stretched_exponent(for_change, n, secexp) diff --git a/lib/wallet.py b/lib/wallet.py index 10f749b0a..7c9c92e52 100644 --- a/lib/wallet.py +++ b/lib/wallet.py @@ -463,6 +463,9 @@ class Wallet: def get_keyID(self, account, sequence): + if account == 0: + return 'old' + rs = self.rebase_sequence(account, sequence) dd = [] for root, public_sequence in rs: @@ -489,6 +492,12 @@ class Wallet: out.append( pw_decode( self.imported_keys[address], password ) ) else: account, sequence = self.get_address_index(address) + if account == 0: + seed = self.decode_seed(password) + pk = self.accounts[account].get_private_key(seed, sequence) + out.append(pk) + return out + # assert address == self.accounts[account].get_address(*sequence) rs = self.rebase_sequence( account, sequence) for root, public_sequence in rs: