From 1935d7d1654b7b90f35167e342bcfc0732c69bce Mon Sep 17 00:00:00 2001 From: SomberNight Date: Wed, 11 Apr 2018 19:53:33 +0200 Subject: [PATCH] wallet.py: remove local transactions that we don't have fixes #4232 closes #4234 --- lib/wallet.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/wallet.py b/lib/wallet.py index 47f7c25a4..0826de2d1 100644 --- a/lib/wallet.py +++ b/lib/wallet.py @@ -219,6 +219,7 @@ class Abstract_Wallet(PrintError): self.load_unverified_transactions() self.load_local_history() self.build_spent_outpoints() + self.remove_local_transactions_we_dont_have() # there is a difference between wallet.up_to_date and interface.is_up_to_date() # interface.is_up_to_date() returns true when all requests have been answered and processed @@ -267,6 +268,13 @@ class Abstract_Wallet(PrintError): for txid in itertools.chain(self.txi, self.txo): self._add_tx_to_local_history(txid) + def remove_local_transactions_we_dont_have(self): + txid_set = set(self.txi) | set(self.txo) + for txid in txid_set: + tx_height = self.get_tx_height(txid)[0] + if tx_height == TX_HEIGHT_LOCAL and txid not in self.transactions: + self.remove_transaction(txid) + @profiler def save_transactions(self, write=False): with self.transaction_lock: