mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-06 10:11:44 +00:00
chore(validator_client): Read genesis time and genesis validators root from eth2_network_config (#8638)
#5019 If there is a known eth2_network_config, we read the genesis time and validators root from the config. Co-Authored-By: Jimmy Chu <898091+jimmychu0807@users.noreply.github.com>
This commit is contained in:
@@ -133,6 +133,16 @@ impl Eth2NetworkConfig {
|
||||
self.genesis_state_source != GenesisStateSource::Unknown
|
||||
}
|
||||
|
||||
/// The `genesis_time` of the genesis state.
|
||||
pub fn genesis_time<E: EthSpec>(&self) -> Result<Option<u64>, String> {
|
||||
if let GenesisStateSource::Url { genesis_time, .. } = self.genesis_state_source {
|
||||
Ok(Some(genesis_time))
|
||||
} else {
|
||||
self.get_genesis_state_from_bytes::<E>()
|
||||
.map(|state| Some(state.genesis_time()))
|
||||
}
|
||||
}
|
||||
|
||||
/// The `genesis_validators_root` of the genesis state.
|
||||
pub fn genesis_validators_root<E: EthSpec>(&self) -> Result<Option<Hash256>, String> {
|
||||
if let GenesisStateSource::Url {
|
||||
|
||||
Reference in New Issue
Block a user