From 9f03f8a269b3f23afd0d3aad4f77fd69c864a68b Mon Sep 17 00:00:00 2001 From: Dan Cline <6798349+Rjected@users.noreply.github.com> Date: Sat, 3 Aug 2024 11:16:37 -0400 Subject: [PATCH] fix: start payload builder on already canon head (#10041) --- crates/engine/tree/src/tree/mod.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/crates/engine/tree/src/tree/mod.rs b/crates/engine/tree/src/tree/mod.rs index 329715116f..25c8010c1f 100644 --- a/crates/engine/tree/src/tree/mod.rs +++ b/crates/engine/tree/src/tree/mod.rs @@ -230,6 +230,7 @@ impl TreeState { const fn canonical_block_hash(&self) -> B256 { self.canonical_head().hash } + /// Returns the block number of the canonical head. const fn canonical_block_number(&self) -> BlockNumber { self.canonical_head().number @@ -1784,6 +1785,20 @@ where // 1. ensure we have a new head block if self.state.tree_state.canonical_block_hash() == state.head_block_hash { trace!(target: "engine", "fcu head hash is already canonical"); + + // we still need to process payload attributes if the head is already canonical + if let Some(attr) = attrs { + let tip = self + .block_by_hash(self.state.tree_state.canonical_block_hash())? + .ok_or_else(|| { + // If we can't find the canonical block, then something is wrong and we need + // to return an error + ProviderError::HeaderNotFound(state.head_block_hash.into()) + })?; + let updated = self.process_payload_attributes(attr, &tip, state); + return Ok(TreeOutcome::new(updated)) + } + // the head block is already canonical return Ok(valid_outcome(state.head_block_hash)) }