Browse Source

wallet.py: remove local transactions that we don't have

fixes #4232
closes #4234
3.2.x
SomberNight 7 years ago
parent
commit
1935d7d165
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 8
      lib/wallet.py

8
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:

Loading…
Cancel
Save