From c11ec55e9aca939f8b709bee97550d5bed46cdd9 Mon Sep 17 00:00:00 2001 From: refcell Date: Tue, 31 Oct 2023 12:27:26 -0400 Subject: [PATCH] fix cfg_if dispatch --- crates/consensus/beacon/src/engine/mod.rs | 54 ++++++++++++----------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/crates/consensus/beacon/src/engine/mod.rs b/crates/consensus/beacon/src/engine/mod.rs index 06b7cd58b05f..eb47fb3a05e3 100644 --- a/crates/consensus/beacon/src/engine/mod.rs +++ b/crates/consensus/beacon/src/engine/mod.rs @@ -667,33 +667,37 @@ where CanonicalOutcome::AlreadyCanonical { ref header } => { // On Optimism, the proposers are allowed to reorg their own chain at will. cfg_if::cfg_if! { - if #[cfg(feautre = "optimism")] { - let optimism = self.chain_spec().optimism; + if #[cfg(feature = "optimism")] { + if self.chain_spec().optimism { + debug!( + target: "consensus::engine", + fcu_head_num=?header.number, + current_head_num=?self.blockchain.canonical_tip().number, + "[Optimism] Allowing beacon reorg to old head" + ); + let _ = self.update_head(header.clone()); + self.listeners.notify( + BeaconConsensusEngineEvent::CanonicalChainCommitted( + header.clone(), + elapsed, + ), + ); + } else { + debug!( + target: "consensus::engine", + fcu_head_num=?header.number, + current_head_num=?self.blockchain.canonical_tip().number, + "Ignoring beacon update to old head" + ); + } } else { - let optimism = false; + debug!( + target: "consensus::engine", + fcu_head_num=?header.number, + current_head_num=?self.blockchain.canonical_tip().number, + "Ignoring beacon update to old head" + ); } - }; - if optimism { - debug!( - target: "consensus::engine", - fcu_head_num=?header.number, - current_head_num=?self.blockchain.canonical_tip().number, - "[Optimism] Allowing beacon reorg to old head" - ); - let _ = self.update_head(header.clone()); - self.listeners.notify( - BeaconConsensusEngineEvent::CanonicalChainCommitted( - header.clone(), - elapsed, - ), - ); - } else { - debug!( - target: "consensus::engine", - fcu_head_num=?header.number, - current_head_num=?self.blockchain.canonical_tip().number, - "Ignoring beacon update to old head" - ); } } CanonicalOutcome::Committed { ref head } => {