eth/gasprice: fix percentile validation in eth_feeHistory (#28954)

pull/28958/head
Felix Lange 7 months ago committed by GitHub
parent 2dc33d46b8
commit ae3b7a0b65
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      eth/gasprice/feehistory.go

@ -227,8 +227,8 @@ func (oracle *Oracle) FeeHistory(ctx context.Context, blocks uint64, unresolvedL
if p < 0 || p > 100 { if p < 0 || p > 100 {
return common.Big0, nil, nil, nil, fmt.Errorf("%w: %f", errInvalidPercentile, p) return common.Big0, nil, nil, nil, fmt.Errorf("%w: %f", errInvalidPercentile, p)
} }
if i > 0 && p < rewardPercentiles[i-1] { if i > 0 && p <= rewardPercentiles[i-1] {
return common.Big0, nil, nil, nil, fmt.Errorf("%w: #%d:%f > #%d:%f", errInvalidPercentile, i-1, rewardPercentiles[i-1], i, p) return common.Big0, nil, nil, nil, fmt.Errorf("%w: #%d:%f >= #%d:%f", errInvalidPercentile, i-1, rewardPercentiles[i-1], i, p)
} }
} }
var ( var (

Loading…
Cancel
Save