From 7ba29c41782915577efbc529e0f4b9215ba67ecf Mon Sep 17 00:00:00 2001 From: jeevan-sid Date: Thu, 25 Dec 2025 00:23:12 +0530 Subject: [PATCH] fix: stale finalized block rewind --- core/blockchain.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/blockchain.go b/core/blockchain.go index 858eceb630..5397606456 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -1105,11 +1105,11 @@ func (bc *BlockChain) setHeadBeyondRoot(head uint64, time uint64, root common.Ha bc.txLookupCache.Purge() // Clear safe block, finalized block if needed - if safe := bc.CurrentSafeBlock(); safe != nil && head < safe.Number.Uint64() { + if safe := bc.CurrentSafeBlock(); safe != nil && rootNumber < safe.Number.Uint64() { log.Warn("SetHead invalidated safe block") bc.SetSafe(nil) } - if finalized := bc.CurrentFinalBlock(); finalized != nil && head < finalized.Number.Uint64() { + if finalized := bc.CurrentFinalBlock(); finalized != nil && rootNumber < finalized.Number.Uint64() { log.Error("SetHead invalidated finalized block") bc.SetFinalized(nil) }