From b0d4d7330f054bd9bea934fd85b50f664f8f77ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ha=20=C4=90ANG?= Date: Thu, 10 Mar 2022 22:41:32 +0700 Subject: [PATCH] eth/protocols/snap: avoid estimating infinite percentage --- eth/protocols/snap/sync.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/eth/protocols/snap/sync.go b/eth/protocols/snap/sync.go index 646df03887f1..6b2637a50a76 100644 --- a/eth/protocols/snap/sync.go +++ b/eth/protocols/snap/sync.go @@ -2798,6 +2798,11 @@ func (s *Syncer) reportSyncProgress(force bool) { accountFills, ).Uint64()) + // Don't report anything until we have a meaningful progress + if estBytes < 1.0 { + return + } + elapsed := time.Since(s.startTime) estTime := elapsed / time.Duration(synced) * time.Duration(estBytes)