diff --git a/crates/rpc-types-eth/src/block.rs b/crates/rpc-types-eth/src/block.rs index 743c2da6e0f..79ec7e3420c 100644 --- a/crates/rpc-types-eth/src/block.rs +++ b/crates/rpc-types-eth/src/block.rs @@ -258,6 +258,11 @@ impl Header { Self { hash, inner, total_difficulty: None, size: None } } + /// Consumes the type and returns the [`Sealed`] header. + pub fn into_sealed(self) -> Sealed { + Sealed::new_unchecked(self.inner, self.hash) + } + /// Consumes the type and returns the wrapped consensus header. pub fn into_consensus(self) -> H { self.inner @@ -430,6 +435,12 @@ impl From
for alloy_consensus::Header { } } +impl From> for Sealed { + fn from(value: Header) -> Self { + value.into_sealed() + } +} + /// Error that can occur when converting other types to blocks #[derive(Clone, Copy, Debug, thiserror::Error)] pub enum BlockError { @@ -551,13 +562,12 @@ pub struct BadBlock { #[cfg(test)] mod tests { + use super::*; use alloy_primitives::{hex, keccak256, Bloom, B64}; use arbitrary::Arbitrary; use rand::Rng; use similar_asserts::assert_eq; - use super::*; - #[test] fn arbitrary_header() { let mut bytes = [0u8; 1024];