From f20b5a4da09feb9e70a1570361cb5c655f6db497 Mon Sep 17 00:00:00 2001 From: Jared Wasinger Date: Mon, 31 Mar 2025 16:32:37 +0200 Subject: [PATCH] fix calc --- eth/downloader/resultstore.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/eth/downloader/resultstore.go b/eth/downloader/resultstore.go index d3eb628d5f..a707096797 100644 --- a/eth/downloader/resultstore.go +++ b/eth/downloader/resultstore.go @@ -173,10 +173,13 @@ func (r *resultStore) GetCompleted(limit int) []*fetchResult { results := make([]*fetchResult, limit) copy(results, r.items[:limit]) + for _, result := range results { + r.itemsGasUsed -= result.Header.GasUsed + } + // Delete the results from the cache and clear the tail. copy(r.items, r.items[limit:]) for i := len(r.items) - limit; i < len(r.items); i++ { - r.itemsGasUsed -= r.items[i].Header.GasUsed r.items[i] = nil } // Advance the expected block number of the first cache entry