From 2f1dfac1985d43096bcf3cea7505a9abf28707fb Mon Sep 17 00:00:00 2001 From: rjl493456442 Date: Thu, 17 Jul 2025 10:57:07 +0800 Subject: [PATCH] Update sync.go --- eth/protocols/snap/sync.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/eth/protocols/snap/sync.go b/eth/protocols/snap/sync.go index ec3a0e94e8..84ceb9105e 100644 --- a/eth/protocols/snap/sync.go +++ b/eth/protocols/snap/sync.go @@ -3108,9 +3108,13 @@ func (s *Syncer) reportSyncProgress(force bool) { accountFills, ).Uint64()) // Don't report anything until we have a meaningful progress - if estBytes < 1.0 || float64(synced) > estBytes { + 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)