forked from bitcoin/bitcoin
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(wallet): try batching multiple wallet db operations when possibl…
…e, avoid wasting cpu cycles in AddToWalletIfInvolvingMe (#5452) ## Issue being fixed or feature implemented It's super slow for wallets with 100.000s of keys and txes to reindex and to rescan. Batching multiple operations fixes it. In my case (300K+ keys and 500k+ txes testnet wallet) `rescanblockchain` time is down from 6+ hours to ~10 minutes. Re-calculating `block_time` over and over again inside of the loop in `AddToWalletIfInvolvingMe` is wasteful, move it out. ## What was done? batch what's possible, optimize `AddToWalletIfInvolvingMe` ## How Has This Been Tested? running on top of #5451 , wiping and rescanning w/ and w/out this patch. ## Breaking Changes should be none ## Checklist: - [x] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_
- Loading branch information
Showing
2 changed files
with
20 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters