From f5b091dd53855f159942e683368181ad088d311c Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Fri, 26 May 2023 17:56:07 +0200 Subject: [PATCH] fix: sync to head block instead (#2854) --- crates/consensus/beacon/src/engine/mod.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/crates/consensus/beacon/src/engine/mod.rs b/crates/consensus/beacon/src/engine/mod.rs index 47d9cbb156..bd2d451253 100644 --- a/crates/consensus/beacon/src/engine/mod.rs +++ b/crates/consensus/beacon/src/engine/mod.rs @@ -822,7 +822,6 @@ where // closing the gap either via pipeline, or by fetching the blocks via block number // [head..FCU.number] - let hash = block.hash; if self .try_insert_new_payload(block) .map(|status| status.is_valid()) @@ -830,9 +829,9 @@ where { // payload is valid self.sync_state_updater.update_sync_state(SyncState::Idle); - } else { - // if the payload is invalid, we run the pipeline - self.sync.set_pipeline_sync_target(hash); + } else if let Some(ref state) = self.forkchoice_state { + // if the payload is invalid, we run the pipeline to the head block. + self.sync.set_pipeline_sync_target(state.head_block_hash); } } EngineSyncEvent::PipelineStarted(target) => {