What changed, and why it matters
This commit is a performance optimization for Electrum's mobile/QML user interface. It prevents the wallet balance from being recalculated and redrawn on every incoming transaction during synchronization, because the balance isn't shown during sync anyway. It is not a security fix and does not change how transactions are validated or stored.
No security action required. Treat as a routine UI performance improvement.
Security signals we found
No strong security signals were identified.
Evidence from the diff
In electrum/gui/qml/qewallet.py, the on_event_wallet_new_transaction handler now only emits balanceChanged when self.wallet.is_up_to_date() is true. During initial sync, new_transaction fires for each historical transaction; previously each emit caused QML to recompute the balance on the GUI thread, producing UI jank. The final balance update is still emitted via on_event_wallet_updated once synchronization completes. No cryptographic, networking, or wallet-state logic is modified.
Changed components
electrum/gui/qml/qewallet.pyQML GUI balance update pathInspect captured patch +4 / −1
diff --git a/electrum/gui/qml/qewallet.py b/electrum/gui/qml/qewallet.py
index eeabf52..35aec4b 100644
--- a/electrum/gui/qml/qewallet.py
+++ b/electrum/gui/qml/qewallet.py
@@ -204,7 +204,10 @@ class QEWallet(AuthMixin, QObject, QtEventListener):
self.add_tx_notification(tx)
self.addressCoinModel.setDirty()
self.historyModel.setDirty() # assuming wallet.is_up_to_date triggers after
- self.balanceChanged.emit()
+ if self.wallet.is_up_to_date():
+ # don't update during sync as this recomputes the balance on each new tx, blocking the UI thread.
+ # on_event_wallet_updated emits balanceChanged once we are up-to-date.
+ self.balanceChanged.emit()
@qt_event_listener
def on_event_adb_tx_height_changed(self, adb, txid, old_height, new_height):
Why this scored 18/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.