#34400 wallet: parallel fast rescan (approx 8x speed up with 8 threads)
https://github.com/bitcoin/bitcoin/pull/34400 · · +1451/-388 in 18 files, 15 commits · labels: Wallet, Needs rebase · draft
Goal
- Speed up wallet rescans using parallel block filter checks across multi-core systems
- Greatly reduce wait times during wallet recovery and descriptor imports
This pull request implements multi-threaded block filter checking during wallet fast-rescan via a new `-walletpar` configuration option. Instead of sequentially evaluating compact block filters, tasks are batched and scheduled across a thread pool, updating filters dynamically when transactions are detected and topping up the keypool.
Problem: Wallet rescanning over long chain intervals with BIP 157 block filters is CPU-bound on cryptographic hashing. Because checking was single-threaded, nodes with many cores experienced prolonged rescans that did not utilize available compute resources.
Category: Wallet (#7 of 84)
P2 · speedup
- P2 because wallet rescan is a frequent pain point during wallet recovery and descriptor imports
- Empirically validated 4x to 8x speedup delivers major performance gains on multi-core machines
P2 because wallet rescan is a frequent pain point during wallet recovery and descriptor imports, and this PR delivers a major, empirically validated 4x-8x speedup on multi-core systems. Both Eunovo and ismaelsadeeq demonstrated substantial reductions in execution time (e.g., from ~280s down to ~42s across 400,000 blocks).
Membership: Changes CWallet and ChainScanner rescan logic in src/wallet/scan.cpp.
Factors: security/stability 0, bug 0, performance 3, user value 2, leverage 0
Reviewability: Stale: Needs rebase
- Needs a rebase after prerequisite #34681 merged
The PR has merge conflicts and needs a rebase now that prerequisite #34681 has merged.
Author status: silent since 2026-07-22 while waiting for prerequisite #34681 to merge
Resolved concerns:
- Whether parallelization helps on non-SSD storage: l0rinc and Eunovo verified that fast rescan is CPU-bound on filter hashing, showing clear speedups on HDDs as well.
- ThreadPool resource contention: rkrux questioned sharing a global threadpool across wallets; Eunovo restructured the implementation to spin up a scan-specific pool.
- Prerequisite refactoring: furszy requested separating scanning refactors from parallelization, which led to the creation and merge of #34681.
Agreement: Strong
- Broad support with benchmarks confirming 4x to 8x speedups across multiple setups
- Verified 6x speedup on an AMD Ryzen setup (ismaelsadeeq)
- Verified 3x speedup on an HDD setup (l0rinc)
- Strong concept approval after scanning refactor concerns were addressed (rkrux)
Broad support and independent benchmark reproductions (ismaelsadeeq, rkrux, l0rinc, w0xlt).
Multiple reviewers provided Concept ACKs and confirmed 4x to 8x speedups across multiple hardware platforms and drive types without objection.
- ismaelsadeeq confirmed a 6x speedup on an AMD Ryzen 7 7700 setup.
- l0rinc confirmed a 3x speedup on an HDD setup.
- rkrux gave a Strong Concept ACK after prerequisite refactors were addressed.
Review verdicts (DrahtBot): 0
- Concept ACK: w0xlt, ismaelsadeeq, rkrux
Dependencies
Depends on: #34681
Files
File list not available for this run.
Card
PR #34400 introduces multi-threaded block filter checking for wallet fast-rescan, delivering an 8x speedup on 8 threads. It addresses CPU bottlenecks during filter evaluation when importing or recovering wallets on nodes with blockfilterindex enabled. The change has strong backing with independent benchmark validations from multiple contributors confirming massive performance gains on both SSDs and HDDs. The PR is currently in draft and needs a rebase following the merge of prerequisite #34681.