Skip to content

2026 04 abort on first startup tip fetch failure#884

Draft
tnull wants to merge 2 commits intolightningdevkit:mainfrom
tnull:2026-04-abort-on-first-startup-tip-fetch-failure
Draft

2026 04 abort on first startup tip fetch failure#884
tnull wants to merge 2 commits intolightningdevkit:mainfrom
tnull:2026-04-abort-on-first-startup-tip-fetch-failure

Conversation

@tnull
Copy link
Copy Markdown
Collaborator

@tnull tnull commented Apr 21, 2026

Fixes #818.

Draft for now.

@tnull tnull added this to the 0.8 milestone Apr 21, 2026
@ldk-reviews-bot
Copy link
Copy Markdown

ldk-reviews-bot commented Apr 21, 2026

👋 Hi! This PR is now in draft status.
I'll wait to assign reviewers until you mark it as ready for review.
Just convert it out of draft status when you're ready for review!

@tnull tnull marked this pull request as draft April 21, 2026 13:06
tnull added 2 commits April 21, 2026 15:07
When a fresh node's bitcoind RPC/REST chain source fails to return the
current chain tip, we previously silently fell back to the genesis
block as the wallet birthday. The next successful startup would then
force a full-history rescan of the whole chain. Instead, return a new
BuildError::ChainTipFetchFailed on the first build so the
misconfiguration surfaces immediately and no stale fresh state is
persisted.

Restarts with a previously-persisted wallet are unaffected: a
transient chain source outage on an existing node still allows startup
to proceed. Esplora/Electrum backends currently never expose a tip at
build time so the guard only fires for bitcoind sources; the latent
wallet-birthday-at-genesis issue on those backends is left for a
follow-up.

Co-Authored-By: HAL 9000
Rather than a binary "rescan from genesis" toggle, the new
`RecoveryMode { rescan_from_height: Option<u32> }` struct lets users
specify an explicit block height to rescan from on bitcoind-backed
nodes. This supports importing wallets on pruned nodes where the full
history is unavailable but the wallet's birthday height is known
(lightningdevkit#818).

For Esplora/Electrum backends, `rescan_from_height` is ignored because
those clients do not expose a block-hash-by-height lookup. Instead,
any `Some(RecoveryMode { .. })` forces a one-shot BDK `full_scan` on
the next wallet sync, so funds sent to previously-unknown addresses
are re-discovered.

`None` retains the default "checkpoint at current tip, incremental
sync" behavior. The struct leaves room for future recovery options
(e.g. a timestamp) without another breaking change.

Co-Authored-By: HAL 9000
@tnull tnull force-pushed the 2026-04-abort-on-first-startup-tip-fetch-failure branch from c692081 to 608108a Compare April 21, 2026 13:07
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.

Wallet birthday height for seed recovery on pruned nodes

2 participants