From e3d375a8f3e9e79a9e8afbca6ab28844755ee70d Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Tue, 30 Jul 2024 14:01:21 +0200 Subject: [PATCH] fix: check if head block is already canonical (#9900) --- crates/engine/tree/src/tree/mod.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/engine/tree/src/tree/mod.rs b/crates/engine/tree/src/tree/mod.rs index f21c9185b4..614d2d1193 100644 --- a/crates/engine/tree/src/tree/mod.rs +++ b/crates/engine/tree/src/tree/mod.rs @@ -1632,7 +1632,14 @@ where return Ok(valid_outcome(state.head_block_hash)) } - // 3. we don't have the block to perform the update + // 3. check if the head is already part of the canonical chain + if let Ok(Some(canonical_header)) = self.find_canonical_header(state.head_block_hash) { + debug!(target: "engine", head = canonical_header.number, "fcu head block is already canonical"); + // the head block is already canonical + return Ok(valid_outcome(state.head_block_hash)) + } + + // 4. we don't have the block to perform the update let target = self.lowest_buffered_ancestor_or(state.head_block_hash); Ok(TreeOutcome::new(OnForkChoiceUpdated::valid(PayloadStatus::from_status(