diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 65a644e221..2fc8331e5c 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -675,6 +675,7 @@ func (s *PublicBlockChainAPI) EstimateGas(ctx context.Context, args CallArgs) (* ) if (*big.Int)(&args.Gas).Uint64() >= params.TxGas { hi = (*big.Int)(&args.Gas).Uint64() + log.Info(fmt.Sprintf("======== estimateGas 1: hi = %v", hi)) } else { // Retrieve the current pending block to act as the gas ceiling block, err := s.b.BlockByNumber(ctx, rpc.PendingBlockNumber) @@ -682,11 +683,13 @@ func (s *PublicBlockChainAPI) EstimateGas(ctx context.Context, args CallArgs) (* return nil, err } hi = block.GasLimit().Uint64() + log.Info(fmt.Sprintf("======== estimateGas 2: hi = %v", hi)) } for lo+1 < hi { // Take a guess at the gas, and check transaction validity mid := (hi + lo) / 2 (*big.Int)(&args.Gas).SetUint64(mid) + log.Info(fmt.Sprintf("======== estimateGas 3: mid = %v", mid)) _, _, failed, err := s.doCall(ctx, args, rpc.PendingBlockNumber, vm.Config{}) @@ -697,6 +700,7 @@ func (s *PublicBlockChainAPI) EstimateGas(ctx context.Context, args CallArgs) (* } // Otherwise assume the transaction succeeded, lower the gas limit hi = mid + log.Info(fmt.Sprintf("======== estimateGas 4: set hi = %v", hi)) } return (*hexutil.Big)(new(big.Int).SetUint64(hi)), nil }