diff --git a/crates/consensus/beacon/src/engine/mod.rs b/crates/consensus/beacon/src/engine/mod.rs index 0e9f91ac6..ede7e02f9 100644 --- a/crates/consensus/beacon/src/engine/mod.rs +++ b/crates/consensus/beacon/src/engine/mod.rs @@ -11,6 +11,7 @@ use reth_network_p2p::{ bodies::client::BodiesClient, headers::client::HeadersClient, sync::{NetworkSyncUpdater, SyncState}, + BlockClient, }; use reth_payload_builder::PayloadBuilderHandle; use reth_payload_primitives::{PayloadAttributes, PayloadBuilderAttributes}; @@ -171,7 +172,7 @@ type PendingForkchoiceUpdate = pub struct BeaconConsensusEngine where DB: Database, - Client: HeadersClient + BodiesClient, + Client: BlockClient, BT: BlockchainTreeEngine + BlockReader + BlockIdReader diff --git a/crates/consensus/beacon/src/engine/sync.rs b/crates/consensus/beacon/src/engine/sync.rs index aa1c9aa66..4c1904e3e 100644 --- a/crates/consensus/beacon/src/engine/sync.rs +++ b/crates/consensus/beacon/src/engine/sync.rs @@ -11,6 +11,7 @@ use reth_network_p2p::{ bodies::client::BodiesClient, full_block::{FetchFullBlockFuture, FetchFullBlockRangeFuture, FullBlockClient}, headers::client::HeadersClient, + BlockClient, }; use reth_primitives::{BlockNumber, SealedBlock, B256}; use reth_stages_api::{ControlFlow, Pipeline, PipelineError, PipelineTarget, PipelineWithResult}; @@ -35,7 +36,7 @@ use tracing::trace; pub(crate) struct EngineSyncController where DB: Database, - Client: HeadersClient + BodiesClient, + Client: BlockClient, { /// A downloader that can download full blocks from the network. full_block_client: FullBlockClient, diff --git a/crates/net/p2p/src/full_block.rs b/crates/net/p2p/src/full_block.rs index 724290ec3..57efba67b 100644 --- a/crates/net/p2p/src/full_block.rs +++ b/crates/net/p2p/src/full_block.rs @@ -3,6 +3,7 @@ use crate::{ bodies::client::{BodiesClient, SingleBodyRequest}, error::PeerRequestResult, headers::client::{HeadersClient, SingleHeaderRequest}, + BlockClient, }; use reth_consensus::{Consensus, ConsensusError}; use reth_eth_wire_types::HeadersDirection; @@ -41,7 +42,7 @@ impl FullBlockClient { impl FullBlockClient where - Client: BodiesClient + HeadersClient + Clone, + Client: BlockClient, { /// Returns a future that fetches the [`SealedBlock`] for the given hash. /// @@ -105,7 +106,7 @@ where #[must_use = "futures do nothing unless polled"] pub struct FetchFullBlockFuture where - Client: BodiesClient + HeadersClient, + Client: BlockClient, { client: Client, hash: B256, @@ -116,7 +117,7 @@ where impl FetchFullBlockFuture where - Client: BodiesClient + HeadersClient, + Client: BlockClient, { /// Returns the hash of the block being requested. pub const fn hash(&self) -> &B256 { @@ -168,7 +169,7 @@ where impl Future for FetchFullBlockFuture where - Client: BodiesClient + HeadersClient + Unpin + 'static, + Client: BlockClient + 'static, { type Output = SealedBlock; @@ -229,7 +230,7 @@ where impl Debug for FetchFullBlockFuture where - Client: BodiesClient + HeadersClient, + Client: BlockClient, { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("FetchFullBlockFuture") @@ -242,7 +243,7 @@ where struct FullBlockRequest where - Client: BodiesClient + HeadersClient, + Client: BlockClient, { header: Option::Output>>, body: Option::Output>>, @@ -250,7 +251,7 @@ where impl FullBlockRequest where - Client: BodiesClient + HeadersClient, + Client: BlockClient, { fn poll(&mut self, cx: &mut Context<'_>) -> Poll { if let Some(fut) = Pin::new(&mut self.header).as_pin_mut() { @@ -362,7 +363,7 @@ fn ensure_valid_body_response( #[allow(missing_debug_implementations)] pub struct FetchFullBlockRangeFuture where - Client: BodiesClient + HeadersClient, + Client: BlockClient, { /// The client used to fetch headers and bodies. client: Client, @@ -384,7 +385,7 @@ where impl FetchFullBlockRangeFuture where - Client: BodiesClient + HeadersClient, + Client: BlockClient, { /// Returns the block hashes for the given range, if they are available. pub fn range_block_hashes(&self) -> Option> { @@ -539,7 +540,7 @@ where impl Future for FetchFullBlockRangeFuture where - Client: BodiesClient + HeadersClient + Unpin + 'static, + Client: BlockClient + 'static, { type Output = Vec; @@ -638,7 +639,7 @@ where /// on which future successfully returned. struct FullBlockRangeRequest where - Client: BodiesClient + HeadersClient, + Client: BlockClient, { headers: Option<::Output>, bodies: Option<::Output>, @@ -646,7 +647,7 @@ where impl FullBlockRangeRequest where - Client: BodiesClient + HeadersClient, + Client: BlockClient, { fn poll(&mut self, cx: &mut Context<'_>) -> Poll { if let Some(fut) = Pin::new(&mut self.headers).as_pin_mut() {