mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-03 00:31:50 +00:00
Fork schedule api (#2525)
## Issue Addressed Resolves #2524 ## Proposed Changes - Return all known forks in the `/config/fork_schedule`, previously returned only the head of the chain's fork. - Deleted the `StateId::head` method because it was only previously used in this endpoint. Co-authored-by: realbigsean <seananderson33@gmail.com>
This commit is contained in:
@@ -237,6 +237,19 @@ impl ChainSpec {
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns a full `Fork` struct for a given `ForkName` or `None` if the fork does not yet have
|
||||
/// an activation epoch.
|
||||
pub fn fork_for_name(&self, fork_name: ForkName) -> Option<Fork> {
|
||||
let previous_fork_name = fork_name.previous_fork().unwrap_or(ForkName::Base);
|
||||
let epoch = self.fork_epoch(fork_name)?;
|
||||
|
||||
Some(Fork {
|
||||
previous_version: self.fork_version_for_name(previous_fork_name),
|
||||
current_version: self.fork_version_for_name(fork_name),
|
||||
epoch,
|
||||
})
|
||||
}
|
||||
|
||||
/// Get the domain number, unmodified by the fork.
|
||||
///
|
||||
/// Spec v0.12.1
|
||||
|
||||
Reference in New Issue
Block a user