Skip to content

Commit

Permalink
Wait the state to be synced when starting (0xPolygonHermez#3735)
Browse files Browse the repository at this point in the history
  • Loading branch information
agnusmor authored Jul 18, 2024
1 parent 19beaa9 commit 8a1e192
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions aggregator/aggregator.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ func (a *Aggregator) Start(ctx context.Context) error {
return fmt.Errorf("failed to initialize proofs cache %w", err)
}

for !a.isSynced(ctx, nil) {
log.Info("Waiting for synchronizer to sync...")
time.Sleep(a.cfg.RetryTime.Duration)
continue
}

address := fmt.Sprintf("%s:%d", a.cfg.Host, a.cfg.Port)
lis, err := net.Listen("tcp", address)
if err != nil {
Expand Down

0 comments on commit 8a1e192

Please sign in to comment.