3 minor findings · 4 suggestions
Findings
[minor] · Unchanged snapshots repeatedly reset the address, coin and request models
While a saved request has an unconfirmed mempool payment, eligible one-second polls reset unchanged wallet lists, adding GUI-thread work and potentially interrupting address-note editing.
Location: qml/models/walletqmlmodel.cpp:684 (head).
Details and suggested fix
applyWalletState() always calls receiveRequests()->setEntries() and emits walletStateChanged(). The former resets request history; the latter now resets the address model and resets the coin model twice. A pending payment to a saved request makes poll() bypass its unchanged-tip shortcut, so this repeats on eligible 1000 ms polls until the payment confirms or becomes inactive. Overlapping refreshes and pending receive or coin-lock commands suppress polls, but unchanged results still reset the models. The Receive address category does not reuse delegates, so a reset can discard the focused note editor and its cursor position. pendingNotesByAddress preserves draft text, not focus. These effects are inferred from model-reset behavior, not observed in a running UI. Request resets also recompute the activity projection, although its stable-ID reconciliation avoids resetting unchanged activity rows. Compare snapshot fields before publishing: skip equal request entries and notify the address and coin models only when their relevant data changes.
[minor] · Wallet snapshots repeat synchronous send-balance queries on the GUI thread
Each applied snapshot triggers locking send-balance queries on the GUI thread, even while Send is hidden, despite the worker already caching the default balance.
Location: qml/models/walletqmlmodel.cpp:663 (head).
Details and suggested fix
walletStateChanged() now makes CoinsListModel::update() emit coinCountChanged and selectedCoinsCountChanged unconditionally. SendCreate's available-amount binding consequently calls availableSendBalanceSatoshi(), and its selection handler calls scheduleFeeEstimates(). The latter queries the wallet immediately in maximum mode with an empty destination, before starting the asynchronous estimator. Each snapshot also emits sendAmountExhaustsBalanceChanged, whose getter queries the wallet for valid drafts. SendCreate is a direct StackLayout child, and these bindings and handlers have no visibility guard. Although the calls existed at base, unchanged snapshots now repeat them. In the pinned backend, getAvailableBalance() takes cs_wallet and computes available inputs, so contention or a large UTXO set can still block the GUI. Return m_wallet_state.available_balance from the default-balance getter. Compute selection-sensitive exhaustion and maximum-remainder results on the worker from captured coin control and draft data, accepting results only for the matching draft revision. Do not replace selection-aware values with the default balance. Latency was not measured.
[minor] · Selecting a receive address changes both drafts before reporting failure
Creating a request during a pending label save can replace both receive drafts, then report that the address is unavailable without navigating or remembering the chosen address.
Location: qml/models/walletqmlmodel.cpp:1247 (head).
Details and suggested fix
For an address without a saved request, setCurrentPaymentRequestAddress() clears and repoints both m_current_payment_request and m_receiving_address before submitting RememberAddress. Submission returns false if another receive operation is pending. AddressDetails submits label edits on editingFinished, but its Create button has no pending-label guard. If the save is still pending when Create runs, AddressList shows “This address is no longer available.” and stays on Addresses after both drafts have changed. This timing window depends on worker latency and was not reproduced. usePaymentRequestAsTemplate() similarly clears the receiving address and ignores a rejected preference-removal command, allowing a later preparation to restore an unused remembered address. Paid or saved addresses remain excluded by backend checks. Check availability and pending-operation state before mutating either workflow's drafts, and leave them unchanged when the command cannot be accepted.
Optional improvements
[suggestion] · Pending request payments cause full-wallet scans on every eligible poll
An unconfirmed payment to a saved request makes eligible one-second polls enumerate the whole wallet on the same serial worker used for receive commands, coin locks, fee previews and signing.
Location: qml/models/walletstatesnapshot.cpp:215 (head).
Details and suggested fix
When m_unconfirmed_payments is true, poll() skips the processed-tip check and calls the full read(), even if nothing changed. This reloads balances, addresses, coins, locks and requests, copies every wallet transaction, and fetches details for request-paying transactions. These reads acquire wallet locks and occupy the shared executor. Pending receive or coin-lock commands suppress new polls, but can still wait behind a scan already queued or running. The base poll checked only known unconfirmed txids. Record those txids during full reads and, on unchanged-tip polls, check only their status, falling back to a full read when a status changes. Keep full reads for initial load, notifications and tip changes so confirmation, maturity and new payments remain covered. This preserves detection of silent mempool departure without repeatedly enumerating unrelated history. Latency was not measured; the cost grows with wallet size.
[suggestion] · Dismissing a pending request modal loses late failure feedback
A request update or deletion can fail after Escape or outside-click dismissal, leaving its error on a hidden card that clears the message before reopening.
Location: qml/components/PaymentRequestCard.qml:230 (head).
Details and suggested fix
The asynchronous completion handler writes failures only to the card's actionErrorText. Pending work disables the card contents, including its Close button, but PaymentRequestModal still allows Escape and outside-click dismissal. If the operation fails after dismissal, the hidden card receives the error; openRequest() clears it before the user can see it. A failure during the closing transition can also be cleared by onClosed. The user then sees an unchanged or undeleted request without an explanation. Make the modal's close policy conditional on its card having no pending operation, so these dismissals cannot hide the result. If dismissal must remain available, route failures to durable feedback tied to the submitted request ID instead. Keep delayed errors from appearing in another request opening.
[suggestion] · Receive commands hold cs_wallet during GUI preference file writes
EnsureAddress and Save retain the wallet lock across QSettings synchronization and, for EnsureAddress, settings.json persistence, extending wallet-lock hold time with unrelated file I/O.
Location: qml/models/walletstatesnapshot.cpp:270 (head).
Details and suggested fix
execute() acquires an outer cs_wallet lock for EnsureAddress and Save and releases it only in complete(). EnsureAddress reaches settings.sync() and setAddressType() while still holding it; the latter takes the shared settings-writer mutex and calls WriteSettingsFile(). Save likewise synchronizes removal of the remembered-address preference under the lock. Keep wallet-side validation and mutation atomic, but release wallet_lock after those mutations and before persisting the captured address and type preferences. These GUI preference stores have their own synchronization and are not protected by cs_wallet. Retaining that lock through their I/O makes wallet RPCs and validation callbacks wait unnecessarily. No deadlock was established, and the latency effect for these infrequent actions was not measured.
[suggestion] · Each image saver starts a worker thread before any QR export
Every constructed ImageSaveModel starts and registers its own worker thread, so instantiated payment cards retain idle threads even when their QR save action is never used.
Location: qml/models/imagesavemodel.h:28 (head).
Details and suggested fix
ImageSaveModel owns BackendExecutor by value, and that executor's constructor immediately allocates, globally registers and starts a QThread. PaymentRequestCard declares an image saver unconditionally. The Receive workspace and the Receive, Activity and transaction-detail modals therefore each add a worker when their cards are instantiated, regardless of whether the user saves a QR image. Every such worker also participates in shutdown draining. Create the executor lazily on the first valid save() call, retaining the existing receiver-lifetime guard and shutdown registration. This reduces idle thread count and shutdown coordination without changing asynchronous saving; it is not a saving-speed or correctness issue.