Skip to content
Prev Previous commit
Next Next commit
add assert to constructor
  • Loading branch information
maciejnems committed Dec 29, 2022
commit 699b9650df443dcb83a5b975ceaede9b359874d8
6 changes: 6 additions & 0 deletions finality-aleph/src/sync/ticker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ impl Ticker {
/// Retruns new Ticker struct. Behaves as if last tick happened during creation of TIcker.
/// Requires `max_timeout` >= `min_timeout`.
pub fn new(max_timeout: Duration, min_timeout: Duration) -> Self {
assert!(
max_timeout >= min_timeout,
"Max timoeut ({:?}) must be bigger then min timeout ({:?}) in Ticker",
max_timeout,
min_timeout
);
Self {
last_tick: Instant::now(),
current_timeout: max_timeout,
Expand Down