From 80564d5f26d464e9e5c99e74338d1cf0a8428493 Mon Sep 17 00:00:00 2001 From: Sai V Date: Sat, 9 May 2020 11:10:14 +0800 Subject: [PATCH] added nil pointer check for args.Value to avoid a panic in estimate gas call (#989) --- internal/ethapi/api.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 7200f4d26..05488a9d0 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -972,7 +972,7 @@ func DoEstimateGas(ctx context.Context, b Backend, args CallArgs, blockNrOrHash //This makes the return value a potential over-estimate of gas, rather than the exact cost to run right now //if the transaction has a value then it cannot be private, so we can skip this check - if args.Value.ToInt().Cmp(big.NewInt(0)) == 0 { + if args.Value != nil && args.Value.ToInt().Cmp(big.NewInt(0)) == 0 { homestead := b.ChainConfig().IsHomestead(new(big.Int).SetInt64(int64(rpc.PendingBlockNumber))) istanbul := b.ChainConfig().IsIstanbul(new(big.Int).SetInt64(int64(rpc.PendingBlockNumber))) var data []byte