internal/ethapi: fix gascap 0 for eth_simulateV1

This commit is contained in:
Sina Mahmoodi 2024-09-23 15:20:43 +02:00
parent 564b616163
commit dede3378f3

View file

@ -1289,13 +1289,17 @@ func (api *BlockChainAPI) SimulateV1(ctx context.Context, opts simOpts, blockNrO
if state == nil || err != nil { if state == nil || err != nil {
return nil, err return nil, err
} }
gasCap := api.b.RPCGasCap()
if gasCap == 0 {
gasCap = math.MaxUint64
}
sim := &simulator{ sim := &simulator{
b: api.b, b: api.b,
state: state, state: state,
base: base, base: base,
chainConfig: api.b.ChainConfig(), chainConfig: api.b.ChainConfig(),
// Each tx and all the series of txes shouldn't consume more gas than cap // Each tx and all the series of txes shouldn't consume more gas than cap
gp: new(core.GasPool).AddGas(api.b.RPCGasCap()), gp: new(core.GasPool).AddGas(gasCap),
traceTransfers: opts.TraceTransfers, traceTransfers: opts.TraceTransfers,
validate: opts.Validation, validate: opts.Validation,
fullTx: opts.ReturnFullTransactions, fullTx: opts.ReturnFullTransactions,