Merge pull request #11088 from accumulator/self_dirty_qeaddresslistmodel
What changed, and why it matters
This commit moves responsibility for refreshing an address list in Electrum's QML (mobile-style) user interface. Previously, the wallet object told the address list to refresh when transactions arrived or were removed. Now the address list listens for those events itself and refreshes. This is a code-quality/refactoring change with no visible security impact.
No security action required. Treat as normal UI maintainability merge.
Security signals we found
No security-relevant code paths modified
UI-only model refresh logic refactor
No input validation, serialization, or wallet-seed handling touched
Evidence from the diff
The patch relocates dirty-flagging of QEAddressListModel from QEBWallet.on_event_new_transaction / on_event_removed_transaction into QEAddressListModel itself via new qt_event_listener handlers. This decouples the wallet class from the address model lifecycle and ensures the model marks itself stale whenever its wallet emits new_transaction or removed_transaction events. No cryptographic, network, or permission logic is changed.
Changed components
electrum/gui/qml/qeaddresslistmodel.pyelectrum/gui/qml/qewallet.pyInspect captured patch +10 / −4
### electrum/gui/qml/qeaddresslistmodel.py
@@ -138,6 +138,16 @@ def on_event_labels_received(self, wallet, labels):
if wallet == self.wallet:
self.setDirty()
+ @qt_event_listener
+ def on_event_removed_transaction(self, wallet, tx):
+ if self.wallet == wallet:
+ self.setDirty()
+
+ @qt_event_listener
+ def on_event_new_transaction(self, wallet, tx):
+ if self.wallet == wallet:
+ self.setDirty()
+
def rowCount(self, index):
return len(self._items)
### electrum/gui/qml/qewallet.py
@@ -206,8 +206,6 @@ def on_event_new_transaction(self, wallet: 'Abstract_Wallet', tx: Transaction):
if wallet == self.wallet:
self._logger.debug(f'new transaction {tx.txid()}')
self.add_tx_notification(tx)
- if self._addressCoinModel is not None: # only setDirty if it was already initialized
- self._addressCoinModel.setDirty()
self.historyModel.setDirty() # assuming wallet.is_up_to_date triggers after
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.
@@ -226,8 +224,6 @@ def on_event_removed_transaction(self, wallet, tx):
# is deleted along with multiple associated txs
if wallet == self.wallet:
self._logger.info(f'removed transaction {tx.txid()}')
- if self._addressCoinModel is not None:
- self._addressCoinModel.setDirty()
self.historyModel.setDirty()
self.balanceChanged.emit()
Why this scored 17/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.