diff --git a/crates/rpc-types-engine/src/forkchoice.rs b/crates/rpc-types-engine/src/forkchoice.rs index 6c13d2856ba..5d4b6bfabe1 100644 --- a/crates/rpc-types-engine/src/forkchoice.rs +++ b/crates/rpc-types-engine/src/forkchoice.rs @@ -31,6 +31,12 @@ pub struct ForkchoiceState { } impl ForkchoiceState { + /// Creates a new [ForkchoiceState] with head, safe, and finalized block hashes set to the given + /// hash. + pub const fn same_hash(hash: B256) -> Self { + Self { head_block_hash: hash, safe_block_hash: hash, finalized_block_hash: hash } + } + /// Returns the `head_block_hash`, only if it is not [`B256::ZERO`], otherwise this returns /// [`None`]. #[inline]