From 50c92b6fc46321189eba87ed65222bcc482df422 Mon Sep 17 00:00:00 2001 From: Adrian Dobrita Date: Mon, 9 Mar 2026 12:34:19 +0200 Subject: [PATCH] fix: synchronize last executed block header with current block header for legacy headers --- process/sync/baseSync.go | 10 ++++++++++ .../sync/storageBootstrap/baseStorageBootstrapper.go | 2 ++ 2 files changed, 12 insertions(+) diff --git a/process/sync/baseSync.go b/process/sync/baseSync.go index 83aebe9696e..343418602e9 100644 --- a/process/sync/baseSync.go +++ b/process/sync/baseSync.go @@ -2025,6 +2025,11 @@ func (boot *baseBootstrap) restoreState( boot.chainHandler.SetCurrentBlockHeaderHash(currHeaderHash) + // for legacy (non-V3) headers, keep last executed block header in sync with current block header + if check.IfNil(currHeader) || !currHeader.IsHeaderV3() { + boot.chainHandler.SetLastExecutedBlockHeaderAndRootHash(currHeader, currHeaderHash, currRootHash) + } + err = boot.scheduledTxsExecutionHandler.RollBackToBlock(currHeaderHash) if err != nil { scheduledInfo := &process.ScheduledInfo{ @@ -2055,6 +2060,11 @@ func (boot *baseBootstrap) setCurrentBlockInfo( boot.chainHandler.SetCurrentBlockHeaderHash(headerHash) + // for legacy (non-V3) headers, keep last executed block header in sync with current block header + if check.IfNil(header) || !header.IsHeaderV3() { + boot.chainHandler.SetLastExecutedBlockHeaderAndRootHash(header, headerHash, rootHash) + } + return nil } diff --git a/process/sync/storageBootstrap/baseStorageBootstrapper.go b/process/sync/storageBootstrap/baseStorageBootstrapper.go index 6651fedde0e..41149101a46 100644 --- a/process/sync/storageBootstrap/baseStorageBootstrapper.go +++ b/process/sync/storageBootstrap/baseStorageBootstrapper.go @@ -671,6 +671,8 @@ func (st *storageBootstrapper) restoreBlockChainToGenesis() { } st.blkc.SetCurrentBlockHeaderHash(nil) + // keep last executed block header in sync when reverting to genesis + st.blkc.SetLastExecutedBlockHeaderAndRootHash(nil, nil, nil) } func checkBaseStorageBootstrapperArguments(args ArgsBaseStorageBootstrapper) error {