Don't panic in sdk/ when genesis fails to load (#6892)

This commit is contained in:
Michael Vines
2019-11-12 10:24:49 -07:00
committed by GitHub
parent bb158a9b48
commit c6b108ef4f
2 changed files with 37 additions and 11 deletions

View File

@ -426,8 +426,10 @@ pub fn new_banks_from_blocktree(
LeaderScheduleCache,
PohConfig,
) {
let genesis_config =
GenesisConfig::load(blocktree_path).expect("Failed to load genesis config");
let genesis_config = GenesisConfig::load(blocktree_path).unwrap_or_else(|err| {
error!("Failed to load genesis from {:?}: {}", blocktree_path, err);
process::exit(1);
});
let genesis_hash = genesis_config.hash();
info!("genesis hash: {}", genesis_hash);