mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-07 16:55:46 +00:00
Avoid penalizing peers for delays during processing (#2894)
## Issue Addressed NA ## Proposed Changes We have observed occasions were under-resourced nodes will receive messages that were valid *at the time*, but later become invalidated due to long waits for a `BeaconProcessor` worker. In this PR, we will check to see if the message was valid *at the time of receipt*. If it was initially valid but invalid now, we just ignore the message without penalizing the peer. ## Additional Info NA
This commit is contained in:
@@ -112,4 +112,18 @@ pub trait SlotClock: Send + Sync + Sized + Clone {
|
||||
Duration::from_secs(duration_into_slot.as_secs() % seconds_per_slot)
|
||||
})
|
||||
}
|
||||
|
||||
/// Produces a *new* slot clock with the same configuration of `self`, except that clock is
|
||||
/// "frozen" at the `freeze_at` time.
|
||||
///
|
||||
/// This is useful for observing the slot clock at arbitrary fixed points in time.
|
||||
fn freeze_at(&self, freeze_at: Duration) -> ManualSlotClock {
|
||||
let slot_clock = ManualSlotClock::new(
|
||||
self.genesis_slot(),
|
||||
self.genesis_duration(),
|
||||
self.slot_duration(),
|
||||
);
|
||||
slot_clock.set_current_time(freeze_at);
|
||||
slot_clock
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user