Skip to content

Persist wallet birthday checkpoint at build - #1251

Open
tnull wants to merge 1 commit into
lightningdevkit:release/0.7from
tnull:2026-11-persist-wallet-birthday-0.7
Open

tnull wants to merge 1 commit into
lightningdevkit:release/0.7from
tnull:2026-11-persist-wallet-birthday-0.7

Conversation

@tnull

@tnull tnull commented Nov 19, 2026

Copy link
Copy Markdown
Collaborator

Backport of #1250.

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
@tnull
tnull requested a review from tankyleo November 19, 2026 10:38
@ldk-reviews-bot

ldk-reviews-bot commented Nov 19, 2026 •

Copy link
Copy Markdown

👋 Thanks for assigning @tankyleo as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

@tnull
tnull force-pushed the 2026-11-persist-wallet-birthday-0.7 branch from e982d01 to 5e0da0c Compare November 19, 2026 10:38
Comment thread src/builder.rs
None => {
let mut wallet = BdkWallet::create(descriptor, change_descriptor)
.network(config.network)
.create_wallet(&mut wallet_persister)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants