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

This commit is contained in:
vsmk98 2020-05-06 12:08:54 +08:00 committed by Trung Nguyen
parent 3ae914052f
commit c7750217a1
No known key found for this signature in database
GPG Key ID: 4636434ED9505EB7
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