From 4a1a1039eadf9d9a67aa93bd280f1b75a961080d Mon Sep 17 00:00:00 2001 From: Nguyen Ba Tam Date: Fri, 19 Oct 2018 16:35:54 +0700 Subject: [PATCH] change EstimateGas from pending block to latest block will reduce lock time --- internal/ethapi/api.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 7b1893a7b2..afe30b141c 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -695,7 +695,7 @@ func (s *PublicBlockChainAPI) EstimateGas(ctx context.Context, args CallArgs) (h hi = uint64(args.Gas) } else { // Retrieve the current pending block to act as the gas ceiling - block, err := s.b.BlockByNumber(ctx, rpc.PendingBlockNumber) + block, err := s.b.BlockByNumber(ctx, rpc.LatestBlockNumber) if err != nil { return 0, err } @@ -707,7 +707,7 @@ func (s *PublicBlockChainAPI) EstimateGas(ctx context.Context, args CallArgs) (h executable := func(gas uint64) bool { args.Gas = hexutil.Uint64(gas) - _, _, failed, err := s.doCall(ctx, args, rpc.PendingBlockNumber, vm.Config{}, 0) + _, _, failed, err := s.doCall(ctx, args, rpc.LatestBlockNumber, vm.Config{}, 0) if err != nil || failed { return false }