Merge pull request #226 from nguyenbatam/change_estimate_gas_from_pending_block_to_lastest_block

Change estimateGas from pending block to latest block
This commit is contained in:
Tuna 2018-10-19 16:42:09 +07:00 committed by GitHub
commit 005b5634bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -695,7 +695,7 @@ func (s *PublicBlockChainAPI) EstimateGas(ctx context.Context, args CallArgs) (h
hi = uint64(args.Gas) hi = uint64(args.Gas)
} else { } else {
// Retrieve the current pending block to act as the gas ceiling // 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 { if err != nil {
return 0, err return 0, err
} }
@ -707,7 +707,7 @@ func (s *PublicBlockChainAPI) EstimateGas(ctx context.Context, args CallArgs) (h
executable := func(gas uint64) bool { executable := func(gas uint64) bool {
args.Gas = hexutil.Uint64(gas) 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 { if err != nil || failed {
return false return false
} }