pub(super) fn next_finalized<'a>(&mut self, state: &'a State<C>) -> Option<&'a C::Hash> {
        let start_time = Timestamp::now();
        let candidate = self.next_candidate(state)?;
        // For `lvl` → ∞, the quorum converges to a fixed value. After level 63, it is closer
        // to that limit than 1/2^-63. This won't make a difference in practice, so there is no
        // point looking for higher summits.
        let mut target_lvl = 63;
        while target_lvl > 0 {
            trace!(%target_lvl, "looking for summit");
            let lvl = self.find_summit(target_lvl, candidate, state);
            if lvl == target_lvl {
                self.last_finalized = Some(*candidate);
                let elapsed = start_time.elapsed();
                trace!(%elapsed, "found finalized block");
                return Some(candidate);
            }
            // The required quorum increases with decreasing level, so choosing `target_lvl`
            // greater than `lvl` would always yield a summit of level `lvl` or lower.
            target_lvl = lvl;
        }
        let elapsed = start_time.elapsed();
        trace!(%elapsed, "found no finalized block");
        None
    }
/// Returns the next block, if any has been finalized since the last call.
Returns the next block, if any has been finalized since the last call.
Returns the next block if any has been finalized since the last call .
pub(super) fn next_finalized<'a>(&mut self, state: &'a State<C>) -> Option<&'a C::Hash> {
        let start_time = Timestamp::now();
        let candidate = self.next_candidate(state)?;
        // For `lvl` → ∞, the quorum converges to a fixed value. After level 63, it is closer
        // to that limit than 1/2^-63. This won't make a difference in practice, so there is no
        // point looking for higher summits.
        let mut target_lvl = 63;
        while target_lvl > 0 {
            trace!(%target_lvl, "looking for summit");
            let lvl = self.find_summit(target_lvl, candidate, state);
            if lvl == target_lvl {
                self.last_finalized = Some(*candidate);
                let elapsed = start_time.elapsed();
                trace!(%elapsed, "found finalized block");
                return Some(candidate);
            }
            // The required quorum increases with decreasing level, so choosing `target_lvl`
            // greater than `lvl` would always yield a summit of level `lvl` or lower.
            target_lvl = lvl;
        }
        let elapsed = start_time.elapsed();
        trace!(%elapsed, "found no finalized block");
        None
    }
pub ( super ) fn next_finalized < ' a > ( & mut self , state : & ' a State < C > ) -> Option < & ' a C :: Hash > { let start_time = Timestamp :: now ( ) ; let candidate = self . next_candidate ( state ) ? ; // For `lvl` → ∞, the quorum converges to a fixed value. After level 63, it is closer // to that limit than 1/2^-63. This won't make a difference in practice, so there is no // point looking for higher summits. let mut target_lvl = 63 ; while target_lvl > 0 { trace ! ( target_lvl " " ) ; let lvl = self . find_summit ( target_lvl , candidate , state ) ; if lvl == target_lvl { self . last_finalized = Some ( * candidate ) ; let elapsed = start_time . elapsed ( ) ; trace ! ( elapsed " " ) ; return Some ( candidate ) ; } // The required quorum increases with decreasing level, so choosing `target_lvl` // greater than `lvl` would always yield a summit of level `lvl` or lower. target_lvl = lvl ; } let elapsed = start_time . elapsed ( ) ; trace ! ( elapsed " " ) ; None }
Returns the next block, if any has been finalized since the last call.
Returns the next block if any has been finalized since the last call .
&mut self
state
&'a State<C>
&mut self
state
&'a State<C>