reth_network_p2p/headers/
error.rs

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