From 8fc5236fd79cb96f64ddbb5615ef91a200acdf98 Mon Sep 17 00:00:00 2001 From: Gary Rong Date: Wed, 26 Mar 2025 20:58:30 +0800 Subject: [PATCH] eth/downloader: fix panic --- eth/downloader/downloader.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eth/downloader/downloader.go b/eth/downloader/downloader.go index 34c72be393..4d13ae304c 100644 --- a/eth/downloader/downloader.go +++ b/eth/downloader/downloader.go @@ -1140,11 +1140,11 @@ func (d *Downloader) reportSnapSyncProgress(force bool) { // Prevent reporting noise if the actual chain synchronization (headers // and bodies) hasn't started yet. Inserting the ancient header chain is // fast enough and would introduce significant bias if included in the count. - if d.chainCutoffNumber != 0 && block.Number.Uint64() < d.chainCutoffNumber { + if d.chainCutoffNumber != 0 && block.Number.Uint64() <= d.chainCutoffNumber { return } fetchedBlocks := block.Number.Uint64() - d.syncStartBlock - if d.chainCutoffNumber != 0 { + if d.chainCutoffNumber != 0 && d.chainCutoffNumber > d.syncStartBlock { fetchedBlocks = block.Number.Uint64() - d.chainCutoffNumber } // Retrieve the current chain head and calculate the ETA