reth_network_p2p/headers/
error.rs

1use derive_more::{Display, Error};
2use reth_consensus::ConsensusError;
3use reth_primitives::SealedHeader;
4
5/// Header downloader result
6pub type HeadersDownloaderResult<T, H> = Result<T, HeadersDownloaderError<H>>;
7
8/// Error variants that can happen when sending requests to a session.
9#[derive(Debug, Clone, Eq, PartialEq, Display, Error)]
10pub enum HeadersDownloaderError<H> {
11    /// The downloaded header cannot be attached to the local head,
12    /// but is valid otherwise.
13    #[display("valid downloaded header cannot be attached to the local head: {error}")]
14    DetachedHead {
15        /// The local head we attempted to attach to.
16        local_head: Box<SealedHeader<H>>,
17        /// The header we attempted to attach.
18        header: Box<SealedHeader<H>>,
19        /// The error that occurred when attempting to attach the header.
20        #[error(source)]
21        error: Box<ConsensusError>,
22    },
23}