Remove all snapshots not matching the desired hash

This commit is contained in:
Michael Vines
2020-03-17 18:10:48 -07:00
parent cb29b8dd2a
commit bf60345b7a
2 changed files with 29 additions and 21 deletions

View File

@@ -178,7 +178,8 @@ pub fn download_snapshot(
// Remove all snapshot not matching the desired hash
let snapshot_packages = solana_ledger::snapshot_utils::get_snapshot_archives(ledger_path);
for (snapshot_package, snapshot_hash) in snapshot_packages.iter() {
if snapshot_hash != desired_snapshot_hash {
if *snapshot_hash != desired_snapshot_hash {
info!("Removing old snapshot: {:?}", snapshot_package);
fs::remove_file(snapshot_package)
.unwrap_or_else(|err| info!("Failed to remove old snapshot: {:}", err));
}