Skip to content

Commit

Permalink
consensus: impl parent_num_hash for Header (#1238)
Browse files Browse the repository at this point in the history
  • Loading branch information
tcoratger authored Sep 4, 2024
1 parent de56cb9 commit 68d245e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions crates/consensus/src/header.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use alloy_eips::{
eip1559::{calc_next_block_base_fee, BaseFeeParams},
eip4844::{calc_blob_gasprice, calc_excess_blob_gas},
BlockNumHash,
};
use alloy_primitives::{
b256, keccak256, Address, BlockNumber, Bloom, Bytes, Sealable, B256, B64, U256,
Expand Down Expand Up @@ -344,6 +345,11 @@ impl Header {

length
}

/// Returns the parent block's number and hash
pub const fn parent_num_hash(&self) -> BlockNumHash {
BlockNumHash { number: self.number.saturating_sub(1), hash: self.parent_hash }
}
}

impl Encodable for Header {
Expand Down

0 comments on commit 68d245e

Please sign in to comment.