Skip to content

Commit

Permalink
fix(ethereum-forks): add missing transitions_at_timestamp (#8944)
Browse files Browse the repository at this point in the history
  • Loading branch information
pythonberg1997 committed Jun 19, 2024
1 parent d0b241c commit 590356b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions crates/ethereum-forks/src/forkcondition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ impl ForkCondition {
matches!(self, Self::Timestamp(time) if timestamp >= *time)
}

/// Checks if the given block is the first block that satisfies the fork condition.
///
/// This will return false for any condition that is not timestamp based.
pub const fn transitions_at_timestamp(&self, timestamp: u64, parent_timestamp: u64) -> bool {
matches!(self, Self::Timestamp(time) if timestamp >= *time && parent_timestamp < *time)
}

/// Checks whether the fork condition is satisfied at the given head block.
///
/// This will return true if:
Expand Down

0 comments on commit 590356b

Please sign in to comment.