@@ -144,11 +144,6 @@ pub const FORK_CHOICE_DB_KEY: Hash256 = Hash256::ZERO;
144144/// Defines how old a block can be before it's no longer a candidate for the early attester cache.
145145const EARLY_ATTESTER_CACHE_HISTORIC_SLOTS : u64 = 4 ;
146146
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-
152147/// If the head is more than `MAX_PER_SLOT_FORK_CHOICE_DISTANCE` slots behind the wall-clock slot, DO NOT
153148/// run the per-slot tasks (primarily fork choice).
154149///
@@ -4848,7 +4843,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
48484843 let proposer_index = if let Some ( proposer) = cached_proposer {
48494844 proposer. index as u64
48504845 } else {
4851- if head_epoch + 2 < proposal_epoch {
4846+ if head_epoch + self . config . sync_tolerance_epochs < proposal_epoch {
48524847 warn ! (
48534848 self . log,
48544849 "Skipping proposer preparation" ;
@@ -6079,19 +6074,18 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
60796074 // Use a blocking task since blocking the core executor on the canonical head read lock can
60806075 // block the core tokio executor.
60816076 let chain = self . clone ( ) ;
6077+ let tolerance_slots = self . config . sync_tolerance_epochs * T :: EthSpec :: slots_per_epoch ( ) ;
60826078 let maybe_prep_data = self
60836079 . spawn_blocking_handle (
60846080 move || {
60856081 let cached_head = chain. canonical_head . cached_head ( ) ;
60866082
60876083 // 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.
60896085 //
60906086 // This prevents the routine from running during sync.
60916087 let head_slot = cached_head. head_slot ( ) ;
6092- if head_slot + T :: EthSpec :: slots_per_epoch ( ) * PREPARE_PROPOSER_HISTORIC_EPOCHS
6093- < current_slot
6094- {
6088+ if head_slot + tolerance_slots < current_slot {
60956089 debug ! (
60966090 chain. log,
60976091 "Head too old for proposer prep" ;
0 commit comments