2026 04 abort on first startup tip fetch failure#884
Draft
tnull wants to merge 2 commits intolightningdevkit:mainfrom
Draft
2026 04 abort on first startup tip fetch failure#884tnull wants to merge 2 commits intolightningdevkit:mainfrom
tnull wants to merge 2 commits intolightningdevkit:mainfrom
Conversation
|
👋 Hi! This PR is now in draft status. |
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
c692081 to
608108a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #818.
Draft for now.