Add HoneyBadger::skip_to_epoch.

This commit is contained in:
Andreas Fackler 2019-07-23 10:48:00 +02:00 committed by Andreas Fackler
parent 059e4471cb
commit 8122a10179
1 changed files with 10 additions and 0 deletions

View File

@ -131,6 +131,16 @@ where
self.epoch
}
/// Skips all epochs before the specified one.
///
/// This must only be called if it is guaranteed to be called in all instances that have not
/// progressed to that epoch yet. Otherwise an instance can be left behind in a skipped epoch.
pub fn skip_to_epoch(&mut self, epoch: u64) {
while self.epoch < epoch {
self.update_epoch();
}
}
/// Returns the number of validators from which we have already received a proposal for the
/// current epoch.
///