From ebcc983566501e407cb2189ff04f1614fabae004 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Wed, 11 Apr 2018 19:17:47 +0200 Subject: [PATCH] wallet.py: build local history from txi and txo, not transactions --- lib/wallet.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/wallet.py b/lib/wallet.py index 9063e1423..e26e14c30 100644 --- a/lib/wallet.py +++ b/lib/wallet.py @@ -206,6 +206,7 @@ class Abstract_Wallet(PrintError): self.load_keystore() self.load_addresses() self.load_transactions() + self.load_local_history() self.build_spent_outpoints() self.test_addresses_sanity() @@ -255,7 +256,6 @@ class Abstract_Wallet(PrintError): self.pruned_txo = self.storage.get('pruned_txo', {}) tx_list = self.storage.get('transactions', {}) self.transactions = {} - self._history_local = {} # address -> set(txid) for tx_hash, raw in tx_list.items(): tx = Transaction(raw) self.transactions[tx_hash] = tx @@ -263,8 +263,12 @@ class Abstract_Wallet(PrintError): and (tx_hash not in self.pruned_txo.values()): self.print_error("removing unreferenced tx", tx_hash) self.transactions.pop(tx_hash) - else: - self._add_tx_to_local_history(tx_hash) + + @profiler + def load_local_history(self): + self._history_local = {} # address -> set(txid) + for txid in itertools.chain(self.txi, self.txo): + self._add_tx_to_local_history(txid) @profiler def save_transactions(self, write=False):