6 minor findings · 6 suggestions
Findings
[minor] · Terminal import-recovery states leave GUI backups blocked
An incomplete installation cannot finish through recovery, and a repeatedly failing rescan keeps the same backup block, although the error tells users to back up once the import finishes.
Location: qml/models/walletqmlmodel.cpp:1089 (head).
Details and suggested fix
resumeInterruptedImport sets historyRecovery to incomplete and returns without scheduling recovery or clearing the marker. A failed rescan also retains its marker, so retries cannot help while required blocks remain unavailable. Both backup guards reject these states, and the nondismissable banner offers no acknowledgement path. Provide a warned backup option for terminal states rather than requiring an import that cannot finish. Also clear obsolete markers when creating a new wallet at a reused path: deleting the previous wallet outside the app currently lets its marker attach to the replacement.
[minor] · Reopening during cancelled recovery loses the replacement model's recovery state
Reopening a wallet before its cancelled recovery job retires leaves the replacement model without a history warning, retry action or backup guard until another reload.
Location: qml/walletqmlcontroller.cpp:574 (head).
Details and suggested fix
With recovery A running and B queued on the serial rescan executor, close B and reopen it after model retirement. Retirement clears m_retiring_wallet_names, but cancellation leaves B in m_import_rescans. Registration therefore returns before reading B's marker, leaving the new model's historyRecovery empty. When B's queued job runs, its cancelled control prevents scanning; completion removes the entry but updates only the retired model's QPointer. The marker survives, so another reload recovers. Keep the reopen guard until the recovery job retires, or recheck the marker for the current model when that job completes.
[minor] · Import exceptions bypass wallet and recovery-marker cleanup
A storage exception during descriptor setup now leaves a recovery marker behind; leaking the loaded wallet on exceptions was pre-existing, and no common production trigger was identified.
Location: qml/walletqmlcontroller.cpp:762 (head).
Details and suggested fix
After writing installed=false, the setup calls importDescriptors without catching exceptions. Core can throw from TopUpWithDB on a failed cache write before the first rescan progress callback. This bypasses the returned-error branch that calls DiscardCreatedWallet and clears the marker. BackendExecutor instead invokes a callback that only resets status and reports “Wallet creation failed.” The wallet can remain loaded but unpublished, its name stays taken, and a later load reports incomplete and blocks backups. Catch setup exceptions while the wallet is still owned and take the same discard-and-clear path as a returned error, unless keep_wallet is set.
[minor] · Failed import cleanup reports deletion without checking removal errors
If database-file removal fails, cleanup clears the recovery marker and reports the cancelled wallet deleted even though it remains on disk; production occurrence is unconfirmed.
Location: qml/walletqmlcontroller.cpp:122 (head).
Details and suggested fix
DiscardCreatedWallet passes an error_code to each fs::remove but never checks it. Its callers then clear the pending-import marker unconditionally. If directory permissions change during a long import, removal can fail, leaving a partially imported wallet whose later load has no recovery warning and whose name remains occupied. Return a cleanup result and preserve the marker while database files remain, reporting their location instead of successful deletion. Failure to remove an otherwise harmless nonempty parent directory should not be treated as failure to delete the wallet database.
[minor] · Change-only imports pass the address-generation check but cannot receive
An active internal-only descriptor passes either parser, but the resulting wallet has no receive address types and Receive offers an ineffective retry.
Location: qml/viewonlyimport.cpp:292 (head).
Details and suggested fix
A single /1/* descriptor line becomes active and internal; JSON with only active internal descriptors also passes the “could give out addresses” check. The summary warns about missing change descriptors but not missing receive descriptors. After import, availableReceiveAddressTypes is empty and ensureReceivingAddress returns false, so Receive asks the user to try again. Either require an active external slot, or explicitly support change-only monitoring with a pre-import warning and an explanatory Receive state. Cover the chosen behavior for both line and JSON input.
[minor] · Duplicate range errors are detected only after the import rescans
Repeated descriptors with non-containing ranges can trigger a full rescan before the failed import is deleted; no current producer of this JSON was identified.
Location: qml/viewonlyimport.cpp:243 (head).
Details and suggested fix
ParseJson records only active and internal settings per normalized path. It therefore accepts a repeated descriptor whose new range is narrower or shifted beyond the previous range. Core rejects that update through CanUpdateToWalletDescriptor, but ProcessDescriptorsImport still runs ScanFromTime because an earlier request succeeded. Only afterwards does the GUI return the error and discard the wallet. Track previous ranges per path and reject known non-containing updates before creation, accounting for Core's effective keypool range.
Optional improvements
[suggestion] · Historical rescans keep wallet switching and creation blocked
An old birth time holds walletLoadInProgress throughout the historical rescan, potentially blocking wallet switching, loading and creation for hours.
Location: qml/walletqmlcontroller.cpp:960 (head).
Details and suggested fix
importDescriptors performs the scan synchronously inside setup on the serial wallet-command executor. Until completion, the form hides Back and Close, WalletSelect ignores selection clicks and disables Add wallet, and controller commands queue behind the import. Cancel deletes the new wallet; quitting instead preserves it for recovery on restart. Separate descriptor installation from history scanning, publish the wallet only after successful installation, and continue scanning through the background recovery path. Keep the incomplete-history banner and backup guard until success so users can navigate away without mistaking partial history for a completed import.
[suggestion] · Descriptor setup has no total work bound and cannot be cancelled
Any number of accepted ranges can each approach 1,000,000 indexes, while Cancel is visible but only aborts the later rescan.
Location: qml/viewonlyimport.cpp:208 (head).
Details and suggested fix
ParseJson limits each range end but not the combined derivation work, including both paths of multipath descriptors. Core derives and writes those keys synchronously under cs_wallet before scanning. RescanControl only calls abortRescan, so cancelling during setup still waits for every request to finish; shutdown must also wait. Add a total budget over effective derivation ranges, or explicitly distinguish setup in the UI and explain that cancellation will take effect afterwards. No setup-duration measurement is available to justify the current per-request limit as a responsiveness bound.
[suggestion] · Interrupted-import recovery does not follow a relocated wallet
Moving an unfinished wallet or opening it under another settings profile loses its recovery marker, allowing incomplete history to load without the warning or automatic recovery.
Location: qml/walletqmlcontroller.cpp:145 (head).
Details and suggested fix
PendingImportKey encodes the wallet's current canonical path in application QSettings, and registration returns immediately when that key is absent. An interrupted import can already have the wallet's best block at the tip, so ordinary loading does not restore the missing historical scan. Blocking GUI backups addresses one separation route but not moving the wallet directory or changing settings profiles. Keep the recovery start time and installation state with the wallet so recovery follows it. If recovery intentionally supports only the original path and profile, make that limitation explicit.
[suggestion] · The pre-create block check misses unavailable snapshot history
After loadtxoutset, an old import start can pass the pruning check despite requiring unavailable pre-snapshot blocks, causing scanning before Core reports failure and the GUI deletes the wallet.
Location: qml/walletqmlcontroller.cpp:98 (head).
Details and suggested fix
ScanBlocksPruned returns immediately when havePruned() is false. That does not establish block availability during an assumeutxo background sync. If the import needs unavailable blocks, Core records scan failures and returns its assumeutxo-specific error only after scanning; the GUI then discards the wallet. Check availability from the computed start height before creation, as Core's wallet-loading path already does for pruned or assumed-valid chains, and provide an appropriate wait-for-background-sync message. This is an opt-in scenario reached through the loadtxoutset RPC.
[suggestion] · Recovery tests do not exercise the progress-driven crash-marker write
The tests seed recovery markers or use the separate shutdown branch; none checks that an actual import progress event writes installed=true with the correct wallet path and start time.
Location: test/functional/qml_test_watchonly_wallet.py:314 (head).
Details and suggested fix
case_interrupted_import_is_finished_on_restart imports through RPC and appends the marker itself. The controller fake's handleShowProgress is a no-op, so its import tests never execute the production transition through DescriptorsSaved and SetPendingImport. The helper's separate unit test does not cover that wiring. Add a controller test backed by a real CWallet that invokes the registered progress callback during import and asserts the marker's path, start time and installed=true before completion removes it.
[suggestion] · The textual line-number correction is separated from descriptor parsing
The import commit misnumbers errors after leading blank lines, and the highlighter commit fixes it; moving the independent correction would make the series easier to validate without changing head behavior.
Location: qml/viewonlyimport.cpp:455 at 54a73bdba406 (commit) (commit).
Details and suggested fix
Commit e5b6139c4c1595f47f592d9dab5660929d791c1a introduces the textual “Line N” error but passes trimmed.split('\n') to ParseLines, shifting numbers when input starts with blank lines. Commit 54a73bdba406305f275a708065d7ca362ca76418 changes this to text.split('\n') while adding highlighting and replaces the test with a leading-blank-line case. The later placement makes sense for aligning error_line with document blocks, but the text correction is independently needed by the import feature. Move text.split and the textual line-number assertion into the import commit, leaving error_line, errorLine and highlighter wiring in the later commit. This concerns review flow, not a defect in the final tree.