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

This commit is contained in:
Tom Linton 2021-10-08 09:11:26 +13:00 committed by GitHub
parent e7d16d3ec8
commit de8cb49dd1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -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());