mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: use cost in error (#2213)
Co-authored-by: Roman Krasiuk <rokrassyuk@gmail.com>
This commit is contained in:
@ -7,8 +7,8 @@ use crate::U256;
|
||||
pub enum InvalidTransactionError {
|
||||
#[error("Transaction eip1559 priority fee is more then max fee.")]
|
||||
PriorityFeeMoreThenMaxFee,
|
||||
#[error("Account does not have enough funds ({available_funds:?}) to cover transaction max fee: {max_fee:?}.")]
|
||||
InsufficientFunds { max_fee: u128, available_funds: U256 },
|
||||
#[error("Account does not have enough funds ({available_funds:?}) to cover transaction cost: {cost:?}.")]
|
||||
InsufficientFunds { cost: U256, available_funds: U256 },
|
||||
#[error("Transaction nonce is not consistent.")]
|
||||
NonceNotConsistent,
|
||||
#[error("Old legacy transaction before Spurious Dragon should not have chain_id.")]
|
||||
|
||||
@ -257,11 +257,11 @@ where
|
||||
|
||||
// Checks for max cost
|
||||
if transaction.cost() > account.balance {
|
||||
let max_fee = transaction.max_fee_per_gas().unwrap_or_default();
|
||||
let cost = transaction.cost();
|
||||
return TransactionValidationOutcome::Invalid(
|
||||
transaction,
|
||||
InvalidTransactionError::InsufficientFunds {
|
||||
max_fee,
|
||||
cost,
|
||||
available_funds: account.balance,
|
||||
}
|
||||
.into(),
|
||||
|
||||
Reference in New Issue
Block a user