[1.2.3] Apply blocks mid-production when our branch is locked out by a strong QC#1888
Open
heifner wants to merge 1 commit intoAntelopeIO:release/1.2from
Open
Conversation
…ut by a strong QC Previously, while a node was inside its own producing slot, on_incoming_block would unconditionally early-return and defer apply_blocks until the slot ended. That avoids interrupting block production mid-block, but it also keeps the producer signing on a known-doomed branch when the rest of the network has already moved on. Add a new block_handle::locks_out_branch_of() helper that reports whether a given block carries a strong QC for a block not in another head's ancestry -- a condition that, under Savanna's strong-vote locking rule, means no future QC can ever form on that head's branch and the branch can never win fork-choice. Use it in on_incoming_block to bypass the in_producing_mode early-return only when the fork-database best head locks out the applied head's branch. Normal in-slot operation is unchanged; only the provably-doomed case falls through to apply_blocks immediately. The check runs on the application thread (where on_incoming_block executes via the read_write executor queue) so it can safely read both chain.fork_db_head() and chain.head(). The helper itself is also thread-safe: block_state_ptr is a shared_ptr and the underlying finality_core is immutable post-construction.
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.
Backport of #1887 to
release/1.2.See #1887 for full rationale and the consensus argument. This PR contains the same change adapted to the 1.2 branch:
block_handle::locks_out_branch_of()helper (identical to main).producer_plugin::on_incoming_blockgate change (identical logic; usescontroller::apply_blocks_result::completeto match the 1.2 return convention).locks_out_branch_of_testunit test (identical to main).Differences vs #1887:
tests/nodeos_late_block_test.pyare dropped — that test does not exist onrelease/1.2.