From a0eb773a85c405bb7aafc453d8749f5dcb8d122d Mon Sep 17 00:00:00 2001 From: Scott Fairclough Date: Wed, 23 Oct 2024 22:57:29 +0100 Subject: [PATCH] unwind one more block when detecting a re-sequence --- zk/stages/stage_batches_processor.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zk/stages/stage_batches_processor.go b/zk/stages/stage_batches_processor.go index 35da1b5658c..ab08d459c83 100644 --- a/zk/stages/stage_batches_processor.go +++ b/zk/stages/stage_batches_processor.go @@ -284,10 +284,10 @@ func (p *BatchesProcessor) processFullBlock(blockEntry *types.FullL2Block) (rest // unwind if we already have this block - could be a re-sequence event if blockEntry.L2BlockNumber < p.lastBlockHeight+1 { log.Warn(fmt.Sprintf("[%s] Skipping block %d, already processed, triggering unwind...", p.logPrefix, blockEntry.L2BlockNumber)) - if err = p.unwindFn(blockEntry.L2BlockNumber); err != nil { + if err = p.unwindFn(blockEntry.L2BlockNumber - 1); err != nil { return 0, false, false, err } - return blockEntry.L2BlockNumber, false, true, nil + return blockEntry.L2BlockNumber - 1, false, true, nil } // check for sequential block numbers