From f0530a76bf633faa4c6670fd286b9e1b98837842 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Wed, 12 Feb 2025 17:37:26 +0100 Subject: [PATCH] feat: add Block::seal (#14451) --- crates/primitives-traits/src/block/mod.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/primitives-traits/src/block/mod.rs b/crates/primitives-traits/src/block/mod.rs index 37b16048e..fa6bc2c3a 100644 --- a/crates/primitives-traits/src/block/mod.rs +++ b/crates/primitives-traits/src/block/mod.rs @@ -84,6 +84,11 @@ pub trait Block: SealedBlock::new_unchecked(self, hash) } + /// Creates the [`SealedBlock`] from the block's parts without calculating the hash upfront. + fn seal(self) -> SealedBlock { + SealedBlock::new_unhashed(self) + } + /// Calculate the header hash and seal the block so that it can't be changed. fn seal_slow(self) -> SealedBlock { SealedBlock::seal_slow(self)