accounts, internal: fix funding check when estimating gas (#21346)
* internal, accounts: fix funding check when estimate gas * accounts, internal: address comments
This commit is contained in:
@ -966,7 +966,7 @@ func DoEstimateGas(ctx context.Context, b Backend, args CallArgs, blockNrOrHash
|
||||
hi = block.GasLimit()
|
||||
}
|
||||
// Recap the highest gas limit with account's available balance.
|
||||
if args.GasPrice != nil && args.GasPrice.ToInt().Uint64() != 0 {
|
||||
if args.GasPrice != nil && args.GasPrice.ToInt().BitLen() != 0 {
|
||||
state, _, err := b.StateAndHeaderByNumberOrHash(ctx, blockNrOrHash)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
@ -980,7 +980,9 @@ func DoEstimateGas(ctx context.Context, b Backend, args CallArgs, blockNrOrHash
|
||||
available.Sub(available, args.Value.ToInt())
|
||||
}
|
||||
allowance := new(big.Int).Div(available, args.GasPrice.ToInt())
|
||||
if hi > allowance.Uint64() {
|
||||
|
||||
// If the allowance is larger than maximum uint64, skip checking
|
||||
if allowance.IsUint64() && hi > allowance.Uint64() {
|
||||
transfer := args.Value
|
||||
if transfer == nil {
|
||||
transfer = new(hexutil.Big)
|
||||
|
Reference in New Issue
Block a user