From 9a91c4c955bd07a3ae1c20107605bdeb605036db Mon Sep 17 00:00:00 2001 From: MariusVanDerWijden Date: Mon, 16 Mar 2026 13:53:46 +0100 Subject: [PATCH] eth/catalyst: only setCanonical if the node is synced --- eth/catalyst/api.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/eth/catalyst/api.go b/eth/catalyst/api.go index a4a9594738..b36fe064c0 100644 --- a/eth/catalyst/api.go +++ b/eth/catalyst/api.go @@ -298,11 +298,13 @@ func (api *ConsensusAPI) forkchoiceUpdated(update engine.ForkchoiceStateV1, payl // If the head block is already in our canonical chain, the beacon client is // probably resyncing. Ignore the update. // TODO(MariusVanDerWijden): in epbs it can happen that we are reorging to a previous head - if latestValid, err := api.eth.BlockChain().SetCanonical(block); err != nil { - return engine.ForkChoiceResponse{PayloadStatus: engine.PayloadStatusV1{Status: engine.INVALID, LatestValidHash: &latestValid}}, err + if api.eth.Synced() { + if latestValid, err := api.eth.BlockChain().SetCanonical(block); err != nil { + return engine.ForkChoiceResponse{PayloadStatus: engine.PayloadStatusV1{Status: engine.INVALID, LatestValidHash: &latestValid}}, err + } } - //log.Info("Ignoring beacon update to old head", "number", block.NumberU64(), "hash", update.HeadBlockHash, "age", common.PrettyAge(time.Unix(int64(block.Time()), 0)), "have", api.eth.BlockChain().CurrentBlock().Number) - //return valid(nil), nil + log.Info("Ignoring beacon update to old head", "number", block.NumberU64(), "hash", update.HeadBlockHash, "age", common.PrettyAge(time.Unix(int64(block.Time()), 0)), "have", api.eth.BlockChain().CurrentBlock().Number) + return valid(nil), nil } api.eth.SetSynced()