From 45296c0198ba0920ad4af5dae4a47b7f8865d5e6 Mon Sep 17 00:00:00 2001 From: agnusmor <100322135+agnusmor@users.noreply.github.com> Date: Fri, 9 Aug 2024 14:01:53 +0200 Subject: [PATCH] Cherry-pick #3735: Wait the state to be synced when starting aggregator (#3759) * Wait the state to be synced when starting (#3735) * remove continue --- aggregator/aggregator.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/aggregator/aggregator.go b/aggregator/aggregator.go index fac03c0df2..ea4c44e8e6 100644 --- a/aggregator/aggregator.go +++ b/aggregator/aggregator.go @@ -121,6 +121,11 @@ 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) + } + address := fmt.Sprintf("%s:%d", a.cfg.Host, a.cfg.Port) lis, err := net.Listen("tcp", address) if err != nil {