Skip to content

Commit

Permalink
feat: add helper to forkchoice state (#1903)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Jan 9, 2025
1 parent b9b2da0 commit 4fb600d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions crates/rpc-types-engine/src/forkchoice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 4fb600d

Please sign in to comment.