fn should_use_local_snapshot(
        snapshot_archives_dir: &Path,
        maximum_local_snapshot_age: Slot,
        full_snapshot_hash: (Slot, Hash),
        incremental_snapshot_hash: Option<(Slot, Hash)>,
    ) -> bool {
        let cluster_snapshot_slot = incremental_snapshot_hash
            .map(|(slot, _)| slot)
            .unwrap_or(full_snapshot_hash.0);

        match get_highest_local_snapshot_hash(snapshot_archives_dir) {
            None => {
                info!(
                    "Downloading a snapshot for slot {} since there is not a local snapshot.",
                    cluster_snapshot_slot,
                );
                false
            }
            Some((local_snapshot_slot, _)) => {
                if local_snapshot_slot
                    >= cluster_snapshot_slot.saturating_sub(maximum_local_snapshot_age)
                {
                    info!(
                        "Reusing local snapshot at slot {} instead of downloading a snapshot for slot {}.",
                        local_snapshot_slot,
                        cluster_snapshot_slot,
                    );
                    true
                } else {
                    info!(
                        "Local snapshot from slot {} is too old. Downloading a newer snapshot for slot {}.",
                        local_snapshot_slot,
                        cluster_snapshot_slot,
                    );
                    false
                }
            }
        }
    }
/// Check to see if bootstrap should load from its local snapshots or not.  If not, then snapshots
/// will be downloaded.
Check to see if bootstrap should load from its local snapshots or not.  If not, then snapshots
will be downloaded.
Check to see if bootstrap should load from its local snapshots or not . If not then snapshots will be downloaded .
fn should_use_local_snapshot(
        snapshot_archives_dir: &Path,
        maximum_local_snapshot_age: Slot,
        full_snapshot_hash: (Slot, Hash),
        incremental_snapshot_hash: Option<(Slot, Hash)>,
    ) -> bool {
        let cluster_snapshot_slot = incremental_snapshot_hash
            .map(|(slot, _)| slot)
            .unwrap_or(full_snapshot_hash.0);
        match get_highest_local_snapshot_hash(snapshot_archives_dir) {
            None => {
                info!(
                    "Downloading a snapshot for slot {} since there is not a local snapshot.",
                    cluster_snapshot_slot,
                );
                false
            }
            Some((local_snapshot_slot, _)) => {
                if local_snapshot_slot
                    >= cluster_snapshot_slot.saturating_sub(maximum_local_snapshot_age)
                {
                    info!(
                        "Reusing local snapshot at slot {} instead of downloading a snapshot for slot {}.",
                        local_snapshot_slot,
                        cluster_snapshot_slot,
                    );
                    true
                } else {
                    info!(
                        "Local snapshot from slot {} is too old. Downloading a newer snapshot for slot {}.",
                        local_snapshot_slot,
                        cluster_snapshot_slot,
                    );
                    false
                }
            }
        }
    }
fn should_use_local_snapshot ( snapshot_archives_dir : & Path , maximum_local_snapshot_age : Slot , full_snapshot_hash : ( Slot , Hash ) , incremental_snapshot_hash : Option < ( Slot , Hash ) > , ) -> bool { let cluster_snapshot_slot = incremental_snapshot_hash . map ( | ( slot , _ ) | slot ) . unwrap_or ( full_snapshot_hash . 0 ) ; match get_highest_local_snapshot_hash ( snapshot_archives_dir ) { None => { info ! ( " " cluster_snapshot_slot ) ; false } Some ( ( local_snapshot_slot , _ ) ) => { if local_snapshot_slot >= cluster_snapshot_slot . saturating_sub ( maximum_local_snapshot_age ) { info ! ( " " local_snapshot_slot cluster_snapshot_slot ) ; true } else { info ! ( " " local_snapshot_slot cluster_snapshot_slot ) ; false } } } }
Check to see if bootstrap should load from its local snapshots or not.
Check to see if bootstrap should load from its local snapshots or not .
snapshot_archives_dir
&Path
maximum_local_snapshot_age
Slot
full_snapshot_hash
(Slot, Hash)
incremental_snapshot_hash
Option<(Slot, Hash)>