From e43830fa61504eb7dfe6103ba5319025062cce49 Mon Sep 17 00:00:00 2001 From: beer-1 Date: Sun, 24 Nov 2024 04:14:23 +0900 Subject: [PATCH] disallow empty from address at estimate fee --- jsonrpc/backend/gas.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/jsonrpc/backend/gas.go b/jsonrpc/backend/gas.go index 5158609..fcd4516 100644 --- a/jsonrpc/backend/gas.go +++ b/jsonrpc/backend/gas.go @@ -20,6 +20,9 @@ func (b *JSONRPCBackend) EstimateGas(args rpctypes.TransactionArgs, blockNrOrHas if overrides != nil { return hexutil.Uint64(0), errors.New("state overrides are not supported") } + if args.From == nil { + return hexutil.Uint64(0), errors.New("empty from address is not allowed from the estimate gas") + } if args.Nonce == nil && args.From != nil { nonce, err := b.GetTransactionCount(*args.From, rpc.BlockNumberOrHashWithNumber(rpc.PendingBlockNumber))