added nil pointer check for args.Value to avoid a panic in estimate gas call (#989)

This commit is contained in:
Sai V 2020-05-09 11:10:14 +08:00 committed by GitHub
parent 3ae914052f
commit 80564d5f26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -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