rpc: fix gas price (#596)

This commit is contained in:
Federico Kunze Küllmer 2021-09-28 10:42:18 +02:00 committed by GitHub
parent fdb92ee788
commit bc82f3f8eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -720,19 +720,22 @@ func (e *EVMBackend) RPCGasCap() uint64 {
return e.cfg.JSONRPC.GasCap
}
// RPCMinGasPrice return the minimum gas price for a transaction.
// RPCMinGasPrice returns the minimum gas price for a transaction obtained from
// the node config. If set value is 0, it will default to 20.
func (e *EVMBackend) RPCMinGasPrice() int64 {
evmParams, err := e.queryClient.Params(context.Background(), &evmtypes.QueryParamsRequest{})
if err == nil {
minGasPrice := e.cfg.GetMinGasPrices()
for _, coin := range minGasPrice {
if coin.Denom == evmParams.Params.EvmDenom {
return coin.Amount.TruncateInt64()
}
}
if err != nil {
return ethermint.DefaultGasPrice
}
return ethermint.DefaultGasPrice
minGasPrice := e.cfg.GetMinGasPrices()
amt := minGasPrice.AmountOf(evmParams.Params.EvmDenom).TruncateInt64()
if amt == 0 {
return ethermint.DefaultGasPrice
}
return amt
}
// ChainConfig return the ethereum chain configuration