mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: make downloaders and clients generic over block parts (#12469)
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
@ -15,7 +15,7 @@ pub use reth_engine_tree::{
|
||||
engine::EngineApiEvent,
|
||||
};
|
||||
use reth_evm::execute::BlockExecutorProvider;
|
||||
use reth_network_p2p::BlockClient;
|
||||
use reth_network_p2p::EthBlockClient;
|
||||
use reth_node_types::NodeTypesWithEngine;
|
||||
use reth_payload_builder::PayloadBuilderHandle;
|
||||
use reth_payload_validator::ExecutionPayloadValidator;
|
||||
@ -49,7 +49,7 @@ type EngineServiceType<N, Client> = ChainOrchestrator<
|
||||
pub struct EngineService<N, Client, E>
|
||||
where
|
||||
N: EngineNodeTypes,
|
||||
Client: BlockClient + 'static,
|
||||
Client: EthBlockClient + 'static,
|
||||
E: BlockExecutorProvider + 'static,
|
||||
{
|
||||
orchestrator: EngineServiceType<N, Client>,
|
||||
@ -59,7 +59,7 @@ where
|
||||
impl<N, Client, E> EngineService<N, Client, E>
|
||||
where
|
||||
N: EngineNodeTypes,
|
||||
Client: BlockClient + 'static,
|
||||
Client: EthBlockClient + 'static,
|
||||
E: BlockExecutorProvider + 'static,
|
||||
{
|
||||
/// Constructor for `EngineService`.
|
||||
@ -124,7 +124,7 @@ where
|
||||
impl<N, Client, E> Stream for EngineService<N, Client, E>
|
||||
where
|
||||
N: EngineNodeTypes,
|
||||
Client: BlockClient + 'static,
|
||||
Client: EthBlockClient + 'static,
|
||||
E: BlockExecutorProvider + 'static,
|
||||
{
|
||||
type Item = ChainEvent<BeaconConsensusEngineEvent>;
|
||||
|
||||
@ -6,12 +6,13 @@ use futures::FutureExt;
|
||||
use reth_consensus::Consensus;
|
||||
use reth_network_p2p::{
|
||||
full_block::{FetchFullBlockFuture, FetchFullBlockRangeFuture, FullBlockClient},
|
||||
BlockClient,
|
||||
BlockClient, EthBlockClient,
|
||||
};
|
||||
use reth_primitives::{SealedBlock, SealedBlockWithSenders};
|
||||
use std::{
|
||||
cmp::{Ordering, Reverse},
|
||||
collections::{binary_heap::PeekMut, BinaryHeap, HashSet, VecDeque},
|
||||
fmt::Debug,
|
||||
sync::Arc,
|
||||
task::{Context, Poll},
|
||||
};
|
||||
@ -72,10 +73,13 @@ where
|
||||
|
||||
impl<Client> BasicBlockDownloader<Client>
|
||||
where
|
||||
Client: BlockClient + 'static,
|
||||
Client: EthBlockClient + 'static,
|
||||
{
|
||||
/// Create a new instance
|
||||
pub fn new(client: Client, consensus: Arc<dyn Consensus>) -> Self {
|
||||
pub fn new(
|
||||
client: Client,
|
||||
consensus: Arc<dyn Consensus<Client::Header, Client::Body>>,
|
||||
) -> Self {
|
||||
Self {
|
||||
full_block_client: FullBlockClient::new(client, consensus),
|
||||
inflight_full_block_requests: Vec::new(),
|
||||
@ -182,7 +186,7 @@ where
|
||||
|
||||
impl<Client> BlockDownloader for BasicBlockDownloader<Client>
|
||||
where
|
||||
Client: BlockClient + 'static,
|
||||
Client: EthBlockClient,
|
||||
{
|
||||
/// Handles incoming download actions.
|
||||
fn on_action(&mut self, action: DownloadAction) {
|
||||
|
||||
Reference in New Issue
Block a user