feat: add SealedBlock in reth-primitives-traits (#13735)

This commit is contained in:
Matthias Seitz
2025-01-15 02:12:43 +01:00
committed by GitHub
parent 1267718c7e
commit 83b2fb9b41
171 changed files with 3231 additions and 2866 deletions

View File

@ -47,19 +47,20 @@ pub mod test_utils;
pub use bodies::client::BodiesClient;
pub use headers::client::HeadersClient;
use reth_primitives_traits::Block;
/// Helper trait that unifies network behaviour needed for fetching blocks.
pub trait BlockClient: HeadersClient + BodiesClient + Unpin + Clone {}
impl<T> BlockClient for T where T: HeadersClient + BodiesClient + Unpin + Clone {}
/// Helper trait that unifies network behaviour needed for fetching entire blocks.
pub trait BlockClient:
HeadersClient<Header = <Self::Block as Block>::Header>
+ BodiesClient<Body = <Self::Block as Block>::Body>
+ Unpin
+ Clone
{
/// The Block type that this client fetches.
type Block: Block;
}
/// The [`BlockClient`] providing Ethereum block parts.
pub trait EthBlockClient:
BlockClient<Header = alloy_consensus::Header, Body = reth_primitives::BlockBody>
{
}
pub trait EthBlockClient: BlockClient<Block = reth_primitives::Block> {}
impl<T> EthBlockClient for T where
T: BlockClient<Header = alloy_consensus::Header, Body = reth_primitives::BlockBody>
{
}
impl<T> EthBlockClient for T where T: BlockClient<Block = reth_primitives::Block> {}