Fail fast if account paths cannot be canonicalized (#7300)

* Canonicalize account paths to avoid symlink issues

* fixes
This commit is contained in:
Justin Starry
2019-12-05 21:41:29 -05:00
committed by GitHub
parent 7c3be2ec9a
commit b7d4330dd4
13 changed files with 123 additions and 125 deletions

View File

@@ -7,12 +7,12 @@ use crate::{
};
use log::*;
use solana_sdk::genesis_config::GenesisConfig;
use std::{fs, sync::Arc};
use std::{fs, path::PathBuf, sync::Arc};
pub fn load(
genesis_config: &GenesisConfig,
blocktree: &Blocktree,
account_paths: Option<String>,
account_paths: Vec<PathBuf>,
snapshot_config: Option<&SnapshotConfig>,
process_options: ProcessOptions,
) -> Result<(BankForks, Vec<BankForksInfo>, LeaderScheduleCache), BlocktreeProcessorError> {
@@ -30,10 +30,13 @@ pub fn load(
if tar.exists() {
info!("Loading snapshot package: {:?}", tar);
// Fail hard here if snapshot fails to load, don't silently continue
if account_paths.is_empty() {
panic!("Account paths not present when booting from snapshot")
}
let deserialized_bank = snapshot_utils::bank_from_archive(
account_paths
.clone()
.expect("Account paths not present when booting from snapshot"),
&account_paths,
&snapshot_config.snapshot_path,
&tar,
)