Repository navigation
chainreg: wait for a node whose chain is below the activation block - #35
Merged
Merged
Conversation
A Bitcoin node rebuilding its chain (a -reindex or -reindex-chainstate, after an upgrade or a corruption recovery) keeps answering RPCs, but its active chain starts again from genesis. Asked for the activation block, it answers "Block height out of range" for hours. The periodic check took that answer for another chain and shut LND down, and at startup the wait on headers passed, since headers survive a chain state rebuild, so the first check refused the node the same way. A node syncing blocks behind its headers was refused at startup for the same reason. The startup wait now waits on blocks, the active chain the check reads. The periodic re-check, when the node lacks the activation block, asks the node how far its chain reaches: on the expected network and below the activation height, it is waited for as long as it stays there, with the waiting status written. Such a node can only serve blocks from before the activation, which both chains share, and it is checked again once it has the block. A node on another chain under the same network name is far past that height and is still reported at once, as is one past it that lacks the block.
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.
A Bitcoin node running a reindex keeps answering, but its active chain starts again from genesis, so for hours it answers "Block height out of range" when asked for the BLAKE2b activation block. The periodic chain check took that for another chain and shut LND down. At startup the wait on headers passed (headers survive a chain state rebuild), and the first check refused the node the same way. A node still syncing blocks behind its headers was refused at startup too.
Tests:
TestChainIdentityWaitsForBlocksandTestChainIdentityWatchWaitsForReindex; each fails with its half of the fix reverted.go test -race ./chainreg/...passes.