mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-02-14 00:45:01 -05:00
fix(op): headers above merge (#7622)
This commit is contained in:
@@ -574,6 +574,12 @@ impl ChainSpec {
|
||||
self.chain.is_optimism()
|
||||
}
|
||||
|
||||
/// Returns `true` if this chain is Optimism mainnet.
|
||||
#[inline]
|
||||
pub fn is_optimism_mainnet(&self) -> bool {
|
||||
self.chain == Chain::optimism_mainnet()
|
||||
}
|
||||
|
||||
/// Get the genesis block specification.
|
||||
///
|
||||
/// To get the header for the genesis block, use [`Self::genesis_header`] instead.
|
||||
@@ -779,6 +785,13 @@ impl ChainSpec {
|
||||
self.fork(Hardfork::Homestead).active_at_block(block_number)
|
||||
}
|
||||
|
||||
/// Convenience method to check if [Hardfork::Bedrock] is active at a given block number.
|
||||
#[cfg(feature = "optimism")]
|
||||
#[inline]
|
||||
pub fn is_bedrock_active_at_block(&self, block_number: u64) -> bool {
|
||||
self.fork(Hardfork::Bedrock).active_at_block(block_number)
|
||||
}
|
||||
|
||||
/// Creates a [`ForkFilter`] for the block described by [Head].
|
||||
pub fn fork_filter(&self, head: Head) -> ForkFilter {
|
||||
let forks = self.forks_iter().filter_map(|(_, condition)| {
|
||||
@@ -3176,4 +3189,10 @@ Post-merge hard forks (timestamp based):
|
||||
BASE_MAINNET.latest_fork_id()
|
||||
)
|
||||
}
|
||||
|
||||
#[cfg(feature = "optimism")]
|
||||
#[test]
|
||||
fn is_bedrock_active() {
|
||||
assert!(!OP_MAINNET.is_bedrock_active_at_block(1))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user