Skip to content

Follow reorgs with bitcoind REST - #1022

Open
tnull wants to merge 1 commit into
lightningdevkit:mainfrom
tnull:2026-08-fix-bitcoind-rest-reorg
Open

Follow reorgs with bitcoind REST#1022
tnull wants to merge 1 commit into
lightningdevkit:mainfrom
tnull:2026-08-fix-bitcoind-rest-reorg

Conversation

@tnull

@tnull tnull commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Bitcoin Core's REST headers endpoint cannot serve headers from a stale branch. This prevented REST-backed nodes from finding a common ancestor and following the replacement chain after a reorg.

In #1006 we enabled bitcoind REST chain source support in CI, which exposed this failure.

Co-Authored-By: HAL 9000

Bitcoin Core's REST headers endpoint cannot serve headers from a stale
branch. This prevented REST-backed nodes from finding a common ancestor
and following the replacement chain after a reorg.

In lightningdevkit#1006 we enabled bitcoind REST chain source support in CI, which
exposed this failure.

Co-Authored-By: HAL 9000
@tnull
tnull requested a review from joostjager August 5, 2026 13:27
@ldk-reviews-bot

ldk-reviews-bot commented Aug 5, 2026

Copy link
Copy Markdown

👋 Thanks for assigning @joostjager 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 added this to the 0.8 milestone Aug 5, 2026
@TheBlueMatt

Copy link
Copy Markdown
Contributor

Hmm, that's somewhat surprising. Can you file an issue on https://github.com/bitcoin/bitcoin as well?

@tnull

tnull commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator Author

Hmm, that's somewhat surprising. Can you file an issue on https://github.com/bitcoin/bitcoin as well?

Will do.

@joostjager joostjager left a comment

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.

I wonder why we need a chain backend to find a common ancestor. What happens if someone switches to a different backend that doesn't know about the stale branch at all?

Comment thread src/chain/bitcoind.rs
BitcoindClient::Rest { rest_client, rpc_client, .. } => {
match rest_client.get_header(header_hash, height_hint).await {
Err(e) if e.kind() == BlockSourceErrorKind::Persistent => {
rpc_client.get_header(header_hash, height_hint).await

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.

It looks a bit weird that we have to fallback to the other interface. From history it seems we need rest because rpc is too slow for large sync ops?

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.

4 participants