mirror of
https://github.com/bitcoin/bitcoin
synced 2026-12-04 10:44:38 +00:00
test: speed up wallet unit test #36832
No reviewers
Labels
No labels
Android
Backport
Block storage
Brainstorming
Bug
Build system
CI failed
Consensus
Data corruption
Descriptors
Docs
DrahtBot Guix build requested
Feature
Fuzzing
GUI
Good First Review
IPC
Insufficient Review
Kernel
Linux/Unix
Mempool
Mining
Needs Backport (31.x)
Needs Backport (32.x)
Needs Benchmark
Needs Conceptual Review
Needs backport (30.x)
Needs rebase
Needs release note
Net
P2P
PSBT
Privacy
Private Broadcast
Questions and Help
RPC/REST/ZMQ
Refactoring
Resource usage
Review club
Scripts and tools
Settings
TX fees and policy
Tests
Tracking Issue
UTXO Db and Indexes
Up for grabs
Upstream
Utils/log/libs
Validation
Waiting for author
Wallet
Windows
good first issue
interfaces
macOS
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bitcoin/bitcoin!36832
Loading…
Reference in a new issue
No description provided.
Delete branch "speedup-wallet-unit-test"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Deduplicates wallet creation code and avoid pre-deriving a large keypool (default 1000) by setting wallet keypool_size = 1
Speedup:
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
External sites
Reviews
See the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste
<!--meta-tag:bot-skip-->into the comment that the bot should ignore.Conflicts
Reviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
No verified findings are available from this review.
Review coverage was incomplete.
Reviewed:
5b70468637e0· Review report · Previous reportspermalink
concept ack. this follows the functional tests:
nit: Since the only "users" of
wallet_namehere and below set dummy values, maybe the name parameter can be dropped fromNewWallet()?In https://github.com/bitcoin/bitcoin/pull/36832/changes/4ebe3d9597fa090438f95d33801428894ba69c9b (test: deduplicate wallet creation into NewWallet helper)
nanonit: If retouching this commit message should probably include
refactor:Observation/question: Why were tests using
CreateSyncedWallet()passing before this change?Also, if you avoid refactoring this line, I think the interface for
NewWalletis a little better taking the node argument since then you don't need to do the member access and pointer dereference at every call site, the same could apply toCreateSyncedWallet()whose callers are all also doing the same thing.ACK
aebed915d0Reproduced the performence improvement in coinselector_tests using hyperfine,
6.952 s ± 0.050 son master,2.797 s ± 0.021 son this branch.tACK
aebed915d0Tested on macOS 27.2 arm64 against master
c68583ab5a. All 18 wallet unit test suites (83 test cases) pass on both master and this PR.I reproduced the performance improvement in the four suites listed in the PR. Times below are in seconds, with five runs per suite on each revision:
coinselector_testswallet_testsspend_testsgroup_outputs_testsThanks for the reviews! Force-pushed
5b70468637addressing @davidgumberg comments. I also dropped thecchainparam ofCreateSyncedWalletto simplify it since all callers just passed the active chain.Nice. Done on
5b70468637nanonit taken haha
I'm not sure what you mean. It didn't change any behaviour because
CreateSyncedWallet()used to create a wallet just likeNewWallet()but now it reuses theNewWallet()to deduplicate code.At first I thought passing chain makes more sense for a wallet function but with your comment I realized it doesn't matter much and the benefits of passing node context directly are better. Done on
5b70468637.tACK
5b70468637Retested on macOS 27.2.1 arm64 against master
9183edd25e. The update addresses davidgumberg's nits; the keypool remains at 1.All 18 wallet unit test suites (83 test cases) pass on both revisions. The performance improvement remains: median time for
coinselector_testswas 10.16 s on master versus 3.88 s with this PR.Right, but
NewWallet()does more initialization stuff than just creating theCWalletobject, it just seemed like a smell to me that those tests should pass without the wallet having the descriptor flag, and without SPKM's set up, but it's probably fine, I have not looked close.reACK
github.com/bitcoin/bitcoin@5b70468637I understand what you mean now. It actually used to set those too but it is just in a lower block of code:
https://github.com/bitcoin/bitcoin/pull/36832/changes/e8f9a7c51a1e68af44123a9016edd2ead4356b3a#diff-de599d9a8f1ba87b441fa95ddb92737eef323ec968f0a9f3c38ec5a3b374045cL29-L33