3 minor findings · 1 suggestion
Findings
[minor] · Applied snapshots still trigger GUI-thread Send balance scans
Applied snapshots now re-evaluate the pre-existing synchronous Send balance getters, including while Send is hidden; the available-balance query and valid-draft exhaustion check still scan wallet data and can wait on cs_wallet.
Location: qml/models/walletqmlmodel.cpp:666 (head).
Details and suggested fix
applyWalletState() emits walletStateChanged, which makes CoinsListModel::update() emit coinCountChanged. SendCreate's available-amount binding reads that count and then calls availableSendBalanceSatoshi(). The unconditional sendAmountExhaustsBalanceChanged also re-evaluates the exhaustion check whenever the draft passes allValid(). SendCreate remains instantiated in WalletView's StackLayout, so hiding Send does not remove these bindings. In pinned Core, both queries acquire cs_wallet and enumerate available coins. Receive-command and coin-lock snapshots therefore retain GUI-thread work and introduce contention with worker operations holding that lock. The unchanged-payment poll no longer triggers this when it returns no snapshot.
Return the already-computed m_wallet_state.available_balance from the default-balance getter; its change notification is already present. Compute the exhaustion check's coin-control-specific balance on the worker alongside fee previews, accepting it only for the matching draft request ID. Preserve selected-input policy and the no-fee-estimate fallback rather than substituting the default balance. Latency was not measured.
[minor] · Temporary worker unlocks race with GUI transaction signing
Overlapping worker signing or passphrase receive work with GUI transaction signing can let one operation relock the wallet after another skips its password prompt; this narrow race has not been reproduced deterministically.
Location: qml/models/signverifymessagemodel.cpp:89 (head).
Details and suggested fix
Message signing and passphrase receive commands now own temporary unlocks on the executor, while transaction preparation and PSBT signing retain separate GUI-thread unlock/relock scopes. For an initially locked encrypted wallet, a GUI lock check can observe the worker's temporary unlock and proceed without acquiring relock ownership. If the worker relocks before the GUI signing call, preparation fails instead of requesting the password. The reverse interleaving can also fail message signing. TryUnlockWithPassphrase() treats any existing unlock as AlreadyUnlocked, and WalletRelockGuard has no shared ownership count. Core serializes individual wallet calls, not these complete scopes. Save/EnsureAddress's explicit cs_wallet lock narrows the overlap to call boundaries, including the gap before relocking; it does not eliminate it.
Serialize all unlock-requiring actions on the same per-wallet executor, and add a barrier-based overlap test checking both results and the final locked state. The established concern is spurious failures and confusing prompts, not unintended spending or a persistent unlocked wallet.
[minor] · A rejected Addresses action still replaces the Receive draft
Creating a payment request from Addresses while a label save is pending reports the address unavailable, but first clears and replaces the Receive draft, leaving state changed despite the rejected action.
Location: qml/models/walletqmlmodel.cpp:1252 (head).
Details and suggested fix
For an address without a saved request, setCurrentPaymentRequestAddress() clears and rewrites both m_current_payment_request and m_receiving_address before submitting RememberAddress. If another receive command is pending, submission immediately returns false. Address-note saves use that queue, but the AddressDetails create button has no pending guard. Saving a note and then choosing Create payment request before completion therefore closes the popup and shows “This address is no longer available” without opening Receive, although the draft already contains that address. A later EnsureAddress uses the rewritten receiving address if it remains eligible. Base's synchronous settings write could not reject at this point. Check command acceptance preconditions before mutating either request, or mutate only after successful submission.
Optional improvements
[suggestion] · Receive commands repeat full scans and retain a broad wallet lock
Successful Save/EnsureAddress commands perform three full wallet reads; EnsureAddress also holds cs_wallet through settings I/O, extending contention with GUI wallet calls, although stall durations have not been measured.
Location: qml/models/walletstatesnapshot.cpp:286 (head).
Details and suggested fix
execute() first calls read(node), then takes the real wallet's cs_wallet for Save/EnsureAddress and replaces that snapshot with another full read. These reads include balances, coin enumeration, address maps, request history and wallet transactions. complete() releases the lock and performs a third read. EnsureAddress additionally runs QSettings::sync() and Core settings-file persistence before releasing it. GUI calls such as transaction preparation's isLocked() can wait for that entire critical section, and the redundant scans also delay queued worker operations.
Skip the preliminary full read for these command kinds and narrow the protected helper to the request/address checks and wallet mutation. Preserve atomic validation against observed payments and existing requests, but leave balance and coin enumeration to the final snapshot. Move the receive-preference settings writes outside cs_wallet.