Skip to content

Commit b1f699f

Browse files
committed
core: fix CanTranfer use for buyGas for StateDiff Tracer
1 parent 94b636d commit b1f699f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

core/state_transition.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,8 @@ func (st *StateTransition) buyGas() error {
198198
balanceCheck = balanceCheck.Mul(balanceCheck, st.gasFeeCap)
199199
balanceCheck.Add(balanceCheck, st.value)
200200
}
201-
if have, want := st.state.GetBalance(st.msg.From()), balanceCheck; have.Cmp(want) < 0 {
202-
return fmt.Errorf("%w: address %v have %v want %v", ErrInsufficientFunds, st.msg.From().Hex(), have, want)
201+
if !st.evm.Context.CanTransfer(st.state, st.msg.From(), balanceCheck) {
202+
return fmt.Errorf("%w: address %v have %v want %v", ErrInsufficientFunds, st.msg.From().Hex(), st.state, st.msg.From(), balanceCheck)
203203
}
204204
if err := st.gp.SubGas(st.msg.Gas()); err != nil {
205205
return err

0 commit comments

Comments
 (0)