Repository navigation
Conversation
`Emitter`'s poll loop silently discarded the RPC "block not found" error when it couldn't locate our chain's genesis on the node, then fabricated a reset to the node's own genesis and continued emitting. A caller pointed at a node on a different network (e.g. mainnet checkpoints against a regtest node) got no error back from `next_block()`, even though the emitted checkpoints no longer connected to the chain it was given. Propagate the original error instead of discarding it, so a genesis mismatch is reported to the caller rather than silently papered over. Fixes bitcoindevkit#2290
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.
Description
Fixes #2290.
Emittersilently discarded the RPC "block not found" error when it couldn't find our genesis on the node, then reset to the node's own genesis and kept emitting — so a network mismatch (e.g. mainnet checkpoints vs. a regtest node) produced no error, just a chain that silently stopped connecting to what the caller gave it.This PR propagates that error instead of swallowing it. No API changes.
Scope: covers the reported case and the common path (
last_cpfromLocalChain, which always has genesis). Doesn't cover a hand-built sparseCheckPointwith no genesis entry — fixing that needs a breakingEmitterErrortype, which PR #2244 is already pursuing as part of a larger rewrite; kept this one small and non-breaking on purpose.Verified: added
test_next_block_errors_on_genesis_mismatch(fails pre-fix, passes post-fix against a real regtest node viaTestEnv), plus manually confirmed the exact RPC response (error code: -5, "Block not found") against a hand-run regtestbitcoind.Changelog notice
Checklists
All Submissions:
Bugfixes: