Skip to content

Commit

Permalink
Remove duplicate SnapshotConfig validation code (solana-labs#32290)
Browse files Browse the repository at this point in the history
Instead, use the is_snapshot_config_valid() helper function.
  • Loading branch information
steviez authored and wen-coding committed Aug 15, 2023
1 parent 80e2434 commit 796028c
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions local-cluster/tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use {
solana_core::{
consensus::{Tower, SWITCH_FORK_THRESHOLD},
tower_storage::FileTowerStorage,
validator::ValidatorConfig,
validator::{is_snapshot_config_valid, ValidatorConfig},
},
solana_gossip::gossip_service::discover_cluster,
solana_ledger::{
Expand Down Expand Up @@ -481,18 +481,9 @@ impl SnapshotValidatorConfig {
// Interval values must be nonzero
assert!(accounts_hash_interval_slots > 0);
assert!(full_snapshot_archive_interval_slots > 0);
assert!(incremental_snapshot_archive_interval_slots > 0);
// Ensure that some snapshots will be created
assert!(full_snapshot_archive_interval_slots != DISABLED_SNAPSHOT_ARCHIVE_INTERVAL);
assert!(full_snapshot_archive_interval_slots % accounts_hash_interval_slots == 0);
if incremental_snapshot_archive_interval_slots != DISABLED_SNAPSHOT_ARCHIVE_INTERVAL {
assert!(incremental_snapshot_archive_interval_slots > 0);
assert!(
incremental_snapshot_archive_interval_slots % accounts_hash_interval_slots == 0
);
assert!(
full_snapshot_archive_interval_slots % incremental_snapshot_archive_interval_slots
== 0
);
}

// Create the snapshot config
let _ = fs::create_dir_all(farf_dir());
Expand Down

0 comments on commit 796028c

Please sign in to comment.