fix(bitcoind_rpc): emit invalidated heights when start_height is above agreement point#2167
Open
evanlinjin wants to merge 1 commit intobitcoindevkit:masterfrom
Open
fix(bitcoind_rpc): emit invalidated heights when start_height is above agreement point#2167evanlinjin wants to merge 1 commit intobitcoindevkit:masterfrom
evanlinjin wants to merge 1 commit intobitcoindevkit:masterfrom
Conversation
…e agreement point When a reorg drops the agreement point below `start_height`, the emitter would skip directly to `start_height`, producing a checkpoint that could not connect with the caller's local chain (`CannotConnectError`). Fix: override `start_height` to the agreement height when a reorg is detected (agreement point below both `start_height` and `last_cp`), so the emitter revisits the invalidated block heights.
9035e00 to
f47addd
Compare
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
When a reorg drops the agreement point below
start_height, the emitter would skip directly tostart_height, producing a checkpoint that could not connect with the caller's local chain (CannotConnectError).This affects callers that create a new
Emitteron each sync withstart_height = tip_height— a common pattern.Fix: Override
start_heightto the agreement height when a reorg is detected (agreement point below bothstart_heightandlast_cp), so the emitter revisits the invalidated block heights.Context: https://discord.com/channels/753336465005608961/753367451319926827/1489544612094808235
cc @stevenroose
Notes to the reviewers
The key change is in
poll()incrates/bitcoind_rpc/src/lib.rs: whenAgreementFoundis handled and the agreement point is below bothstart_heightandlast_cp.height(), we lowerstart_heightto the agreement height. This ensures the emitter emits the invalidated blocks instead of skipping over them.Changelog notice
Checklists
All Submissions:
Bugfixes: