Skip to content

Commit

Permalink
fix incorrect balance check
Browse files Browse the repository at this point in the history
  • Loading branch information
abelliumnt committed Feb 27, 2024
1 parent 52122bd commit 72e4779
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/ethapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1235,7 +1235,7 @@ func DoEstimateGas(ctx context.Context, b Backend, args TransactionArgs, blockNr

available := new(big.Int).Set(balance)
if args.Value != nil {
if args.Value.ToInt().Cmp(available) > 0 {
if args.Value.ToInt().Cmp(available) >= 0 {
return 0, core.ErrInsufficientFundsForTransfer
}
available.Sub(available, args.Value.ToInt())
Expand Down Expand Up @@ -1334,7 +1334,7 @@ func calculateGasWithAllowance(ctx context.Context, b Backend, args TransactionA

available := new(big.Int).Set(balance)
if args.Value != nil {
if args.Value.ToInt().Cmp(available) > 0 {
if args.Value.ToInt().Cmp(available) >= 0 {
return 0, core.ErrInsufficientFundsForTransfer
}
available.Sub(available, args.Value.ToInt())
Expand Down

0 comments on commit 72e4779

Please sign in to comment.