fn retain_peer_snapshot_hashes_with_highest_incremental_snapshot_slot(
        peer_snapshot_hashes: &mut Vec<PeerSnapshotHash>,
    ) {
        let mut highest_incremental_snapshot_hash: Option<(Slot, Hash)> = None;
        peer_snapshot_hashes.iter().for_each(|peer_snapshot_hash| {
            if let Some(incremental_snapshot_hash) = peer_snapshot_hash.snapshot_hash.incr.as_ref()
            {
                if highest_incremental_snapshot_hash.is_none()
                    || incremental_snapshot_hash.0 > highest_incremental_snapshot_hash.unwrap().0
                {
                    highest_incremental_snapshot_hash = Some(*incremental_snapshot_hash);
                }
            };
        });

        peer_snapshot_hashes.retain(|peer_snapshot_hash| {
            peer_snapshot_hash.snapshot_hash.incr == highest_incremental_snapshot_hash
        });

        trace!(
            "retain peer snapshot hashes with highest incremental snapshot slot: {:?}",
            &peer_snapshot_hashes
        );
    }
/// Retain the peer snapshot hashes with the highest incremental snapshot slot
Retain the peer snapshot hashes with the highest incremental snapshot slot
Retain the peer snapshot hashes with the highest incremental snapshot slot
fn retain_peer_snapshot_hashes_with_highest_incremental_snapshot_slot(
        peer_snapshot_hashes: &mut Vec<PeerSnapshotHash>,
    ) {
        let mut highest_incremental_snapshot_hash: Option<(Slot, Hash)> = None;
        peer_snapshot_hashes.iter().for_each(|peer_snapshot_hash| {
            if let Some(incremental_snapshot_hash) = peer_snapshot_hash.snapshot_hash.incr.as_ref()
            {
                if highest_incremental_snapshot_hash.is_none()
                    || incremental_snapshot_hash.0 > highest_incremental_snapshot_hash.unwrap().0
                {
                    highest_incremental_snapshot_hash = Some(*incremental_snapshot_hash);
                }
            };
        });
        peer_snapshot_hashes.retain(|peer_snapshot_hash| {
            peer_snapshot_hash.snapshot_hash.incr == highest_incremental_snapshot_hash
        });
        trace!(
            "retain peer snapshot hashes with highest incremental snapshot slot: {:?}",
            &peer_snapshot_hashes
        );
    }
fn retain_peer_snapshot_hashes_with_highest_incremental_snapshot_slot ( peer_snapshot_hashes : & mut Vec < PeerSnapshotHash > , ) { let mut highest_incremental_snapshot_hash : Option < ( Slot , Hash ) > = None ; peer_snapshot_hashes . iter ( ) . for_each ( | peer_snapshot_hash | { if let Some ( incremental_snapshot_hash ) = peer_snapshot_hash . snapshot_hash . incr . as_ref ( ) { if highest_incremental_snapshot_hash . is_none ( ) || incremental_snapshot_hash . 0 > highest_incremental_snapshot_hash . unwrap ( ) . 0 { highest_incremental_snapshot_hash = Some ( * incremental_snapshot_hash ) ; } } ; } ) ; peer_snapshot_hashes . retain ( | peer_snapshot_hash | { peer_snapshot_hash . snapshot_hash . incr == highest_incremental_snapshot_hash } ) ; trace ! ( " " peer_snapshot_hashes ) ; }
Retain the peer snapshot hashes with the highest incremental snapshot slot
Retain the peer snapshot hashes with the highest incremental snapshot slot
peer_snapshot_hashes
&mut Vec<PeerSnapshotHash>