If you start up with a collection of N out of sync wallets bitcoin will perform N interdependent rescans; this can be rather slow e.g. if they’re all at height 200k.
This should be fixed, or we should offer suicide counseling at a minimum.
If you start up with a collection of N out of sync wallets bitcoin will perform N interdependent rescans; this can be rather slow e.g. if they’re all at height 200k.
This should be fixed, or we should offer suicide counseling at a minimum.
@ariard has an experimental implementation of this which not only rescans wallets in parallel, but indexes as well
https://gist.github.com/ariard/89f9bcc3a7ab9576fc6d15d251032cfa https://github.com/bitcoin/bitcoin/compare/master...ariard:2019-07-rework-rescan https://github.com/bitcoin/bitcoin/compare/master...ariard:2019-08-rescan-index-refactor
@pstratem Just catching on some of your wallet rescan comments in IRC. Want to make sure you’re aware we’d like to remove ScanForWalletTransactions and replace it with parallel scanning code here:
https://github.com/ariard/bitcoin/blob/2019-08-rescan-index-refactor/src/node/rescan.h https://github.com/ariard/bitcoin/blob/2019-08-rescan-index-refactor/src/node/rescan.cpp
Some more links in #11756 (comment)
@ryanofsky You may be interested by https://github.com/ariard/bitcoin/tree/2020-02-wallet-standalone, which was a starting clean-up of linked above branches.
I was aiming to go further and split the server (a.k.a indexes) in its own process, like bitcoin-server
but was waiting for Core dev meetup before going further as it could have been subject to discussion in the approach. Generally I think we can dissociate headers servicing from addresses syncing, like the wallet would register a list of address and that would be the job of the server to notify the wallet back. Instead of sending whole blocks to wallet.
That would be a trade-off between more storage for maintaining addresses index compare to performance but maybe worthy of it.
With regards to threading model, you may have 1) one thread syncing in-parallel multiple wallets, based on lower registration or 2) a thread pool, each assigns to a wallet for sync. An issue with 1) is if Wallet A is at block 100 and Wallet B and C are sync to block 10000, they will have to starve until A has catched-up with them instead of making progress on their own.
…
With regards to threading model, you may have 1) one thread syncing in-parallel multiple wallets, based on lower registration or 2) a thread pool, each assigns to a wallet for sync. An issue with 1) is if Wallet A is at block 100 and Wallet B and C are sync to block 10000, they will have to starve until A has catched-up with them instead of making progress on their own.
And an issue if new addresses are created. Could be worked around, yet. I like your solution, because it can be made in short term. Threads would come later (and really help).
Thanks all for your efforts. The topic is getting critical to us. Currently, any wallet rescan freezes the use of bitcoind for all other wallets. It can take 30 minutes to re-sync a wallet that has not been loaded for 6 months.