Review report

bitcoin-core/gui-qml: PR #990

2 minor findings · 1 suggestion

Findings

Link

[minor] · Wallet snapshots re-run synchronous send-balance queries

Snapshot notifications repeat synchronous balance queries from the always-instantiated Send page, leaving GUI-thread wallet locking and coin enumeration despite the worker cache.

Location: qml/models/walletqmlmodel.cpp:663 (head).

Details and suggested fix

applyWalletState() emits walletStateChanged() on every snapshot. That updates CoinsListModel, whose unconditional coinCountChanged() re-evaluates SendCreate's availableAmount binding even when Send is hidden. availableSendBalanceSatoshi() still calls the wallet directly, although the worker already caches the identical default-coin-control computation in available_balance. The unconditional sendAmountExhaustsBalanceChanged() also repeats a live query whenever the draft passes allValid(). At the pinned dependency, these calls take cs_wallet and calculate coin availability. Both getters predate this PR, but the new notification path repeats their work even for unchanged snapshots. Return the cached value from the ordinary available-balance getter. For the exhaustion predicate, compute availability on the worker using the captured draft and coin control, and apply it only while the draft revision still matches. Preserve its selected-input policy rather than substituting the default balance. Latency was not measured; the work depends on wallet size and lock contention.


Link

[minor] · Unchanged payment polls reset editable address rows

While a saved request has an unconfirmed mempool payment, unchanged snapshots repeatedly reset the address and coin models, recreating editable address delegates and potentially interrupting label editing.

Location: qml/models/addresslistmodel.cpp:65 (head).

Details and suggested fix

poll() bypasses the unchanged-tip shortcut while m_unconfirmed_payments is set. Each eligible one-second poll therefore applies a snapshot even when its list data is unchanged. applyWalletState() unconditionally emits walletStateChanged(), now connected directly to both list models, and both reset without comparing entries. On the Addresses page's Receive category, reuseItems is false, so resets recreate the AddressRow delegates, including a focused note editor on another unused address. pendingNotesByAddress preserves draft text, not focus or cursor state. Manual coin selections survive because they live in WalletQmlModel. The precise focus and editingFinished timing has not been tested. Compare each list's derived entries and skip the reset when they are unchanged, retaining walletStateChanged for readiness and error consumers. Add a QML regression test that keeps a note field focused across an unchanged snapshot.


Optional improvements

Link

[suggestion] · Pending request payments trigger full-wallet polling

An unchanged unconfirmed payment causes each eligible one-second poll to enumerate the whole wallet on the shared serial worker, instead of checking only pending transaction IDs as base did.

Location: qml/models/walletstatesnapshot.cpp:215 (head).

Details and suggested fix

While a saved request has an unconfirmed mempool payment, poll() bypasses the processed-tip check and calls the full read(). That reloads balances, addresses, coins, locked coins, receive requests, and every wallet transaction, then checks details for transactions paying request addresses. Base polled only the known unconfirmed request txids. Receive commands, coin locks, fee previews, and message signing share this serial executor, so a scan already running can delay those actions even though the poll guard prevents overlapping polls. Prefer recording the pending request txids during read() and checking only their status on unchanged-tip polls, falling back to a full read when a status changes. Keep full reads for initial load, notifications, and processed-tip changes, including maturity reconciliation. A call-count test can verify that unchanged pending payments no longer repeatedly enumerate the wallet. The latency impact depends on wallet size and backend cost and was not measured.


Coverage details