feat: add is paris active at block fn (#8872)

This commit is contained in:
Matthias Seitz
2024-06-16 19:49:26 +02:00
committed by GitHub
parent 0d55e5b8b2
commit 9b50226f56

View File

@ -842,6 +842,12 @@ impl ChainSpec {
self.fork(Hardfork::Homestead).active_at_block(block_number)
}
/// The Paris hardfork (merge) is activated via ttd, if we know the block is known then this
/// returns true if the block number is greater than or equal to the Paris (merge) block.
pub fn is_paris_active_at_block(&self, block_number: u64) -> Option<bool> {
self.paris_block_and_final_difficulty.map(|(paris_block, _)| block_number >= paris_block)
}
/// Convenience method to check if [`Hardfork::Bedrock`] is active at a given block number.
#[cfg(feature = "optimism")]
#[inline]