kaspa_consensus_core/errors/
consensus.rs

1use kaspa_hashes::Hash;
2use thiserror::Error;
3
4use super::{difficulty::DifficultyError, sync::SyncManagerError, traversal::TraversalError};
5
6#[derive(Error, Debug, Clone)]
7pub enum ConsensusError {
8    #[error("cannot find full block {0}")]
9    BlockNotFound(Hash),
10
11    #[error("cannot find header {0}")]
12    HeaderNotFound(Hash),
13
14    #[error("block {0} is invalid")]
15    InvalidBlock(Hash),
16
17    #[error("some data is missing for block {0}")]
18    MissingData(Hash),
19
20    #[error("got unexpected pruning point")]
21    UnexpectedPruningPoint,
22
23    #[error("pruning point is not at sufficient depth from virtual, cannot obtain its final anticone at this stage")]
24    PruningPointInsufficientDepth,
25
26    #[error("sync manager error: {0}")]
27    SyncManagerError(#[from] SyncManagerError),
28
29    #[error("traversal error: {0}")]
30    TraversalError(#[from] TraversalError),
31
32    #[error("difficulty error: {0}")]
33    DifficultyError(#[from] DifficultyError),
34
35    #[error("{0}")]
36    General(&'static str),
37}
38
39pub type ConsensusResult<T> = std::result::Result<T, ConsensusError>;