commit ebcc983566501e407cb2189ff04f1614fabae004
parent b4d71e651b16a16afc427f87542b8fd9e05b66e3
Author: SomberNight <somber.night@protonmail.com>
Date: Wed, 11 Apr 2018 19:17:47 +0200
wallet.py: build local history from txi and txo, not transactions
Diffstat:
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git 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):