Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: make chain canonical if new payload is the missing block for current sync target #3459

Merged
merged 2 commits into from
Jun 30, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions crates/consensus/beacon/src/engine/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,7 @@ where
Err(status) => return Ok(status),
};
let block_hash = block.hash();
let block_num_hash = block.num_hash();

// now check the block itself
if let Some(status) = self.check_invalid_ancestor_with_head(block.parent_hash, block.hash) {
Expand All @@ -841,6 +842,11 @@ where
let status = match res {
Ok(status) => {
if status.is_valid() {
if let Some(target) = self.forkchoice_state_tracker.sync_target_state() {
if block_hash == target.head_block_hash {
self.try_make_sync_target_canonical(block_num_hash);
}
}
// block was successfully inserted, so we can cancel the full block request, if
// any exists
self.sync.cancel_full_block_request(block_hash);
Expand Down