reth_optimism_txpool/
error.rs

1use crate::supervisor::InteropTxValidatorError;
2use reth_transaction_pool::error::PoolTransactionError;
3use std::any::Any;
4
5/// Wrapper for [`InteropTxValidatorError`] to implement [`PoolTransactionError`] for it.
6#[derive(thiserror::Error, Debug)]
7pub enum InvalidCrossTx {
8    /// Errors produced by supervisor validation
9    #[error(transparent)]
10    ValidationError(#[from] InteropTxValidatorError),
11    /// Error cause by cross chain tx during not active interop hardfork
12    #[error("cross chain tx is invalid before interop")]
13    CrossChainTxPreInterop,
14}
15
16impl PoolTransactionError for InvalidCrossTx {
17    fn is_bad_transaction(&self) -> bool {
18        match self {
19            Self::ValidationError(_) => false,
20            Self::CrossChainTxPreInterop => true,
21        }
22    }
23
24    fn as_any(&self) -> &dyn Any {
25        self
26    }
27}