qml: emit a single dataChanged when updating blockchain height
What changed, and why it matters
This change is a performance cleanup in Electrum's mobile/QML user interface. When the wallet learns that the Bitcoin blockchain has grown taller, it now refreshes the transaction list with a single 'everything changed' signal instead of sending one signal per transaction. That reduces UI lag and log noise, but it does not fix a security vulnerability.
No security action needed; treat as a normal UI performance improvement.
Security signals we found
No security-relevant logic change
Performance/efficiency optimization only
No input validation, parsing, cryptography, or network changes
No privilege boundary crossed
Evidence from the diff
The commit refactors QETransactionListModel.updateBlockchainHeight() to emit one dataChanged(topLeft, bottomRight, roles) call covering the whole model instead of emitting dataChanged per row. It also adds an early return when tx_history is empty and switches a log line to f-string formatting. The logic for computing confirmations and updating future/local transactions is unchanged.
Changed components
electrum/gui/qml/qetransactionlistmodel.pyInspect captured patch +8 / −4
diff --git a/electrum/gui/qml/qetransactionlistmodel.py b/electrum/gui/qml/qetransactionlistmodel.py
index 62f1a16..01c346d 100644
--- a/electrum/gui/qml/qetransactionlistmodel.py
+++ b/electrum/gui/qml/qetransactionlistmodel.py
@@ -275,13 +275,17 @@ class QETransactionListModel(QAbstractListModel, QtEventListener):
@pyqtSlot(int)
def updateBlockchainHeight(self, height):
- self._logger.debug('updating height to %d' % height)
+ self._logger.debug(f'updating height to {height}')
+ if not self.tx_history:
+ return
for i, tx_item in enumerate(self.tx_history):
if 'height' in tx_item:
if tx_item['height'] > 0:
tx_item['confirmations'] = height - tx_item['height'] + 1
- index = self.index(i, 0)
- roles = [self._ROLE_RMAP['confirmations']]
- self.dataChanged.emit(index, index, roles)
elif tx_item['height'] in (TX_HEIGHT_FUTURE, TX_HEIGHT_LOCAL):
self._update_future_txitem(i)
+ self.dataChanged.emit(
+ self.index(0, 0),
+ self.index(len(self.tx_history) - 1, 0),
+ [self._ROLE_RMAP['confirmations']],
+ )
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.