eth/protocols/snap: fix negative eta in state progress logging (#32225)

This commit is contained in:
Zhou 2025-07-16 23:59:47 -03:00 committed by GitHub
parent f36d349918
commit becca46010
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3111,6 +3111,10 @@ func (s *Syncer) reportSyncProgress(force bool) {
if estBytes < 1.0 {
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)
estTime := elapsed / time.Duration(synced) * time.Duration(estBytes)