Skip to content

Report failed bitcoind block syncs as errors - #1267

Open
ajaysehwal wants to merge 1 commit into
lightningdevkit:mainfrom
ajaysehwal:fix-bitcoind-block-sync-failure
Open

ajaysehwal wants to merge 1 commit into
lightningdevkit:mainfrom
ajaysehwal:fix-bitcoind-block-sync-failure

Conversation

@ajaysehwal

Copy link
Copy Markdown
Contributor

SpvClient::poll_best_tip returns (ChainTip::Better(_), false) when it found a better chain tip but couldn't connect any block towards it, e.g. because fetching the blocks from bitcoind failed (pruned node, REST disabled, a response above the HTTP size limit). We only matched (Better, true) and ignored everything else, so in that case the poll still bumped the wallet sync timestamps and sync_wallets returned Ok while the node silently fell behind the chain. Nothing was logged.

This logs the failure and returns TxSyncFailed, as we already do when polling itself fails. The polling loop retries on its next tick as before. (Better, true) (full or partial progress), Common and Worse are unchanged.

Testing

cargo test --lib passes. poll_and_update_listeners_inner uses the concrete bitcoind client, so the mock block source in startup_tests.rs (which can fail block fetches) can't drive it without a refactor, which I left out to keep this minimal.

`SpvClient::poll_best_tip` returns `(ChainTip::Better(_), false)` when it
found a better chain tip but couldn't connect any block towards it, for
example because fetching the blocks failed. We ignored that case, so the
poll still bumped the wallet sync timestamps and `sync_wallets` reported
success while the node fell behind the chain.

Log the failure and return `TxSyncFailed` instead, as we already do when
polling itself fails.
@ldk-reviews-bot

ldk-reviews-bot commented Nov 28, 2026 •

Copy link
Copy Markdown

I've assigned @tnull 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.

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.

2 participants