Skip to content

Commit

Permalink
fix: err instead of panic when too few zebra args
Browse files Browse the repository at this point in the history
  • Loading branch information
Mirko-von-Leipzig committed Jul 5, 2021
1 parent f40f463 commit 5f8503f
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/setup/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,15 @@ impl NodeMetaData {
match config_file.kind {
NodeKind::Zebra => {
// Zebra's final arg must be `start`, so we insert the actual args before it.
let n = start_args.len();
assert!(n > 1, "Expected at least one arg for Zebra (`start`)");
start_args.insert(n - 1, "--config".into());
start_args.insert(n, config_path.into_os_string());
let n_args = start_args.len();
if n_args < 1 {
return Err(io::Error::new(
io::ErrorKind::InvalidData,
"Expected at least one start_command arg for Zebra (`start`)",
));
}
start_args.insert(n_args - 1, "--config".into());
start_args.insert(n_args, config_path.into_os_string());
}
NodeKind::Zcashd => {
start_args.push(format!("-conf={}", config_path.to_str().unwrap()).into());
Expand Down

0 comments on commit 5f8503f

Please sign in to comment.