mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 06:36:43 +00:00
ethapi: bugfix for contract creation gas estimate
This commit is contained in:
parent
6dd27e7cff
commit
d6149a790d
1 changed files with 5 additions and 0 deletions
|
|
@ -579,6 +579,11 @@ func (s *PublicBlockChainAPI) Call(ctx context.Context, args CallArgs, blockNr r
|
|||
|
||||
// EstimateGas returns an estimate of the amount of gas needed to execute the given transaction.
|
||||
func (s *PublicBlockChainAPI) EstimateGas(ctx context.Context, args CallArgs) (*hexutil.Big, error) {
|
||||
if args.To == nil { // contract creation, doCall returns immediately the used gas.
|
||||
_, gas, err := s.doCall(ctx, args, rpc.PendingBlockNumber, vm.Config{})
|
||||
return (*hexutil.Big)(gas), err
|
||||
}
|
||||
|
||||
// Binary search the gas requirement, as it may be higher than the amount used
|
||||
var lo, hi uint64
|
||||
if (*big.Int)(&args.Gas).BitLen() > 0 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue