diff --git a/cmd/bootstrapper/server.go b/cmd/bootstrapper/server.go index 5f9986ffb23..af4159b69c5 100644 --- a/cmd/bootstrapper/server.go +++ b/cmd/bootstrapper/server.go @@ -134,8 +134,40 @@ func (s *Server) Start(ctx context.Context, errCh chan error, params *NetworkPar // start generating fallback data s.eg.Go( func() error { - s.genDataLoop(ctx, errCh, last, params.updateActiveSetTime, s.GenFallbackActiveSet) - return nil + var ( + errs = 0 + maxErrs = 10 + timer *time.Timer + timeC <-chan time.Time + backoff = 10 * time.Second + ) + for epoch := last; ; epoch++ { + wait := time.Until(params.updateActiveSetTime(epoch)) + select { + case <-timeC: + if err := s.GenFallbackActiveSet(ctx, epoch); err != nil { + errs++ + timer.Reset(backoff) + continue + } + errs = 0 + if !timer.Stop() { + <-timer.C + } + timeC = nil + case <-time.After(wait): + if err := s.GenFallbackActiveSet(ctx, epoch); err != nil { + timer = time.NewTimer(backoff) + timeC = timer.C + if errs >= maxErrs { + errCh <- err + return err + } + } + case <-ctx.Done(): + return ctx.Err() + } + } }) s.eg.Go( func() error { diff --git a/config/presets/fastnet.go b/config/presets/fastnet.go index e616057ac07..225a2482d59 100644 --- a/config/presets/fastnet.go +++ b/config/presets/fastnet.go @@ -51,7 +51,9 @@ func fastnet() config.Config { conf.LayerDuration = 15 * time.Second conf.Sync.Interval = 5 * time.Second conf.Sync.GossipDuration = 10 * time.Second - conf.Sync.AtxSync.EpochInfoInterval = 20 * time.Second + conf.Sync.AtxSync.EpochInfoInterval = 1 * time.Second + conf.Sync.AtxSync.EpochInfoPeers = 10 + conf.Sync.AtxSync.RequestsLimit = 100 conf.Sync.MalSync.IDRequestInterval = 20 * time.Second conf.LayersPerEpoch = 4 conf.RegossipAtxInterval = 30 * time.Second diff --git a/systest/tests/checkpoint_test.go b/systest/tests/checkpoint_test.go index bd74e489c59..705682ac12c 100644 --- a/systest/tests/checkpoint_test.go +++ b/systest/tests/checkpoint_test.go @@ -169,7 +169,7 @@ func TestCheckpoint(t *testing.T) { } tctx.Log.Infow("waiting for all miners to be smeshing", "last epoch", checkpointEpoch+2) - ensureSmeshing(t, tctx, cl, checkpointEpoch+2) + ensureSmeshing(t, tctx, cl, checkpointEpoch+4) // increase the cluster size to the original test size tctx.Log.Info("cluster size changed to ", size) @@ -177,7 +177,7 @@ func TestCheckpoint(t *testing.T) { require.NoError(t, cl.AddSmeshers(tctx, addedLater)) tctx.Log.Infow("waiting for all miners to be smeshing", "last epoch", lastEpoch) - ensureSmeshing(t, tctx, cl, lastEpoch) + ensureSmeshing(t, tctx, cl, lastEpoch+6) } func ensureSmeshing(t *testing.T, tctx *testcontext.Context, cl *cluster.Cluster, stop uint32) {