Merge pull request #24529 from holiman/fix_inf

eth/protocols/snap: avoid estimating infinite percentage
This commit is contained in:
Péter Szilágyi 2022-03-11 10:40:55 +02:00 committed by GitHub
commit 1b58e42802
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2826,7 +2826,10 @@ func (s *Syncer) reportSyncProgress(force bool) {
new(big.Int).Mul(new(big.Int).SetUint64(uint64(synced)), hashSpace),
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)