Skip to content

Commit

Permalink
fix checkStateInconsistency when starting sequencer (#3294)
Browse files Browse the repository at this point in the history
  • Loading branch information
agnusmor committed Feb 20, 2024
1 parent f66c295 commit d69c45c
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 d69c45c

Please sign in to comment.