From 22b0edc700f493b2069d15fea993d06957fb9068 Mon Sep 17 00:00:00 2001 From: agnusmor Date: Sat, 17 Feb 2024 22:21:23 +0100 Subject: [PATCH] fix checkStateInconsistency when starting sequencer --- sequencer/sequencer.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sequencer/sequencer.go b/sequencer/sequencer.go index 5a6ab8671c..95b9794dcd 100644 --- a/sequencer/sequencer.go +++ b/sequencer/sequencer.go @@ -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) @@ -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) } }