rpc: fix gas price (#596)
This commit is contained in:
parent
fdb92ee788
commit
bc82f3f8eb
@ -720,21 +720,24 @@ func (e *EVMBackend) RPCGasCap() uint64 {
|
|||||||
return e.cfg.JSONRPC.GasCap
|
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 {
|
func (e *EVMBackend) RPCMinGasPrice() int64 {
|
||||||
evmParams, err := e.queryClient.Params(context.Background(), &evmtypes.QueryParamsRequest{})
|
evmParams, err := e.queryClient.Params(context.Background(), &evmtypes.QueryParamsRequest{})
|
||||||
if err == nil {
|
if err != nil {
|
||||||
minGasPrice := e.cfg.GetMinGasPrices()
|
return ethermint.DefaultGasPrice
|
||||||
for _, coin := range minGasPrice {
|
|
||||||
if coin.Denom == evmParams.Params.EvmDenom {
|
|
||||||
return coin.Amount.TruncateInt64()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
minGasPrice := e.cfg.GetMinGasPrices()
|
||||||
|
amt := minGasPrice.AmountOf(evmParams.Params.EvmDenom).TruncateInt64()
|
||||||
|
if amt == 0 {
|
||||||
return ethermint.DefaultGasPrice
|
return ethermint.DefaultGasPrice
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return amt
|
||||||
|
}
|
||||||
|
|
||||||
// ChainConfig return the ethereum chain configuration
|
// ChainConfig return the ethereum chain configuration
|
||||||
func (e *EVMBackend) ChainConfig() *params.ChainConfig {
|
func (e *EVMBackend) ChainConfig() *params.ChainConfig {
|
||||||
params, err := e.queryClient.Params(e.ctx, &evmtypes.QueryParamsRequest{})
|
params, err := e.queryClient.Params(e.ctx, &evmtypes.QueryParamsRequest{})
|
||||||
|
Loading…
Reference in New Issue
Block a user