mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
use core::error::Error (#11317)
This commit is contained in:
@ -90,7 +90,7 @@ pub enum BlobStoreError {
|
||||
DecodeError(#[from] alloy_rlp::Error),
|
||||
/// Other implementation specific error.
|
||||
#[error(transparent)]
|
||||
Other(Box<dyn std::error::Error + Send + Sync>),
|
||||
Other(Box<dyn core::error::Error + Send + Sync>),
|
||||
}
|
||||
|
||||
/// Keeps track of the size of the blob store.
|
||||
|
||||
@ -10,7 +10,7 @@ pub type PoolResult<T> = Result<T, PoolError>;
|
||||
///
|
||||
/// For example during validation
|
||||
/// [`TransactionValidator::validate_transaction`](crate::validate::TransactionValidator::validate_transaction)
|
||||
pub trait PoolTransactionError: std::error::Error + Send + Sync {
|
||||
pub trait PoolTransactionError: core::error::Error + Send + Sync {
|
||||
/// Returns `true` if the error was caused by a transaction that is considered bad in the
|
||||
/// context of the transaction pool and warrants peer penalization.
|
||||
///
|
||||
@ -19,8 +19,8 @@ pub trait PoolTransactionError: std::error::Error + Send + Sync {
|
||||
}
|
||||
|
||||
// Needed for `#[error(transparent)]`
|
||||
impl std::error::Error for Box<dyn PoolTransactionError> {
|
||||
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
|
||||
impl core::error::Error for Box<dyn PoolTransactionError> {
|
||||
fn source(&self) -> Option<&(dyn core::error::Error + 'static)> {
|
||||
(**self).source()
|
||||
}
|
||||
}
|
||||
@ -63,7 +63,7 @@ pub enum PoolErrorKind {
|
||||
/// Any other error that occurred while inserting/validating a transaction. e.g. IO database
|
||||
/// error
|
||||
#[error(transparent)]
|
||||
Other(#[from] Box<dyn std::error::Error + Send + Sync>),
|
||||
Other(#[from] Box<dyn core::error::Error + Send + Sync>),
|
||||
}
|
||||
|
||||
// === impl PoolError ===
|
||||
@ -75,7 +75,10 @@ impl PoolError {
|
||||
}
|
||||
|
||||
/// Creates a new pool error with the `Other` kind.
|
||||
pub fn other(hash: TxHash, error: impl Into<Box<dyn std::error::Error + Send + Sync>>) -> Self {
|
||||
pub fn other(
|
||||
hash: TxHash,
|
||||
error: impl Into<Box<dyn core::error::Error + Send + Sync>>,
|
||||
) -> Self {
|
||||
Self { hash, kind: PoolErrorKind::Other(error.into()) }
|
||||
}
|
||||
|
||||
|
||||
@ -51,7 +51,7 @@ pub enum TransactionValidationOutcome<T: PoolTransaction> {
|
||||
/// this transaction from ever becoming valid.
|
||||
Invalid(T, InvalidPoolTransactionError),
|
||||
/// An error occurred while trying to validate the transaction
|
||||
Error(TxHash, Box<dyn std::error::Error + Send + Sync>),
|
||||
Error(TxHash, Box<dyn core::error::Error + Send + Sync>),
|
||||
}
|
||||
|
||||
impl<T: PoolTransaction> TransactionValidationOutcome<T> {
|
||||
|
||||
Reference in New Issue
Block a user