ledger-tool: clear non-primary access accounts directory in load_bank_forks (#24958)

This commit is contained in:
apfitzge 2022-05-09 13:17:13 -05:00 committed by GitHub
parent de96663cc4
commit b83fd8b958
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 0 deletions

View File

@ -768,6 +768,18 @@ fn load_bank_forks(
"Default accounts path is switched aligning with Blockstore's secondary access: {:?}",
non_primary_accounts_path
);
if non_primary_accounts_path.exists() {
info!("Clearing {:?}", non_primary_accounts_path);
if let Err(err) = std::fs::remove_dir_all(&non_primary_accounts_path) {
eprintln!(
"error deleting accounts path {:?}: {}",
non_primary_accounts_path, err
);
exit(1);
}
}
vec![non_primary_accounts_path]
};