AddressSynchronizer: remove unneccessary loop
What changed, and why it matters
This is a minor code cleanup in Electrum's transaction handling. A developer removed a redundant loop that was calling the same cache-clearing function multiple times, replacing it with a single call. There is no security issue visible in the change.
No action needed. This is a benign refactoring commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
In AddressSynchronizer.remove_transaction(), the patch replaces a loop over input/output addresses that repeatedly called self.invalidate_cache() with a single unconditional call to self.invalidate_cache(). The function invalidates the entire cache regardless of address, so iterating over addresses was unnecessary. No functional or security behavior changes.
Changed components
electrum/address_synchronizer.pyInspect captured patch +1 / −2
diff --git a/electrum/address_synchronizer.py b/electrum/address_synchronizer.py
index a946426..0197ba0 100644
--- a/electrum/address_synchronizer.py
+++ b/electrum/address_synchronizer.py
@@ -413,8 +413,7 @@ class AddressSynchronizer(Logger, EventListener):
tx = self.db.remove_transaction(tx_hash)
remove_from_spent_outpoints()
self._remove_tx_from_local_history(tx_hash)
- for addr in itertools.chain(self.db.get_txi_addresses(tx_hash), self.db.get_txo_addresses(tx_hash)):
- self.invalidate_cache()
+ self.invalidate_cache()
self.db.remove_txi(tx_hash)
self.db.remove_txo(tx_hash)
self.db.remove_tx_fee(tx_hash)
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.