fn estimated_current_slot(&self) -> Slot {
        let mut recent_slots: Vec<Slot> = self.0.read().unwrap().iter().cloned().collect();
        assert!(!recent_slots.is_empty());
        recent_slots.sort_unstable();

        // Validators can broadcast invalid blocks that are far in the future
        // so check if the current slot is in line with the recent progression.
        let max_index = recent_slots.len() - 1;
        let median_index = max_index / 2;
        let median_recent_slot = recent_slots[median_index];
        let expected_current_slot = median_recent_slot + (max_index - median_index) as u64;
        let max_reasonable_current_slot = expected_current_slot + MAX_SLOT_SKIP_DISTANCE;

        // Return the highest slot that doesn't exceed what we believe is a
        // reasonable slot.
        recent_slots
            .into_iter()
            .rev()
            .find(|slot| *slot <= max_reasonable_current_slot)
            .unwrap()
    }
// Estimate the current slot from recent slot notifications.
Estimate the current slot from recent slot notifications.
Estimate the current slot from recent slot notifications .
fn estimated_current_slot(&self) -> Slot {
        let mut recent_slots: Vec<Slot> = self.0.read().unwrap().iter().cloned().collect();
        assert!(!recent_slots.is_empty());
        recent_slots.sort_unstable();
        // Validators can broadcast invalid blocks that are far in the future
        // so check if the current slot is in line with the recent progression.
        let max_index = recent_slots.len() - 1;
        let median_index = max_index / 2;
        let median_recent_slot = recent_slots[median_index];
        let expected_current_slot = median_recent_slot + (max_index - median_index) as u64;
        let max_reasonable_current_slot = expected_current_slot + MAX_SLOT_SKIP_DISTANCE;
        // Return the highest slot that doesn't exceed what we believe is a
        // reasonable slot.
        recent_slots
            .into_iter()
            .rev()
            .find(|slot| *slot <= max_reasonable_current_slot)
            .unwrap()
    }
fn estimated_current_slot ( & self ) -> Slot { let mut recent_slots : Vec < Slot > = self . 0 . read ( ) . unwrap ( ) . iter ( ) . cloned ( ) . collect ( ) ; assert ! ( recent_slots is_empty ( ) ) ; recent_slots . sort_unstable ( ) ; // Validators can broadcast invalid blocks that are far in the future // so check if the current slot is in line with the recent progression. let max_index = recent_slots . len ( ) - 1 ; let median_index = max_index / 2 ; let median_recent_slot = recent_slots [ median_index ] ; let expected_current_slot = median_recent_slot + ( max_index - median_index ) as u64 ; let max_reasonable_current_slot = expected_current_slot + MAX_SLOT_SKIP_DISTANCE ; // Return the highest slot that doesn't exceed what we believe is a // reasonable slot. recent_slots . into_iter ( ) . rev ( ) . find ( | slot | * slot <= max_reasonable_current_slot ) . unwrap ( ) }
Estimate the current slot from recent slot notifications.
Estimate the current slot from recent slot notifications .
&self