commit 1935d7d1654b7b90f35167e342bcfc0732c69bce
parent 7dcefd999f389d6f1bff2b9cf5d0008a4ed26727
Author: SomberNight <somber.night@protonmail.com>
Date: Wed, 11 Apr 2018 19:53:33 +0200
wallet.py: remove local transactions that we don't have
fixes #4232
closes #4234
Diffstat:
1 file changed, 8 insertions(+), 0 deletions(-)
diff --git 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: