From 9e388ed3535710d7126188120c3665c3a2864149 Mon Sep 17 00:00:00 2001 From: Calin Martinconi Date: Mon, 11 Nov 2024 17:43:16 +0200 Subject: [PATCH] fix: add warmup allowing pullsync to commence (#4898) --- pkg/node/node.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/node/node.go b/pkg/node/node.go index bd68ada5f26..8c2d98b334a 100644 --- a/pkg/node/node.go +++ b/pkg/node/node.go @@ -1062,12 +1062,14 @@ func NewBee( redistributionContractAddress = common.HexToAddress(o.RedistributionContractAddress) } + redistributionContract := redistribution.New(swarmAddress, overlayEthAddress, logger, transactionService, redistributionContractAddress, abiutil.MustParseABI(chainCfg.RedistributionABI), o.TrxDebugMode) + + startWarmupPeriod := time.Now() isFullySynced := func() bool { reserveTreshold := reserveCapacity * 5 / 10 - return localStore.ReserveSize() >= reserveTreshold && pullerService.SyncRate() == 0 + return localStore.ReserveSize() >= reserveTreshold && pullerService.SyncRate() == 0 && time.Now().After(startWarmupPeriod.Add(warmupTime)) } - redistributionContract := redistribution.New(swarmAddress, overlayEthAddress, logger, transactionService, redistributionContractAddress, abiutil.MustParseABI(chainCfg.RedistributionABI), o.TrxDebugMode) agent, err = storageincentives.New( swarmAddress, overlayEthAddress,