mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-16 19:32:55 +00:00
Replace INTERVALS_PER_SLOT with explicit slot component times (#7944)
https://github.com/ethereum/consensus-specs/pull/4476 Co-Authored-By: Barnabas Busa <barnabas.busa@ethereum.org> Co-Authored-By: Eitan Seri- Levi <eserilev@gmail.com> Co-Authored-By: Eitan Seri-Levi <eserilev@ucsc.edu> Co-Authored-By: Michael Sproul <michaelsproul@users.noreply.github.com> Co-Authored-By: Michael Sproul <michael@sigmaprime.io>
This commit is contained in:
@@ -862,9 +862,11 @@ impl<T: BeaconChainTypes> NetworkService<T> {
|
||||
self.next_digest_update = Box::pin(next_digest_delay(&self.beacon_chain).into());
|
||||
|
||||
// Set the next_unsubscribe delay.
|
||||
let epoch_duration =
|
||||
self.beacon_chain.spec.seconds_per_slot * T::EthSpec::slots_per_epoch();
|
||||
let unsubscribe_delay = Duration::from_secs(UNSUBSCRIBE_DELAY_EPOCHS * epoch_duration);
|
||||
let unsubscribe_delay = Duration::from_secs(
|
||||
UNSUBSCRIBE_DELAY_EPOCHS
|
||||
* self.beacon_chain.spec.get_slot_duration().as_secs()
|
||||
* T::EthSpec::slots_per_epoch(),
|
||||
);
|
||||
|
||||
// Update the `next_topic_subscriptions` timer if the next change in the fork digest is known.
|
||||
self.next_topic_subscriptions =
|
||||
@@ -915,7 +917,7 @@ fn next_topic_subscriptions_delay<T: BeaconChainTypes>(
|
||||
) -> Option<tokio::time::Sleep> {
|
||||
if let Some((_, duration_to_epoch)) = beacon_chain.duration_to_next_digest() {
|
||||
let duration_to_subscription = duration_to_epoch.saturating_sub(Duration::from_secs(
|
||||
beacon_chain.spec.seconds_per_slot * SUBSCRIBE_DELAY_SLOTS,
|
||||
beacon_chain.spec.get_slot_duration().as_secs() * SUBSCRIBE_DELAY_SLOTS,
|
||||
));
|
||||
if !duration_to_subscription.is_zero() {
|
||||
return Some(tokio::time::sleep(duration_to_subscription));
|
||||
|
||||
Reference in New Issue
Block a user