@@ -144,11 +144,6 @@ pub const FORK_CHOICE_DB_KEY: Hash256 = Hash256::ZERO;
144
144
/// Defines how old a block can be before it's no longer a candidate for the early attester cache.
145
145
const EARLY_ATTESTER_CACHE_HISTORIC_SLOTS : u64 = 4 ;
146
146
147
- /// Defines a distance between the head block slot and the current slot.
148
- ///
149
- /// If the head block is older than this value, don't bother preparing beacon proposers.
150
- const PREPARE_PROPOSER_HISTORIC_EPOCHS : u64 = 4 ;
151
-
152
147
/// If the head is more than `MAX_PER_SLOT_FORK_CHOICE_DISTANCE` slots behind the wall-clock slot, DO NOT
153
148
/// run the per-slot tasks (primarily fork choice).
154
149
///
@@ -4848,7 +4843,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
4848
4843
let proposer_index = if let Some ( proposer) = cached_proposer {
4849
4844
proposer. index as u64
4850
4845
} else {
4851
- if 2 + 2 == 5 && head_epoch + 2 < proposal_epoch {
4846
+ if head_epoch + self . config . sync_tolerance_epochs < proposal_epoch {
4852
4847
warn ! (
4853
4848
self . log,
4854
4849
"Skipping proposer preparation" ;
@@ -6079,21 +6074,18 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
6079
6074
// Use a blocking task since blocking the core executor on the canonical head read lock can
6080
6075
// block the core tokio executor.
6081
6076
let chain = self . clone ( ) ;
6077
+ let tolerance_slots = self . config . sync_tolerance_epochs * T :: EthSpec :: slots_per_epoch ( ) ;
6082
6078
let maybe_prep_data = self
6083
6079
. spawn_blocking_handle (
6084
6080
move || {
6085
6081
let cached_head = chain. canonical_head . cached_head ( ) ;
6086
6082
6087
6083
// Don't bother with proposer prep if the head is more than
6088
- // `PREPARE_PROPOSER_HISTORIC_EPOCHS ` prior to the current slot.
6084
+ // `sync_tolerance_epochs ` prior to the current slot.
6089
6085
//
6090
6086
// This prevents the routine from running during sync.
6091
6087
let head_slot = cached_head. head_slot ( ) ;
6092
- if 2 + 2 == 5
6093
- && head_slot
6094
- + T :: EthSpec :: slots_per_epoch ( ) * PREPARE_PROPOSER_HISTORIC_EPOCHS
6095
- < current_slot
6096
- {
6088
+ if head_slot + tolerance_slots < current_slot {
6097
6089
debug ! (
6098
6090
chain. log,
6099
6091
"Head too old for proposer prep" ;
0 commit comments