avoid relocking head during builder health check (#4323)
## Issue Addressed #4314 ## Proposed Changes avoid relocking head during builder health check ## Additional Info NA
This commit is contained in:
parent
ead4e60a76
commit
23b06aa51e
@ -5699,13 +5699,9 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
|||||||
/// Since we are likely calling this during the slot we are going to propose in, don't take into
|
/// Since we are likely calling this during the slot we are going to propose in, don't take into
|
||||||
/// account the current slot when accounting for skips.
|
/// account the current slot when accounting for skips.
|
||||||
pub fn is_healthy(&self, parent_root: &Hash256) -> Result<ChainHealth, Error> {
|
pub fn is_healthy(&self, parent_root: &Hash256) -> Result<ChainHealth, Error> {
|
||||||
|
let cached_head = self.canonical_head.cached_head();
|
||||||
// Check if the merge has been finalized.
|
// Check if the merge has been finalized.
|
||||||
if let Some(finalized_hash) = self
|
if let Some(finalized_hash) = cached_head.forkchoice_update_parameters().finalized_hash {
|
||||||
.canonical_head
|
|
||||||
.cached_head()
|
|
||||||
.forkchoice_update_parameters()
|
|
||||||
.finalized_hash
|
|
||||||
{
|
|
||||||
if ExecutionBlockHash::zero() == finalized_hash {
|
if ExecutionBlockHash::zero() == finalized_hash {
|
||||||
return Ok(ChainHealth::PreMerge);
|
return Ok(ChainHealth::PreMerge);
|
||||||
}
|
}
|
||||||
@ -5732,17 +5728,13 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
|||||||
|
|
||||||
// Check slots at the head of the chain.
|
// Check slots at the head of the chain.
|
||||||
let prev_slot = current_slot.saturating_sub(Slot::new(1));
|
let prev_slot = current_slot.saturating_sub(Slot::new(1));
|
||||||
let head_skips = prev_slot.saturating_sub(self.canonical_head.cached_head().head_slot());
|
let head_skips = prev_slot.saturating_sub(cached_head.head_slot());
|
||||||
let head_skips_check = head_skips.as_usize() <= self.config.builder_fallback_skips;
|
let head_skips_check = head_skips.as_usize() <= self.config.builder_fallback_skips;
|
||||||
|
|
||||||
// Check if finalization is advancing.
|
// Check if finalization is advancing.
|
||||||
let current_epoch = current_slot.epoch(T::EthSpec::slots_per_epoch());
|
let current_epoch = current_slot.epoch(T::EthSpec::slots_per_epoch());
|
||||||
let epochs_since_finalization = current_epoch.saturating_sub(
|
let epochs_since_finalization =
|
||||||
self.canonical_head
|
current_epoch.saturating_sub(cached_head.finalized_checkpoint().epoch);
|
||||||
.cached_head()
|
|
||||||
.finalized_checkpoint()
|
|
||||||
.epoch,
|
|
||||||
);
|
|
||||||
let finalization_check = epochs_since_finalization.as_usize()
|
let finalization_check = epochs_since_finalization.as_usize()
|
||||||
<= self.config.builder_fallback_epochs_since_finalization;
|
<= self.config.builder_fallback_epochs_since_finalization;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user