mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
accounts/abi: return detail insufficient error in simulate tx
Signed-off-by: jsvisa <delweng@gmail.com>
This commit is contained in:
parent
30d5d7c1b3
commit
7c6d721564
1 changed files with 4 additions and 4 deletions
|
|
@ -531,11 +531,11 @@ func (b *SimulatedBackend) EstimateGas(ctx context.Context, call ethereum.CallMs
|
||||||
if feeCap.BitLen() != 0 {
|
if feeCap.BitLen() != 0 {
|
||||||
balance := b.pendingState.GetBalance(call.From) // from can't be nil
|
balance := b.pendingState.GetBalance(call.From) // from can't be nil
|
||||||
available := new(big.Int).Set(balance)
|
available := new(big.Int).Set(balance)
|
||||||
if call.Value != nil {
|
if value := call.Value; value != nil {
|
||||||
if call.Value.Cmp(available) >= 0 {
|
if value.Cmp(available) >= 0 {
|
||||||
return 0, core.ErrInsufficientFundsForTransfer
|
return 0, fmt.Errorf("%w: address: %s, have: %v, want: %v", core.ErrInsufficientFundsForTransfer, call.From, available, value)
|
||||||
}
|
}
|
||||||
available.Sub(available, call.Value)
|
available.Sub(available, value)
|
||||||
}
|
}
|
||||||
allowance := new(big.Int).Div(available, feeCap)
|
allowance := new(big.Int).Div(available, feeCap)
|
||||||
if allowance.IsUint64() && hi > allowance.Uint64() {
|
if allowance.IsUint64() && hi > allowance.Uint64() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue