mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-14 10:22:38 +00:00
Altair networking (#2300)
## Issue Addressed Resolves #2278 ## Proposed Changes Implements the networking components for the Altair hard fork https://github.com/ethereum/eth2.0-specs/blob/dev/specs/altair/p2p-interface.md ## Additional Info This PR acts as the base branch for networking changes and tracks https://github.com/sigp/lighthouse/pull/2279 . Changes to gossip, rpc and discovery can be separate PRs to be merged here for ease of review. Co-authored-by: realbigsean <seananderson33@gmail.com>
This commit is contained in:
@@ -3324,14 +3324,21 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
// therefore use the genesis slot.
|
||||
let slot = self.slot().unwrap_or(self.spec.genesis_slot);
|
||||
|
||||
self.spec.enr_fork_id(slot, self.genesis_validators_root)
|
||||
self.spec
|
||||
.enr_fork_id::<T::EthSpec>(slot, self.genesis_validators_root)
|
||||
}
|
||||
|
||||
/// Calculates the `Duration` to the next fork, if one exists.
|
||||
pub fn duration_to_next_fork(&self) -> Option<Duration> {
|
||||
let epoch = self.spec.next_fork_epoch()?;
|
||||
/// Calculates the `Duration` to the next fork if it exists and returns it
|
||||
/// with it's corresponding `ForkName`.
|
||||
pub fn duration_to_next_fork(&self) -> Option<(ForkName, Duration)> {
|
||||
// If we are unable to read the slot clock we assume that it is prior to genesis and
|
||||
// therefore use the genesis slot.
|
||||
let slot = self.slot().unwrap_or(self.spec.genesis_slot);
|
||||
|
||||
let (fork_name, epoch) = self.spec.next_fork_epoch::<T::EthSpec>(slot)?;
|
||||
self.slot_clock
|
||||
.duration_to_slot(epoch.start_slot(T::EthSpec::slots_per_epoch()))
|
||||
.map(|duration| (fork_name, duration))
|
||||
}
|
||||
|
||||
pub fn dump_as_dot<W: Write>(&self, output: &mut W) {
|
||||
|
||||
Reference in New Issue
Block a user