From c63804a0198c3ab5f6ec79f8a5abebda5447d8c4 Mon Sep 17 00:00:00 2001 From: Scott Fairclough Date: Wed, 23 Oct 2024 17:06:24 +0100 Subject: [PATCH] add back unwind on stream block lower than state --- zk/stages/stage_batches_processor.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/zk/stages/stage_batches_processor.go b/zk/stages/stage_batches_processor.go index 12af7a8b92d..35da1b5658c 100644 --- a/zk/stages/stage_batches_processor.go +++ b/zk/stages/stage_batches_processor.go @@ -281,10 +281,13 @@ func (p *BatchesProcessor) processFullBlock(blockEntry *types.FullL2Block) (rest return blockEntry.L2BlockNumber - 1, false, true, nil } - // skip if we already have this block + // 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", p.logPrefix, blockEntry.L2BlockNumber)) - return 0, false, false, nil + log.Warn(fmt.Sprintf("[%s] Skipping block %d, already processed, triggering unwind...", p.logPrefix, blockEntry.L2BlockNumber)) + if err = p.unwindFn(blockEntry.L2BlockNumber); err != nil { + return 0, false, false, err + } + return blockEntry.L2BlockNumber, false, true, nil } // check for sequential block numbers