fixes EIP1559 tx gasCost validation
pre EIP1559 max(gasCost) is tx.gasLimit * tx.gasPrice the new EIP1559 max(gasCost) before the transaction can be executed is tx.gasLimit * tx.maxFeePerGas
This commit is contained in:
parent
d8dedb0469
commit
460432f154
|
@ -304,7 +304,12 @@ proc validateTransaction*(vmState: BaseVMState, tx: Transaction,
|
||||||
maxPriorityFee=tx.maxPriorityFee
|
maxPriorityFee=tx.maxPriorityFee
|
||||||
return
|
return
|
||||||
|
|
||||||
let gasCost = tx.gasLimit.u256 * tx.gasPrice.u256
|
# the signer must be able to afford the transaction
|
||||||
|
let gasCost = if tx.txType >= TxEip1559:
|
||||||
|
tx.gasLimit.u256 * tx.maxFee.u256
|
||||||
|
else:
|
||||||
|
tx.gasLimit.u256 * tx.gasPrice.u256
|
||||||
|
|
||||||
if gasCost > balance:
|
if gasCost > balance:
|
||||||
debug "invalid tx: not enough cash for gas",
|
debug "invalid tx: not enough cash for gas",
|
||||||
available=balance,
|
available=balance,
|
||||||
|
|
Loading…
Reference in New Issue