feat: introduce helper alias type (#14058)

This commit is contained in:
Matthias Seitz
2025-01-29 11:14:45 +01:00
committed by GitHub
parent fd7074eac2
commit ed593ae257
3 changed files with 6 additions and 3 deletions

View File

@ -1,5 +1,5 @@
mod sealed;
pub use sealed::{Header, SealedHeader};
pub use sealed::{Header, SealedHeader, SealedHeaderFor};
mod error;
pub use error::HeaderError;

View File

@ -1,4 +1,4 @@
use crate::{sync::OnceLock, InMemorySize};
use crate::{sync::OnceLock, InMemorySize, NodePrimitives};
pub use alloy_consensus::Header;
use alloy_consensus::Sealed;
use alloy_eips::{eip1898::BlockWithParent, BlockNumHash};
@ -8,6 +8,9 @@ use bytes::BufMut;
use core::mem;
use derive_more::{AsRef, Deref};
/// Type alias for [`SealedHeader`] generic over the `BlockHeader` type of [`NodePrimitives`].
pub type SealedHeaderFor<N> = SealedHeader<<N as NodePrimitives>::BlockHeader>;
/// Seals the header with the block hash.
///
/// This type uses lazy sealing to avoid hashing the header until it is needed:

View File

@ -120,7 +120,7 @@ pub mod sync;
/// Common header types
pub mod header;
pub use header::{Header, HeaderError, SealedHeader};
pub use header::{Header, HeaderError, SealedHeader, SealedHeaderFor};
/// Bincode-compatible serde implementations for common abstracted types in Reth.
///