mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-25 21:17:16 +00:00
Fix 'all defaults' case for eth_estimateGas (#3790)
* Fix 'all defaults' case for eth_estimateGas * fix tests Co-authored-by: Igor Mandrigin <i@mandrigin.ru>
This commit is contained in:
parent
816ad30eff
commit
7f1771516c
@ -76,7 +76,7 @@ type EthAPI interface {
|
||||
|
||||
// Sending related (see ./eth_call.go)
|
||||
Call(ctx context.Context, args ethapi.CallArgs, blockNrOrHash rpc.BlockNumberOrHash, overrides *ethapi.StateOverrides) (hexutil.Bytes, error)
|
||||
EstimateGas(ctx context.Context, args ethapi.CallArgs, blockNrOrHash *rpc.BlockNumberOrHash) (hexutil.Uint64, error)
|
||||
EstimateGas(ctx context.Context, argsOrNil *ethapi.CallArgs, blockNrOrHash *rpc.BlockNumberOrHash) (hexutil.Uint64, error)
|
||||
SendRawTransaction(ctx context.Context, encodedTx hexutil.Bytes) (common.Hash, error)
|
||||
SendTransaction(_ context.Context, txObject interface{}) (common.Hash, error)
|
||||
Sign(ctx context.Context, _ common.Address, _ hexutil.Bytes) (hexutil.Bytes, error)
|
||||
|
@ -113,7 +113,13 @@ func HeaderByNumberOrHash(ctx context.Context, tx kv.Tx, blockNrOrHash rpc.Block
|
||||
}
|
||||
|
||||
// EstimateGas implements eth_estimateGas. Returns an estimate of how much gas is necessary to allow the transaction to complete. The transaction will not be added to the blockchain.
|
||||
func (api *APIImpl) EstimateGas(ctx context.Context, args ethapi.CallArgs, blockNrOrHash *rpc.BlockNumberOrHash) (hexutil.Uint64, error) {
|
||||
func (api *APIImpl) EstimateGas(ctx context.Context, argsOrNil *ethapi.CallArgs, blockNrOrHash *rpc.BlockNumberOrHash) (hexutil.Uint64, error) {
|
||||
var args ethapi.CallArgs
|
||||
// if we actually get CallArgs here, we use them
|
||||
if argsOrNil != nil {
|
||||
args = *argsOrNil
|
||||
}
|
||||
|
||||
bNrOrHash := rpc.BlockNumberOrHashWithNumber(rpc.PendingBlockNumber)
|
||||
if blockNrOrHash != nil {
|
||||
bNrOrHash = *blockNrOrHash
|
||||
|
@ -20,7 +20,7 @@ func TestEstimateGas(t *testing.T) {
|
||||
api := NewEthAPI(NewBaseApi(nil, stateCache, snapshotsync.NewBlockReader(), false), db, nil, nil, nil, 5000000)
|
||||
var from = common.HexToAddress("0x71562b71999873db5b286df957af199ec94617f7")
|
||||
var to = common.HexToAddress("0x0d3ab14bbad3d99f4203bd7a11acb94882050e7e")
|
||||
if _, err := api.EstimateGas(context.Background(), ethapi.CallArgs{
|
||||
if _, err := api.EstimateGas(context.Background(), ðapi.CallArgs{
|
||||
From: &from,
|
||||
To: &to,
|
||||
}, nil); err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user