mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
Header validator (#12648)
Co-authored-by: Arsenii Kulikov <klkvrr@gmail.com>
This commit is contained in:
@ -9,7 +9,7 @@ use futures::{stream::Stream, FutureExt};
|
||||
use futures_util::{stream::FuturesUnordered, StreamExt};
|
||||
use rayon::prelude::*;
|
||||
use reth_config::config::HeadersConfig;
|
||||
use reth_consensus::Consensus;
|
||||
use reth_consensus::{Consensus, HeaderValidator};
|
||||
use reth_network_p2p::{
|
||||
error::{DownloadError, DownloadResult, PeerRequestResult},
|
||||
headers::{
|
||||
|
||||
@ -4,7 +4,7 @@ use alloy_consensus::BlockHeader;
|
||||
use alloy_eips::BlockHashOrNumber;
|
||||
use alloy_primitives::B256;
|
||||
use futures::Stream;
|
||||
use reth_consensus::Consensus;
|
||||
use reth_consensus::HeaderValidator;
|
||||
use reth_primitives::SealedHeader;
|
||||
use reth_primitives_traits::BlockWithParent;
|
||||
/// A downloader capable of fetching and yielding block headers.
|
||||
@ -83,7 +83,7 @@ impl SyncTarget {
|
||||
///
|
||||
/// Returns Ok(false) if the
|
||||
pub fn validate_header_download<H: BlockHeader>(
|
||||
consensus: &dyn Consensus<H>,
|
||||
consensus: &dyn HeaderValidator<H>,
|
||||
header: &SealedHeader<H>,
|
||||
parent: &SealedHeader<H>,
|
||||
) -> DownloadResult<()> {
|
||||
|
||||
@ -147,7 +147,7 @@ impl Stream for TestDownload {
|
||||
|
||||
let empty: SealedHeader = SealedHeader::default();
|
||||
if let Err(error) =
|
||||
Consensus::<_>::validate_header_against_parent(&this.consensus, &empty, &empty)
|
||||
<dyn Consensus<_>>::validate_header_against_parent(&this.consensus, &empty, &empty)
|
||||
{
|
||||
this.done = true;
|
||||
return Poll::Ready(Some(Err(DownloadError::HeaderValidation {
|
||||
|
||||
Reference in New Issue
Block a user