mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-14 10:22:38 +00:00
Don't use the builder network if the head is optimistic (#3412)
## Issue Addressed Resolves https://github.com/sigp/lighthouse/issues/3394 Adds a check in `is_healthy` about whether the head is optimistic when choosing whether to use the builder network. Co-authored-by: realbigsean <sean@sigmaprime.io>
This commit is contained in:
@@ -3333,7 +3333,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
pubkey,
|
||||
slot: state.slot(),
|
||||
chain_health: self
|
||||
.is_healthy()
|
||||
.is_healthy(&parent_root)
|
||||
.map_err(BlockProductionError::BeaconChain)?,
|
||||
};
|
||||
|
||||
@@ -4562,7 +4562,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
///
|
||||
/// 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.
|
||||
pub fn is_healthy(&self) -> Result<ChainHealth, Error> {
|
||||
pub fn is_healthy(&self, parent_root: &Hash256) -> Result<ChainHealth, Error> {
|
||||
// Check if the merge has been finalized.
|
||||
if let Some(finalized_hash) = self
|
||||
.canonical_head
|
||||
@@ -4577,6 +4577,17 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
return Ok(ChainHealth::PreMerge);
|
||||
};
|
||||
|
||||
// Check that the parent is NOT optimistic.
|
||||
if let Some(execution_status) = self
|
||||
.canonical_head
|
||||
.fork_choice_read_lock()
|
||||
.get_block_execution_status(parent_root)
|
||||
{
|
||||
if execution_status.is_strictly_optimistic() {
|
||||
return Ok(ChainHealth::Optimistic);
|
||||
}
|
||||
}
|
||||
|
||||
if self.config.builder_fallback_disable_checks {
|
||||
return Ok(ChainHealth::Healthy);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user