3 minor findings · 5 suggestions
Earlier concerns neither republished nor resolved: 1 major finding · 3 suggestions. See the Run archive for their assessments.
Findings
[minor] · Skipped batches can suppress GUI progress and cancellation
Even-start, skip-only parallel rescans can suppress periodic ShowProgress notifications, leaving the GUI percentage unchanged and preventing its Cancel action from requesting an abort.
Location: src/wallet/scan.cpp:572 (head).
Details and suggested fix
Wait() collects one two-block task, and Scan() reports only the last skipped height. Without top-ups, the even-sized windows preserve pair alignment: an even start produces odd reported heights, bypassing UpdateProgress()'s block_height % 100 == 0 gate. Base reported every block. WalletView::showProgress() checks wasCanceled() only on intermediate notifications, so a range containing only full skipped pairs receives neither percentage updates nor GUI cancellation handling before completion. Matches, top-ups, or a final singleton can interrupt this pattern; numeric scanning progress and shutdown checks still work. Emit ShowProgress when a 100-block boundary is crossed, rather than requiring the reported endpoint to equal that boundary, and add an even-start skip-only regression test.
[minor] · Failed delta lookups leave stale FILTER_NO_MATCH verdicts
A failed post-top-up lookup can retain stale FILTER_NO_MATCH and omit a payment while reporting success; no current trigger for failure after an earlier successful lookup was identified.
Location: src/wallet/scan.cpp:312 (head).
Details and suggested fix
After a top-up, UpdateFilter() rechecks queued misses against the new scripts, but merges only FILTER_MATCH. A failed lookup becomes FILTER_NO_FILTER and leaves the original miss intact, so NextBlocksParallel() records the block as scanned without inspecting it. That original verdict cannot exclude payments to the newly derived scripts. LookupFilter() rereads disk on each call and can fail on opening, checksum verification, or deserialization; base and the serial path inspect the block in that case. During loading, AttachChain() persists successful completion, so an ordinary restart need not recover an omitted transaction, although an explicit rescan can. Preserve every recheck result other than FILTER_NO_MATCH, for example if (res != FILTER_NO_MATCH) result->second = res;, and test an initially successful lookup followed by a failed delta lookup.
[minor] · Read-ahead can continue through stale successors after a reorg
A multi-block reorg inside read-ahead can produce additional stale scan results or a spurious rescan failure; replacement blocks still arrive through notifications, and production occurrence is unconfirmed.
Location: src/wallet/scan.cpp:437 (head).
Details and suggested fix
ReadNextBlock() captures successors while filling the window. If a reorg disconnects at least two queued blocks before delivery, RecordSkipped() can record an inactive FILTER_NO_MATCH block and continue to its already-queued successors. With the same reorg completed before its per-block lookup, base recorded the first skipped stale block and stopped because FillBlock() returned no successor. Head can instead advance farther along the stale branch, or encounter a later match and return FAILURE; AttachChain() then fails the wallet load. Successful loading can temporarily install the stale scanned position until queued notifications update it. No missed transaction was identified because replacement blocks are processed by notifications. Recheck activity before recording a delivered miss and stop at the last processed block if it is inactive. Update the successor comment and test a reorg after read-ahead has queued successors.
Optional improvements
[suggestion] · Returned batches defer rescan cancellation and shutdown
Scan() checks abort and shutdown only between returned batches, so a request can leave multiple block reads and transaction-synchronization passes running before it takes effect.
Location: src/wallet/scan.cpp:573 (head).
Details and suggested fix
Base checked both conditions before every block. The new inner loop stops only on NOT_ACTIVE or reaching the wallet tip. Wait() normally exposes two blocks, but after a top-up, UpdateFilter() drains outstanding tasks and can expose a consecutive run of FILTER_MATCH or FILTER_NO_FILTER verdicts spanning the read-ahead queue, up to 128 blocks at the maximum setting. Check m_abort || chain.shutdownRequested() before each ScanBlock() and break when requested. The existing post-loop handling already returns USER_ABORT; this restores per-block responsiveness without changing normal completion.
[suggestion] · Private rescan pools multiply the -walletpar budget
Concurrent RPC rescans of different wallets each receive the full -walletpar allocation, so the default can oversubscribe available cores rather than enforce a node-wide wallet-thread budget.
Location: src/wallet/scan.cpp:533 (head).
Details and suggested fix
Each eligible non-IBD filtered Scan() creates a private pool with m_wallet_par - 1 workers plus the scanning thread. Reservation and rescanblockchain's relock mutex serialize only the selected wallet, while every wallet independently receives the auto-detected count, capped at 16. Make the intended budget scope explicit. If it is per-rescan, document that scope in the help and account for concurrent wallets when choosing the auto default. If it is node-wide, use a bounded shared wallet pool while retaining per-scan task draining before referenced script sets are destroyed. Startup loading itself is sequential; concurrent RPC rescans provide the applicable multi-wallet case.
[suggestion] · -walletpar help omits its rescan scope and prerequisites
The help describes general wallet threads, but -walletpar only parallelizes rescan filter checks outside IBD; its auto default and serial opt-out also lack a release note.
Location: src/wallet/init.cpp:79 (head).
Details and suggested fix
m_wallet_par is used only inside Scan()'s block-filter-index branch and only when the node is outside initial block download. Reword the help and the wallet.h field comment to identify block-filter checks during wallet rescans, the -blockfilterindex prerequisite, and the IBD exclusion. Add a release note explaining that the default 0 auto-detects a count of up to 16 total threads for eligible rescans and that -walletpar=1 retains serial behavior. This lets operators understand when the option matters and how to disable the new parallel default.
[suggestion] · Optional filter-worker startup failure aborts the rescan
Thread-resource exhaustion can fail a serial-capable filtered rescan or startup wallet load; no triggering environment was identified, and this failure was not reproduced.
Location: src/wallet/scan.cpp:258 (head).
Details and suggested fix
For eligible non-IBD scans, ParallelFilterChecker starts up to 15 additional workers. If std::thread construction throws std::system_error, the exception escapes Scan(): RPC rescans return an error, wallet loading fails, and startup loading reports an initialization error. Already-started workers are joined by ThreadPool destruction during unwinding. Consider catching thread-creation failure around checker construction, logging a warning, and leaving ctx.checker unset so NextBlocksSerial() can continue without additional threads. Other Core pools also lack such a fallback; the concrete benefit here is preserving an operation whose parallelism is only an optimization.
[suggestion] · Serial filter-update changes are mixed into the concurrency commit
ae68fff4 combines serial top-up equivalence changes with the parallel checker, making two independently verifiable steps harder to review.
Location: src/wallet/scan.cpp:118 at ae68fff4f82e (commit) (commit).
Details and suggested fix
At b31976befbf633e7092f27a6ee02acaa99e127e4, the block-iteration preparation still uses UpdateIfNeeded() and AddScriptPubKeys(). The parallel-checker commit, ae68fff4f82e53cd1da2cb9a56949cd1945a0462, also rewrites script insertion and range-end updates and switches NextBlocksSerial() to Update(). Extract that serial-only rewrite and caller switch into a refactor commit directly after b31976befbf633e7092f27a6ee02acaa99e127e4, so existing serial fast-rescan tests can validate equivalence before the concurrency machinery arrives. Keep NeedsUpdate(), GetElementSet(), and the added out-parameter in ae68fff4f82e53cd1da2cb9a56949cd1945a0462 beside their parallel consumer. This preserves dependencies and the final tree; it is a review-flow suggestion, not a head defect.
Earlier concerns
Earlier reports raised these, with the titles and severities shown there. This review neither republished nor resolved them.
- [major]: Recheck descriptor ranges before consuming parallel verdicts
- [suggestion]: Automatic rescan concurrency relies on a latched IBD guard (earlier report)
- [suggestion]: The “No behaviour change” refactor includes a resume-after-tip fix (earlier report)
- [suggestion]:
-walletparhelp advertises 15 threads but accepts 16 (earlier report)