chore(tree): remove redundant BlockchainTree RethError variant (#5269)

This commit is contained in:
Dan Cline
2023-11-01 16:03:01 -04:00
committed by GitHub
parent 4040cd7946
commit 7cc64024d9
3 changed files with 9 additions and 5 deletions

View File

@ -955,7 +955,9 @@ where
})
.with_latest_valid_hash(B256::ZERO)
}
RethError::BlockchainTree(BlockchainTreeError::BlockHashNotFoundInChain { .. }) => {
RethError::Canonical(CanonicalError::BlockchainTree(
BlockchainTreeError::BlockHashNotFoundInChain { .. },
)) => {
// This just means we couldn't find the block when attempting to make it canonical,
// so we should not warn the user, since this will result in us attempting to sync
// to a new target and is considered normal operation during sync

View File

@ -330,7 +330,6 @@ impl From<crate::RethError> for InsertBlockErrorKind {
RethError::Network(err) => InsertBlockErrorKind::Internal(Box::new(err)),
RethError::Custom(err) => InsertBlockErrorKind::Internal(err.into()),
RethError::Canonical(err) => InsertBlockErrorKind::Canonical(err),
RethError::BlockchainTree(err) => InsertBlockErrorKind::BlockchainTree(err),
}
}
}

View File

@ -23,13 +23,16 @@ pub enum RethError {
#[error(transparent)]
Canonical(#[from] crate::blockchain_tree::error::CanonicalError),
#[error(transparent)]
BlockchainTree(#[from] crate::blockchain_tree::error::BlockchainTreeError),
#[error("{0}")]
Custom(String),
}
impl From<crate::blockchain_tree::error::BlockchainTreeError> for RethError {
fn from(error: crate::blockchain_tree::error::BlockchainTreeError) -> Self {
RethError::Canonical(error.into())
}
}
impl From<reth_nippy_jar::NippyJarError> for RethError {
fn from(err: reth_nippy_jar::NippyJarError) -> Self {
RethError::Custom(err.to_string())