Skip to content

Commit 4c1b646

Browse files
authored
Merge pull request #7787 from multiversx/fix-last-executed-on-reverts
fix: synchronize last executed block header with current block header…
2 parents 0323f05 + 50c92b6 commit 4c1b646

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

process/sync/baseSync.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2025,6 +2025,11 @@ func (boot *baseBootstrap) restoreState(
20252025

20262026
boot.chainHandler.SetCurrentBlockHeaderHash(currHeaderHash)
20272027

2028+
// for legacy (non-V3) headers, keep last executed block header in sync with current block header
2029+
if check.IfNil(currHeader) || !currHeader.IsHeaderV3() {
2030+
boot.chainHandler.SetLastExecutedBlockHeaderAndRootHash(currHeader, currHeaderHash, currRootHash)
2031+
}
2032+
20282033
err = boot.scheduledTxsExecutionHandler.RollBackToBlock(currHeaderHash)
20292034
if err != nil {
20302035
scheduledInfo := &process.ScheduledInfo{
@@ -2055,6 +2060,11 @@ func (boot *baseBootstrap) setCurrentBlockInfo(
20552060

20562061
boot.chainHandler.SetCurrentBlockHeaderHash(headerHash)
20572062

2063+
// for legacy (non-V3) headers, keep last executed block header in sync with current block header
2064+
if check.IfNil(header) || !header.IsHeaderV3() {
2065+
boot.chainHandler.SetLastExecutedBlockHeaderAndRootHash(header, headerHash, rootHash)
2066+
}
2067+
20582068
return nil
20592069
}
20602070

process/sync/storageBootstrap/baseStorageBootstrapper.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,8 @@ func (st *storageBootstrapper) restoreBlockChainToGenesis() {
671671
}
672672

673673
st.blkc.SetCurrentBlockHeaderHash(nil)
674+
// keep last executed block header in sync when reverting to genesis
675+
st.blkc.SetLastExecutedBlockHeaderAndRootHash(nil, nil, nil)
674676
}
675677

676678
func checkBaseStorageBootstrapperArguments(args ArgsBaseStorageBootstrapper) error {

0 commit comments

Comments
 (0)