From 2287422df2307b43068efc42876c36a6fc1240d4 Mon Sep 17 00:00:00 2001 From: Brooks Prumo Date: Fri, 3 Sep 2021 13:36:43 -0500 Subject: [PATCH] Pass SnapshotConfig to SnapshotPackagerService --- core/src/snapshot_packager_service.rs | 8 ++++---- core/src/validator.rs | 2 +- core/tests/snapshots.rs | 6 ++---- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/core/src/snapshot_packager_service.rs b/core/src/snapshot_packager_service.rs index 8670ea962b57c5..2d754f3d5aeb7e 100644 --- a/core/src/snapshot_packager_service.rs +++ b/core/src/snapshot_packager_service.rs @@ -1,7 +1,7 @@ use solana_gossip::cluster_info::{ClusterInfo, MAX_SNAPSHOT_HASHES}; use solana_runtime::{ - snapshot_archive_info::SnapshotArchiveInfoGetter, snapshot_package::PendingSnapshotPackage, - snapshot_utils, + snapshot_archive_info::SnapshotArchiveInfoGetter, snapshot_config::SnapshotConfig, + snapshot_package::PendingSnapshotPackage, snapshot_utils, }; use solana_sdk::{clock::Slot, hash::Hash}; use std::{ @@ -23,7 +23,7 @@ impl SnapshotPackagerService { starting_snapshot_hash: Option<(Slot, Hash)>, exit: &Arc, cluster_info: &Arc, - maximum_snapshots_to_retain: usize, + snapshot_config: SnapshotConfig, ) -> Self { let exit = exit.clone(); let cluster_info = cluster_info.clone(); @@ -53,7 +53,7 @@ impl SnapshotPackagerService { // last_full_snapshot_slot that requires this archive call to succeed. snapshot_utils::archive_snapshot_package( &snapshot_package, - maximum_snapshots_to_retain, + snapshot_config.maximum_full_snapshot_archives_to_retain, ) .expect("failed to archive snapshot package"); diff --git a/core/src/validator.rs b/core/src/validator.rs index 5584bbd7992cd2..52b03c552a85d6 100644 --- a/core/src/validator.rs +++ b/core/src/validator.rs @@ -651,7 +651,7 @@ impl Validator { snapshot_hash, &exit, &cluster_info, - snapshot_config.maximum_full_snapshot_archives_to_retain, + snapshot_config.clone(), ); ( Some(snapshot_packager_service), diff --git a/core/tests/snapshots.rs b/core/tests/snapshots.rs index f66389f5c9a929..27bc9eb974c3a5 100644 --- a/core/tests/snapshots.rs +++ b/core/tests/snapshots.rs @@ -502,7 +502,7 @@ mod tests { None, &exit, &cluster_info, - DEFAULT_MAX_FULL_SNAPSHOT_ARCHIVES_TO_RETAIN, + snapshot_config.clone(), ); let _package_receiver = std::thread::Builder::new() @@ -923,9 +923,7 @@ mod tests { None, &exit, &cluster_info, - snapshot_test_config - .snapshot_config - .maximum_full_snapshot_archives_to_retain, + snapshot_test_config.snapshot_config.clone(), ); let accounts_hash_verifier = AccountsHashVerifier::new(