fn retain_peer_snapshot_hashes_with_highest_full_snapshot_slot(
        peer_snapshot_hashes: &mut Vec<PeerSnapshotHash>,
    ) {
        // retain the hashes with the highest full snapshot slot
        // do a two-pass algorithm
        // 1. find the full snapshot hash with the highest full snapshot slot
        // 2. retain elems with that full snapshot hash
        let mut highest_full_snapshot_hash = (Slot::MIN, Hash::default());
        peer_snapshot_hashes.iter().for_each(|peer_snapshot_hash| {
            if peer_snapshot_hash.snapshot_hash.full.0 > highest_full_snapshot_hash.0 {
                highest_full_snapshot_hash = peer_snapshot_hash.snapshot_hash.full;
            }
        });

        peer_snapshot_hashes.retain(|peer_snapshot_hash| {
            peer_snapshot_hash.snapshot_hash.full == highest_full_snapshot_hash
        });

        trace!(
            "retain peer snapshot hashes with highest full snapshot slot: {:?}",
            &peer_snapshot_hashes
        );
    }
/// Retain the peer snapshot hashes with the highest full snapshot slot
Retain the peer snapshot hashes with the highest full snapshot slot
Retain the peer snapshot hashes with the highest full snapshot slot
fn retain_peer_snapshot_hashes_with_highest_full_snapshot_slot(
        peer_snapshot_hashes: &mut Vec<PeerSnapshotHash>,
    ) {
        // retain the hashes with the highest full snapshot slot
        // do a two-pass algorithm
        // 1. find the full snapshot hash with the highest full snapshot slot
        // 2. retain elems with that full snapshot hash
        let mut highest_full_snapshot_hash = (Slot::MIN, Hash::default());
        peer_snapshot_hashes.iter().for_each(|peer_snapshot_hash| {
            if peer_snapshot_hash.snapshot_hash.full.0 > highest_full_snapshot_hash.0 {
                highest_full_snapshot_hash = peer_snapshot_hash.snapshot_hash.full;
            }
        });
        peer_snapshot_hashes.retain(|peer_snapshot_hash| {
            peer_snapshot_hash.snapshot_hash.full == highest_full_snapshot_hash
        });
        trace!(
            "retain peer snapshot hashes with highest full snapshot slot: {:?}",
            &peer_snapshot_hashes
        );
    }
fn retain_peer_snapshot_hashes_with_highest_full_snapshot_slot ( peer_snapshot_hashes : & mut Vec < PeerSnapshotHash > , ) { // retain the hashes with the highest full snapshot slot // do a two-pass algorithm // 1. find the full snapshot hash with the highest full snapshot slot // 2. retain elems with that full snapshot hash let mut highest_full_snapshot_hash = ( Slot :: MIN , Hash :: default ( ) ) ; peer_snapshot_hashes . iter ( ) . for_each ( | peer_snapshot_hash | { if peer_snapshot_hash . snapshot_hash . full . 0 > highest_full_snapshot_hash . 0 { highest_full_snapshot_hash = peer_snapshot_hash . snapshot_hash . full ; } } ) ; peer_snapshot_hashes . retain ( | peer_snapshot_hash | { peer_snapshot_hash . snapshot_hash . full == highest_full_snapshot_hash } ) ; trace ! ( " " peer_snapshot_hashes ) ; }
Retain the peer snapshot hashes with the highest full snapshot slot
Retain the peer snapshot hashes with the highest full snapshot slot
peer_snapshot_hashes
&mut Vec<PeerSnapshotHash>