Skip to content

Commit

Permalink
Always log readiness if an EL is configured
Browse files Browse the repository at this point in the history
  • Loading branch information
paulhauner committed Aug 12, 2022
1 parent 4d0e819 commit d2d5fa0
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions beacon_node/beacon_chain/src/merge_readiness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,16 +130,22 @@ impl fmt::Display for MergeReadiness {
}

impl<T: BeaconChainTypes> BeaconChain<T> {
/// Returns `true` if the Bellatrix fork has occurred or will occur within
/// `MERGE_READINESS_PREPARATION_SECONDS`.
/// Returns `true` if user has an EL configured, or if the Bellatrix fork has occurred or will
/// occur within `MERGE_READINESS_PREPARATION_SECONDS`.
pub fn is_time_to_prepare_for_bellatrix(&self, current_slot: Slot) -> bool {
if let Some(bellatrix_epoch) = self.spec.bellatrix_fork_epoch {
let bellatrix_slot = bellatrix_epoch.start_slot(T::EthSpec::slots_per_epoch());
let merge_readiness_preparation_slots =
MERGE_READINESS_PREPARATION_SECONDS / self.spec.seconds_per_slot;

// Return `true` if Bellatrix has happened or is within the preparation time.
current_slot + merge_readiness_preparation_slots > bellatrix_slot
if self.execution_layer.is_some() {
// The user has already configured an execution layer, start checking for readiness
// right away.
true
} else {
// Return `true` if Bellatrix has happened or is within the preparation time.
current_slot + merge_readiness_preparation_slots > bellatrix_slot
}
} else {
// The Bellatrix fork epoch has not been defined yet, no need to prepare.
false
Expand Down

0 comments on commit d2d5fa0

Please sign in to comment.