fn retain_known_peer_snapshot_hashes(
        known_snapshot_hashes: &HashMap<(Slot, Hash), HashSet<(Slot, Hash)>>,
        peer_snapshot_hashes: &mut Vec<PeerSnapshotHash>,
    ) {
        peer_snapshot_hashes.retain(|peer_snapshot_hash| {
            known_snapshot_hashes
                .get(&peer_snapshot_hash.snapshot_hash.full)
                .map(|known_incremental_hashes| {
                    if peer_snapshot_hash.snapshot_hash.incr.is_none() {
                        // If the peer's full snapshot hashes match, but doesn't have any
                        // incremental snapshots, that's fine; keep 'em!
                        true
                    } else {
                        known_incremental_hashes
                            .contains(peer_snapshot_hash.snapshot_hash.incr.as_ref().unwrap())
                    }
                })
                .unwrap_or(false)
        });

        trace!(
            "retain known peer snapshot hashes: {:?}",
            &peer_snapshot_hashes
        );
    }
/// Retain the peer snapshot hashes that match a hash from the known snapshot hashes
Retain the peer snapshot hashes that match a hash from the known snapshot hashes
Retain the peer snapshot hashes that match a hash from the known snapshot hashes
fn retain_known_peer_snapshot_hashes(
        known_snapshot_hashes: &HashMap<(Slot, Hash), HashSet<(Slot, Hash)>>,
        peer_snapshot_hashes: &mut Vec<PeerSnapshotHash>,
    ) {
        peer_snapshot_hashes.retain(|peer_snapshot_hash| {
            known_snapshot_hashes
                .get(&peer_snapshot_hash.snapshot_hash.full)
                .map(|known_incremental_hashes| {
                    if peer_snapshot_hash.snapshot_hash.incr.is_none() {
                        // If the peer's full snapshot hashes match, but doesn't have any
                        // incremental snapshots, that's fine; keep 'em!
                        true
                    } else {
                        known_incremental_hashes
                            .contains(peer_snapshot_hash.snapshot_hash.incr.as_ref().unwrap())
                    }
                })
                .unwrap_or(false)
        });
        trace!(
            "retain known peer snapshot hashes: {:?}",
            &peer_snapshot_hashes
        );
    }
fn retain_known_peer_snapshot_hashes ( known_snapshot_hashes : & HashMap < ( Slot , Hash ) , HashSet < ( Slot , Hash ) > > , peer_snapshot_hashes : & mut Vec < PeerSnapshotHash > , ) { peer_snapshot_hashes . retain ( | peer_snapshot_hash | { known_snapshot_hashes . get ( & peer_snapshot_hash . snapshot_hash . full ) . map ( | known_incremental_hashes | { if peer_snapshot_hash . snapshot_hash . incr . is_none ( ) { // If the peer's full snapshot hashes match, but doesn't have any // incremental snapshots, that's fine; keep 'em! true } else { known_incremental_hashes . contains ( peer_snapshot_hash . snapshot_hash . incr . as_ref ( ) . unwrap ( ) ) } } ) . unwrap_or ( false ) } ) ; trace ! ( " " peer_snapshot_hashes ) ; }
Retain the peer snapshot hashes that match a hash from the known snapshot hashes
Retain the peer snapshot hashes that match a hash from the known snapshot hashes
known_snapshot_hashes
&HashMap<(Slot, Hash), HashSet<(Slot, Hash)>>
peer_snapshot_hashes
&mut Vec<PeerSnapshotHash>