Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Make TransactionValidationOutcome generic over error type #14046

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions crates/transaction-pool/src/validate/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use reth_primitives_traits::Block;

/// A Result type returned after checking a transaction's validity.
#[derive(Debug)]
pub enum TransactionValidationOutcome<T: PoolTransaction> {
pub enum TransactionValidationOutcome<T: PoolTransaction, E = InvalidPoolTransactionError> {
/// The transaction is considered _currently_ valid and can be inserted into the pool.
Valid {
/// Balance of the sender at the current point.
Expand All @@ -49,12 +49,12 @@ pub enum TransactionValidationOutcome<T: PoolTransaction> {
},
/// The transaction is considered invalid indefinitely: It violates constraints that prevent
/// this transaction from ever becoming valid.
Invalid(T, InvalidPoolTransactionError),
Invalid(T, E),
/// An error occurred while trying to validate the transaction
Error(TxHash, Box<dyn core::error::Error + Send + Sync>),
}

impl<T: PoolTransaction> TransactionValidationOutcome<T> {
impl<T: PoolTransaction, E> TransactionValidationOutcome<T, E> {
/// Returns the hash of the transactions
pub fn tx_hash(&self) -> TxHash {
match self {
Expand Down
Loading