Combine sync distance tolerance flags into one

This commit is contained in:
Mac L
2024-02-06 19:13:19 +11:00
parent e368397bf5
commit ee75a72b6b
6 changed files with 121 additions and 145 deletions

View File

@@ -47,15 +47,16 @@ const FUTURE_SLOT_TOLERANCE: Slot = Slot::new(1);
pub struct Config {
/// Disables publishing http api requests to all beacon nodes for select api calls.
pub disable_run_on_all: bool,
/// Sets the number of slots behind the head a beacon node is allowed to be to still be
/// considered `synced`.
pub sync_tolerance: Option<u64>,
/// Sets the size of the range of the `small` sync distance tier. This range starts immediately
/// after `sync_tolerance`.
pub small_sync_distance_modifier: Option<u64>,
/// Sets the size of the range of the `medium` sync distance tier. This range starts immediately
/// after the `small` range.
pub medium_sync_distance_modifier: Option<u64>,
pub sync_tolerances: BeaconNodeSyncDistanceTiers,
// Sets the number of slots behind the head a beacon node is allowed to be to still be
// considered `synced`.
//pub sync_tolerance: Option<u64>,
// Sets the size of the range of the `small` sync distance tier. This range starts immediately
// after `sync_tolerance`.
//pub small_sync_distance_modifier: Option<u64>,
// Sets the size of the range of the `medium` sync distance tier. This range starts immediately
// after the `small` range.
//pub medium_sync_distance_modifier: Option<u64>,
}
/// Indicates a measurement of latency between the VC and a BN.
@@ -358,7 +359,7 @@ impl<T: SlotClock, E: EthSpec> BeaconNodeFallback<T, E> {
spec: ChainSpec,
log: Logger,
) -> Self {
let distance_tiers = BeaconNodeSyncDistanceTiers::from_config(&config);
let distance_tiers = config.sync_tolerances;
Self {
candidates: Arc::new(RwLock::new(candidates)),
distance_tiers,