Repository navigation
Conversation
|
👋 Thanks for assigning @tankyleo as a reviewer! |
e982d01 to
5e0da0c
Compare
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 ?
There was a problem hiding this comment.
Sure, will adapt this once #1250 lands.
When creating a new on-chain wallet, we first persisted it at genesis and only then inserted the checkpoint acting as its birthday, which was held in memory until the wallet's first sync persisted it. A restart, crash or failed write in between left a persisted wallet that reloads at genesis and tries to rescan the whole chain, which never succeeds against a pruned bitcoind. We now apply the checkpoint before the wallet is first persisted, so that its initial state always includes the birthday. As BDK can't turn a wallet created in memory into a persisted one, we write that state ourselves and load the wallet back from the persister. Backport of 73865bd Reported-by: vnprclanker Co-Authored-By: HAL 9000
Nothing covered that a node restarted between its first build and its first wallet sync keeps the wallet birthday rather than rescanning from genesis. We add an integration test that builds a fresh node against bitcoind, drops it before it syncs, and checks that the wallet's chain state was written exactly once and that the rebuilt node doesn't pick up a payment confirmed before its birthday. It covers the RPC and REST chain sources. Backport of 227e9ad Co-Authored-By: HAL 9000
5e0da0c to
a1fd5fa
Compare
|
Updated to match latest state from #1250. |
Backport of #1250.