Skip to content

Commit

Permalink
fix checkStateInconsistency when starting sequencer (#3294) (#3315)
Browse files Browse the repository at this point in the history
  • Loading branch information
agnusmor authored Feb 20, 2024
1 parent 1bbb1e2 commit 070daf8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion sequencer/sequencer.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,12 @@ func (s *Sequencer) Start(ctx context.Context) {

// checkStateInconsistency checks if state inconsistency happened
func (s *Sequencer) checkStateInconsistency(ctx context.Context) {
var err error
s.numberOfStateInconsistencies, err = s.stateIntf.CountReorgs(ctx, nil)
if err != nil {
log.Error("failed to get initial number of reorgs, error: %v", err)
}
for {
time.Sleep(s.cfg.StateConsistencyCheckInterval.Duration)
stateInconsistenciesDetected, err := s.stateIntf.CountReorgs(ctx, nil)
if err != nil {
log.Error("failed to get number of reorgs, error: %v", err)
Expand All @@ -125,6 +129,8 @@ func (s *Sequencer) checkStateInconsistency(ctx context.Context) {
if stateInconsistenciesDetected != s.numberOfStateInconsistencies {
s.finalizer.Halt(ctx, fmt.Errorf("state inconsistency detected, halting finalizer"), false)
}

time.Sleep(s.cfg.StateConsistencyCheckInterval.Duration)
}
}

Expand Down

0 comments on commit 070daf8

Please sign in to comment.