diff --git a/core/state_processor_test.go b/core/state_processor_test.go index c07d3c50656d0..cce40167528d2 100644 --- a/core/state_processor_test.go +++ b/core/state_processor_test.go @@ -120,7 +120,7 @@ func TestStateProcessorErrors(t *testing.T) { txs: []*types.Transaction{ makeTx(0, common.Address{}, big.NewInt(1000000000000000000), params.TxGas, big.NewInt(875000000), nil), }, - want: "insufficient funds for transfer: address xdc71562b71999873DB5b286dF957af199Ec94617F7", + want: "insufficient funds for gas * price + value: address xdc71562b71999873DB5b286dF957af199Ec94617F7", }, { // ErrInsufficientFunds txs: []*types.Transaction{ diff --git a/core/state_transition.go b/core/state_transition.go index 857a2560c867d..933759a955466 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -194,6 +194,7 @@ func (st *StateTransition) buyGas() error { if st.gasFeeCap != nil { balanceCheck = new(big.Int).SetUint64(st.msg.Gas()) balanceCheck = balanceCheck.Mul(balanceCheck, st.gasFeeCap) + balanceCheck.Add(balanceCheck, st.value) } if have, want := st.state.GetBalance(st.msg.From()), balanceCheck; have.Cmp(want) < 0 { return fmt.Errorf("%w: address %v have %v want %v", ErrInsufficientFunds, st.msg.From().Hex(), have, want)