Skip to content

Commit

Permalink
Merge pull request #288 from ralexstokes/context-fork
Browse files Browse the repository at this point in the history
add utility method to `Context` to get the right fork version
  • Loading branch information
ralexstokes authored Oct 17, 2023
2 parents e810cec + 12b620a commit bfb6af6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ethereum-consensus/src/state_transition/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,16 @@ impl Context {
}
}

pub fn fork_version_for(&self, fork: Fork) -> Version {
match fork {
Fork::Phase0 => self.genesis_fork_version,
Fork::Altair => self.altair_fork_version,
Fork::Bellatrix => self.bellatrix_fork_version,
Fork::Capella => self.capella_fork_version,
Fork::Deneb => self.deneb_fork_version,
}
}

pub fn genesis_time(&self) -> Result<u64, Error> {
match &self.name {
Network::Mainnet => Ok(crate::clock::MAINNET_GENESIS_TIME),
Expand Down

0 comments on commit bfb6af6

Please sign in to comment.