Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use create_and_canonicalize_directory for snapshots dir #3923

Merged
merged 2 commits into from
Dec 6, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions validator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ use {
AccountsIndexConfig, IndexLimitMb, ScanFilter,
},
partitioned_rewards::TestPartitionedEpochRewards,
utils::{create_all_accounts_run_and_snapshot_dirs, create_and_canonicalize_directories},
utils::{
create_all_accounts_run_and_snapshot_dirs, create_and_canonicalize_directories,
create_and_canonicalize_directory,
},
},
solana_clap_utils::input_parsers::{keypair_of, keypairs_of, pubkey_of, value_of, values_of},
solana_core::{
Expand Down Expand Up @@ -1667,20 +1670,17 @@ pub fn main() {
value_t_or_exit!(matches, "maximum_snapshot_download_abort", u64);

let snapshots_dir = if let Some(snapshots) = matches.value_of("snapshots") {
Path::new(snapshots)
&create_and_canonicalize_directory(PathBuf::from(snapshots)).unwrap_or_else(|err| {
eprintln!("Unable to access snapshots path '{}': {err}", snapshots);
exit(1);
})
brooksprumo marked this conversation as resolved.
Show resolved Hide resolved
} else {
&ledger_path
};
let snapshots_dir = fs::canonicalize(snapshots_dir).unwrap_or_else(|err| {
eprintln!(
"Failed to canonicalize snapshots path '{}': {err}",
snapshots_dir.display(),
);
exit(1);
});

if account_paths
.iter()
.any(|account_path| account_path == &snapshots_dir)
.any(|account_path| account_path == snapshots_dir)
{
eprintln!(
"Failed: The --accounts and --snapshots paths must be unique since they \
Expand Down
Loading