Update sync.go

This commit is contained in:
rjl493456442 2025-07-17 10:57:07 +08:00 committed by GitHub
parent 4217f3e043
commit 2f1dfac198
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3108,9 +3108,13 @@ func (s *Syncer) reportSyncProgress(force bool) {
accountFills, accountFills,
).Uint64()) ).Uint64())
// Don't report anything until we have a meaningful progress // Don't report anything until we have a meaningful progress
if estBytes < 1.0 || float64(synced) > estBytes { if estBytes < 1.0 {
return return
} }
// Cap the estimated state size using the synced size to avoid negative values
if estBytes < float64(synced) {
estBytes = float64(synced)
}
elapsed := time.Since(s.startTime) elapsed := time.Since(s.startTime)
estTime := elapsed / time.Duration(synced) * time.Duration(estBytes) estTime := elapsed / time.Duration(synced) * time.Duration(estBytes)