Browse Source

cli: Error if program in genesis configuration doesn't exist (#841)

Tom Linton 4 years ago
parent
commit
de8cb49dd1
1 changed files with 7 additions and 0 deletions
  1. 7 0
      cli/src/lib.rs

+ 7 - 0
cli/src/lib.rs

@@ -1573,6 +1573,13 @@ fn validator_flags(cfg: &WithPath<Config>) -> Result<Vec<String>> {
     if let Some(test) = cfg.test.as_ref() {
         if let Some(genesis) = &test.genesis {
             for entry in genesis {
+                let program_path = Path::new(&entry.program);
+                if !program_path.exists() {
+                    return Err(anyhow!(
+                        "Program in genesis configuration does not exist at path: {}",
+                        program_path.display()
+                    ));
+                }
                 flags.push("--bpf-program".to_string());
                 flags.push(entry.address.clone());
                 flags.push(entry.program.clone());