Skip to content

Commit

Permalink
Use existing header no copy
Browse files Browse the repository at this point in the history
  • Loading branch information
somnathb1 committed Feb 21, 2025
1 parent 20746c7 commit 99ec640
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions turbo/jsonrpc/eth_call.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ func (api *APIImpl) EstimateGas(ctx context.Context, argsOrNil *ethapi2.CallArgs
if block == nil {
return 0, errors.New(fmt.Sprintf("could not find the block %s in cache or db", blockNrOrHash.String()))
}
header := block.HeaderNoCopy()

txNumsReader := rawdbv3.TxNums.WithCustomReadTxNumFunc(freezeblocks.ReadTxNumFuncFromBlockReader(ctx, api._blockReader))
stateReader, err := rpchelper.CreateStateReaderFromBlockNumber(ctx, dbtx, txNumsReader, blockNum, isLatest, 0, api.stateCache, chainConfig.ChainName)
Expand All @@ -201,7 +202,7 @@ func (api *APIImpl) EstimateGas(ctx context.Context, argsOrNil *ethapi2.CallArgs
hi = uint64(*args.Gas)
} else {
// Retrieve the block to act as the gas ceiling
hi = block.Header().GasLimit
hi = header.GasLimit
}

var feeCap *big.Int
Expand Down Expand Up @@ -253,7 +254,6 @@ func (api *APIImpl) EstimateGas(ctx context.Context, argsOrNil *ethapi2.CallArgs
}
gasCap = hi

header := block.HeaderNoCopy()
caller, err := transactions.NewReusableCaller(engine, stateReader, overrides, header, args, api.GasCap, *blockNrOrHash, dbtx, api._blockReader, chainConfig, api.evmCallTimeout)
if err != nil {
return 0, err
Expand Down

0 comments on commit 99ec640

Please sign in to comment.