func (e *ETHScanner) updateGasPriceFromCache() {
    if len(e.gasCache) < e.cfg.GasCacheBlocks {
        return
    }

    // Compute the mean of cache
    sum := new(big.Int)
    for _, fee := range e.gasCache {
        sum.Add(sum, fee)
    }
    mean := new(big.Int).Quo(sum, big.NewInt(int64(len(e.gasCache))))

    e.gasPrice = mean
}
func (e *ETHScanner) updateGasPriceFromCache() {
    if len(e.gasCache) < e.cfg.GasCacheBlocks {
        return
    }

    // Use median for a more robust central value
    sortedFees := make([]*big.Int, len(e.gasCache))
    copy(sortedFees, e.gasCache)
    sort.Slice(sortedFees, func(i, j int) bool { return sortedFees[i].Cmp(sortedFees[j]) < 0 })
    median := sortedFees[len(sortedFees)/2]

    e.gasPrice = median
}
mean := new(big.Int).Quo(sum, big.NewInt(int64(len(e.gasCache))))

e.gasPrice = mean
