Skip to content

Commit

Permalink
Add extra check reorg after calling get information
Browse files Browse the repository at this point in the history
  • Loading branch information
ARR552 committed Apr 3, 2024
1 parent 04305d8 commit 2d65e0a
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions synchronizer/synchronizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,22 @@ func (s *ClientSynchronizer) syncBlocksSequential(lastEthBlockSynced *state.Bloc
if err != nil {
return lastEthBlockSynced, err
}

// Check reorg again to be sure that the chain has not changed between the previous checkReorg and the call GetRollupInfoByBlockRange
block, err := s.checkReorg(lastEthBlockSynced)
if err != nil {
log.Errorf("error checking reorgs. Retrying... Err: %v", err)
return lastEthBlockSynced, fmt.Errorf("error checking reorgs")
}
if block != nil {
err = s.resetState(block.BlockNumber)
if err != nil {
log.Errorf("error resetting the state to a previous block. Retrying... Err: %v", err)
return lastEthBlockSynced, fmt.Errorf("error resetting the state to a previous block")
}
return block, nil
}

start = time.Now()
err = s.ProcessBlockRange(blocks, order)
metrics.ProcessL1DataTime(time.Since(start))
Expand Down

0 comments on commit 2d65e0a

Please sign in to comment.