fn update_epoch_slots(
        id: Pubkey,
        latest_known_root: u64,
        prev_root: &mut u64,
        slots_in_gossip: &mut BTreeSet<u64>,
        cluster_info: &RwLock<ClusterInfo>,
        completed_slots_receiver: &CompletedSlotsReceiver,
    ) {
        // If the latest known root is different, update gossip.
        let mut should_update = latest_known_root != *prev_root;
        while let Ok(completed_slots) = completed_slots_receiver.try_recv() {
            for slot in completed_slots {
                // If the newly completed slot > root, and the set did not contain this value
                // before, we should update gossip.
                if slot > latest_known_root {
                    should_update |= slots_in_gossip.insert(slot);
                }
            }
        }

        if should_update {
            // Filter out everything <= root
            if latest_known_root != *prev_root {
                *prev_root = latest_known_root;
                Self::retain_slots_greater_than_root(slots_in_gossip, latest_known_root);
            }

            cluster_info.write().unwrap().push_epoch_slots(
                id,
                latest_known_root,
                slots_in_gossip.clone(),
            );
        }
    }
// Update the gossiped structure used for the "Repairmen" repair protocol. See book
// for details.
Update the gossiped structure used for the "Repairmen" repair protocol. See book
for details.
Update the gossiped structure used for the " Repairmen " repair protocol . See book for details .
fn update_epoch_slots(
        id: Pubkey,
        latest_known_root: u64,
        prev_root: &mut u64,
        slots_in_gossip: &mut BTreeSet<u64>,
        cluster_info: &RwLock<ClusterInfo>,
        completed_slots_receiver: &CompletedSlotsReceiver,
    ) {
        // If the latest known root is different, update gossip.
        let mut should_update = latest_known_root != *prev_root;
        while let Ok(completed_slots) = completed_slots_receiver.try_recv() {
            for slot in completed_slots {
                // If the newly completed slot > root, and the set did not contain this value
                // before, we should update gossip.
                if slot > latest_known_root {
                    should_update |= slots_in_gossip.insert(slot);
                }
            }
        }
        if should_update {
            // Filter out everything <= root
            if latest_known_root != *prev_root {
                *prev_root = latest_known_root;
                Self::retain_slots_greater_than_root(slots_in_gossip, latest_known_root);
            }
            cluster_info.write().unwrap().push_epoch_slots(
                id,
                latest_known_root,
                slots_in_gossip.clone(),
            );
        }
    }
fn update_epoch_slots ( id : Pubkey , latest_known_root : u64 , prev_root : & mut u64 , slots_in_gossip : & mut BTreeSet < u64 > , cluster_info : & RwLock < ClusterInfo > , completed_slots_receiver : & CompletedSlotsReceiver , ) { // If the latest known root is different, update gossip. let mut should_update = latest_known_root != * prev_root ; while let Ok ( completed_slots ) = completed_slots_receiver . try_recv ( ) { for slot in completed_slots { // If the newly completed slot > root, and the set did not contain this value // before, we should update gossip. if slot > latest_known_root { should_update |= slots_in_gossip . insert ( slot ) ; } } } if should_update { // Filter out everything <= root if latest_known_root != * prev_root { * prev_root = latest_known_root ; Self :: retain_slots_greater_than_root ( slots_in_gossip , latest_known_root ) ; } cluster_info . write ( ) . unwrap ( ) . push_epoch_slots ( id , latest_known_root , slots_in_gossip . clone ( ) , ) ; } }
Update the gossiped structure used for the "Repairmen" repair protocol.
Update the gossiped structure used for the " Repairmen " repair protocol .
id
Pubkey
latest_known_root
u64
prev_root
&mut u64
slots_in_gossip
&mut BTreeSet<u64>
cluster_info
&RwLock<ClusterInfo>
completed_slots_receiver
&CompletedSlotsReceiver
id
Pubkey
latest_known_root
u64
prev_root
&mut u64
slots_in_gossip
&mut BTreeSet<u64>
cluster_info
&RwLock<ClusterInfo>
completed_slots_receiver
&CompletedSlotsReceiver