Skip to content

Commit

Permalink
chore: add num hash with parent (alloy-rs#1652)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Nov 16, 2024
1 parent b959ea6 commit cc63949
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions crates/consensus/src/block/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::constants::{EMPTY_OMMER_ROOT_HASH, EMPTY_ROOT_HASH};
use alloc::vec::Vec;
use alloy_eips::{
eip1559::{calc_next_block_base_fee, BaseFeeParams},
eip1898::BlockWithParent,
eip4844::{calc_blob_gasprice, calc_excess_blob_gas},
merge::ALLOWED_FUTURE_BLOCK_TIME_SECONDS,
BlockNumHash,
Expand Down Expand Up @@ -319,6 +320,13 @@ impl Header {
BlockNumHash { number: self.number, hash: self.hash_slow() }
}

/// Returns the block's number and hash with the parent hash.
///
/// Note: this hashes the header.
pub fn num_hash_with_parent_slow(&self) -> BlockWithParent {
BlockWithParent::new(self.parent_hash, self.num_hash_slow())
}

/// Checks if the block's difficulty is set to zero, indicating a Proof-of-Stake header.
///
/// This function is linked to EIP-3675, proposing the consensus upgrade to Proof-of-Stake:
Expand Down

0 comments on commit cc63949

Please sign in to comment.