This commit is contained in:
Jared Wasinger 2025-03-31 16:32:37 +02:00
parent b9fd23ae62
commit f20b5a4da0

View file

@ -173,10 +173,13 @@ func (r *resultStore) GetCompleted(limit int) []*fetchResult {
results := make([]*fetchResult, limit) results := make([]*fetchResult, limit)
copy(results, r.items[: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. // Delete the results from the cache and clear the tail.
copy(r.items, r.items[limit:]) copy(r.items, r.items[limit:])
for i := len(r.items) - limit; i < len(r.items); i++ { for i := len(r.items) - limit; i < len(r.items); i++ {
r.itemsGasUsed -= r.items[i].Header.GasUsed
r.items[i] = nil r.items[i] = nil
} }
// Advance the expected block number of the first cache entry // Advance the expected block number of the first cache entry