Follow reorgs with bitcoind REST - #1022
Conversation
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
|
👋 Thanks for assigning @joostjager as a reviewer! |
|
Hmm, that's somewhat surprising. Can you file an issue on https://github.com/bitcoin/bitcoin as well? |
Will do. |
joostjager
left a comment
There was a problem hiding this comment.
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?
| 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 |
There was a problem hiding this comment.
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?
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