Make received_proposals public.

We are going to need this if we use `HoneyBadger` directly, to replace
`DynamicHoneyBadger::should_propose`.
This commit is contained in:
Andreas Fackler 2018-12-03 14:30:32 +01:00 committed by Andreas Fackler
parent 54c882234b
commit ceb416a6e1
1 changed files with 7 additions and 1 deletions

View File

@ -142,7 +142,13 @@ where
/// Returns the number of validators from which we have already received a proposal for the
/// current epoch.
pub(crate) fn received_proposals(&self) -> usize {
///
/// This can be used to find out whether our node is stalling progress. Depending on the
/// application logic, nodes may e.g. only propose when they have any pending transactions. In
/// that case, they should repeatedly call this method: if it returns _f + 1_ or more, that
/// means at least one correct node has proposed a contribution. In that case, we might want to
/// propose one, too, even if it's empty, to avoid unnecessarily delaying the next batch.
pub fn received_proposals(&self) -> usize {
self.epochs
.get(&self.epoch)
.map_or(0, EpochState::received_proposals)