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 {
|
pub enum InvalidTransactionError {
|
||||||
#[error("Transaction eip1559 priority fee is more then max fee.")]
|
#[error("Transaction eip1559 priority fee is more then max fee.")]
|
||||||
PriorityFeeMoreThenMaxFee,
|
PriorityFeeMoreThenMaxFee,
|
||||||
#[error("Account does not have enough funds ({available_funds:?}) to cover transaction max fee: {max_fee:?}.")]
|
#[error("Account does not have enough funds ({available_funds:?}) to cover transaction cost: {cost:?}.")]
|
||||||
InsufficientFunds { max_fee: u128, available_funds: U256 },
|
InsufficientFunds { cost: U256, available_funds: U256 },
|
||||||
#[error("Transaction nonce is not consistent.")]
|
#[error("Transaction nonce is not consistent.")]
|
||||||
NonceNotConsistent,
|
NonceNotConsistent,
|
||||||
#[error("Old legacy transaction before Spurious Dragon should not have chain_id.")]
|
#[error("Old legacy transaction before Spurious Dragon should not have chain_id.")]
|
||||||
|
|||||||
@ -257,11 +257,11 @@ where
|
|||||||
|
|
||||||
// Checks for max cost
|
// Checks for max cost
|
||||||
if transaction.cost() > account.balance {
|
if transaction.cost() > account.balance {
|
||||||
let max_fee = transaction.max_fee_per_gas().unwrap_or_default();
|
let cost = transaction.cost();
|
||||||
return TransactionValidationOutcome::Invalid(
|
return TransactionValidationOutcome::Invalid(
|
||||||
transaction,
|
transaction,
|
||||||
InvalidTransactionError::InsufficientFunds {
|
InvalidTransactionError::InsufficientFunds {
|
||||||
max_fee,
|
cost,
|
||||||
available_funds: account.balance,
|
available_funds: account.balance,
|
||||||
}
|
}
|
||||||
.into(),
|
.into(),
|
||||||
|
|||||||
Reference in New Issue
Block a user