v1.27.0-a #10

Closed
jonathanface wants to merge 473 commits from v1.27.0-a into master
Showing only changes of commit 7516aff220 - Show all commits

View File

@ -41,6 +41,8 @@ import (
var ErrUnsupported = errors.New("unsupported method") var ErrUnsupported = errors.New("unsupported method")
const maxEthFeeHistoryRewardPercentiles = 100
type EthModuleAPI interface { type EthModuleAPI interface {
EthBlockNumber(ctx context.Context) (ethtypes.EthUint64, error) EthBlockNumber(ctx context.Context) (ethtypes.EthUint64, error)
EthAccounts(ctx context.Context) ([]ethtypes.EthAddress, error) EthAccounts(ctx context.Context) ([]ethtypes.EthAddress, error)
@ -689,6 +691,9 @@ func (a *EthModule) EthFeeHistory(ctx context.Context, p jsonrpc.RawParams) (eth
} }
rewardPercentiles := make([]float64, 0) rewardPercentiles := make([]float64, 0)
if params.RewardPercentiles != nil { if params.RewardPercentiles != nil {
if len(*params.RewardPercentiles) > maxEthFeeHistoryRewardPercentiles {
return ethtypes.EthFeeHistory{}, errors.New("length of the reward percentile array cannot be greater than 100")
}
rewardPercentiles = append(rewardPercentiles, *params.RewardPercentiles...) rewardPercentiles = append(rewardPercentiles, *params.RewardPercentiles...)
} }
for i, rp := range rewardPercentiles { for i, rp := range rewardPercentiles {