Skip to content

Commit 7ed52c9

Browse files
authored
core: move balanceCheck addition in buyGas (ethereum#29762)
It's a bit confusing to add msg.value into the balanceCheck within the conditional. No impact on block validation since GasFeeCap is always set when processing transactions.
1 parent d2f00cb commit 7ed52c9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

core/state_transition.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,9 @@ func (st *StateTransition) buyGas() error {
240240
if st.msg.GasFeeCap != nil {
241241
balanceCheck.SetUint64(st.msg.GasLimit)
242242
balanceCheck = balanceCheck.Mul(balanceCheck, st.msg.GasFeeCap)
243-
balanceCheck.Add(balanceCheck, st.msg.Value)
244243
}
244+
balanceCheck.Add(balanceCheck, st.msg.Value)
245+
245246
if st.evm.ChainConfig().IsCancun(st.evm.Context.BlockNumber, st.evm.Context.Time) {
246247
if blobGas := st.blobGasUsed(); blobGas > 0 {
247248
// Check that the user has enough funds to cover blobGasUsed * tx.BlobGasFeeCap

0 commit comments

Comments
 (0)