forked from paradigmxyz/reth
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(network, p2p): Wasm compilation (paradigmxyz#10278)
- Loading branch information
Showing
4 changed files
with
64 additions
and
31 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,31 @@ | ||
use derive_more::Display; | ||
use reth_consensus::ConsensusError; | ||
use reth_primitives::SealedHeader; | ||
use thiserror::Error; | ||
|
||
/// Header downloader result | ||
pub type HeadersDownloaderResult<T> = Result<T, HeadersDownloaderError>; | ||
|
||
/// Error variants that can happen when sending requests to a session. | ||
#[derive(Debug, Error, Clone, Eq, PartialEq)] | ||
#[derive(Debug, Clone, Eq, PartialEq, Display)] | ||
pub enum HeadersDownloaderError { | ||
/// The downloaded header cannot be attached to the local head, | ||
/// but is valid otherwise. | ||
#[error("valid downloaded header cannot be attached to the local head: {error}")] | ||
#[display(fmt = "valid downloaded header cannot be attached to the local head: {error}")] | ||
DetachedHead { | ||
/// The local head we attempted to attach to. | ||
local_head: Box<SealedHeader>, | ||
/// The header we attempted to attach. | ||
header: Box<SealedHeader>, | ||
/// The error that occurred when attempting to attach the header. | ||
#[source] | ||
error: Box<ConsensusError>, | ||
}, | ||
} | ||
|
||
#[cfg(feature = "std")] | ||
impl std::error::Error for HeadersDownloaderError { | ||
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { | ||
match self { | ||
Self::DetachedHead { error, .. } => Some(error), | ||
} | ||
} | ||
} |