Don't delete databases that can be reused
This commit is contained in:
parent
dbf54e4690
commit
06886001aa
|
@ -15,7 +15,7 @@ use tracing::Span;
|
|||
use zebra_chain::parameters::Network;
|
||||
|
||||
use crate::{
|
||||
constants::{DATABASE_FORMAT_VERSION_FILE_NAME, STATE_DATABASE_KIND},
|
||||
constants::{DATABASE_FORMAT_VERSION_FILE_NAME, RESTORABLE_DB_VERSIONS, STATE_DATABASE_KIND},
|
||||
state_database_format_version_in_code, BoxError,
|
||||
};
|
||||
|
||||
|
@ -317,6 +317,15 @@ fn check_and_delete_database(
|
|||
return None;
|
||||
}
|
||||
|
||||
// Don't delete databases that can be reused.
|
||||
if RESTORABLE_DB_VERSIONS
|
||||
.iter()
|
||||
.map(|v| v - 1)
|
||||
.any(|v| v == dir_major_version)
|
||||
{
|
||||
return None;
|
||||
}
|
||||
|
||||
let outdated_path = entry.path();
|
||||
|
||||
// # Correctness
|
||||
|
|
Loading…
Reference in New Issue