From 2f475c9d0b1fbc2a781ec7d5b511d1c8fec43097 Mon Sep 17 00:00:00 2001 From: SatpalSandhu61 Date: Tue, 7 Aug 2018 09:47:01 +0100 Subject: [PATCH] Adding logging to investigate issue with very large eth_estimateGas value (issue #461) --- internal/ethapi/api.go | 4 ++++ 1 file changed, 4 insertions(+) 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 }