Skip to content

Commit

Permalink
add back unwind on stream block lower than state
Browse files Browse the repository at this point in the history
  • Loading branch information
hexoscott committed Oct 23, 2024
1 parent afb9eb6 commit c63804a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions zk/stages/stage_batches_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c63804a

Please sign in to comment.