Repository navigation
Conversation
When creating a new on-chain wallet with a bitcoind chain source, we insert the current chain tip as its first checkpoint, but only held it in memory until the wallet's first sync persisted it. If the node was restarted before that, the wallet reloaded at genesis and tried to rescan the whole chain, which never succeeds against a pruned bitcoind. We now persist the wallet right after applying the checkpoint, failing the build if that doesn't succeed. Backport of 5c78177 Reported-by: vnprclanker Co-Authored-By: HAL 9000
|
👋 Thanks for assigning @tankyleo as a reviewer! |
e982d01 to
5e0da0c
Compare
| None => { | ||
| let mut wallet = BdkWallet::create(descriptor, change_descriptor) | ||
| .network(config.network) | ||
| .create_wallet(&mut wallet_persister) |
There was a problem hiding this comment.
create_wallet(&mut wallet_persister) here already persists the wallet at genesis, before the checkpoint is applied. If we crash or the new persist fails in between, storage holds a genesis wallet, the next load_wallet returns it, and the None branch that adds the checkpoint never runs again, so the pruned-node rescan problem is back. #1250 avoids this by using create_wallet_no_persist() and persisting once after the checkpoint is applied. Could the backport do the same (take_staged + persist), or is there a 0.7-specific reason it can't ?
Backport of #1250.