diff --git a/zebra-state/src/config.rs b/zebra-state/src/config.rs index 49b45ca936a..d90ae8c42d0 100644 --- a/zebra-state/src/config.rs +++ b/zebra-state/src/config.rs @@ -458,12 +458,26 @@ pub(crate) fn database_format_version_at_path( // Hide this destructive method from the public API, except in tests. #[allow(unused_imports)] -pub(crate) use hidden::write_database_format_version_to_disk; +pub(crate) use hidden::{ + write_database_format_version_to_disk, write_state_database_format_version_to_disk, +}; pub(crate) mod hidden { use super::*; + /// Writes `changed_version` to the on-disk state database after the format is changed. + /// (Or a new database is created.) + /// + /// See `write_database_format_version_to_disk()` for details. + pub fn write_state_database_format_version_to_disk( + config: &Config, + changed_version: &Version, + network: Network, + ) -> Result<(), BoxError> { + write_database_format_version_to_disk(config, STATE_DATABASE_KIND, changed_version, network) + } + /// Writes `changed_version` to the on-disk database after the format is changed. /// (Or a new database is created.) /// diff --git a/zebra-state/src/lib.rs b/zebra-state/src/lib.rs index 168e5910b4c..a50d2a7b11d 100644 --- a/zebra-state/src/lib.rs +++ b/zebra-state/src/lib.rs @@ -77,10 +77,14 @@ pub use service::{ }; #[cfg(not(any(test, feature = "proptest-impl")))] -pub(crate) use config::hidden::write_database_format_version_to_disk; +pub(crate) use config::hidden::{ + write_database_format_version_to_disk, write_state_database_format_version_to_disk, +}; #[cfg(any(test, feature = "proptest-impl"))] -pub use config::hidden::write_database_format_version_to_disk; +pub use config::hidden::{ + write_database_format_version_to_disk, write_state_database_format_version_to_disk, +}; #[cfg(any(test, feature = "proptest-impl"))] pub use constants::latest_version_for_adding_subtrees; diff --git a/zebrad/tests/acceptance.rs b/zebrad/tests/acceptance.rs index de6b297c122..244edd8e334 100644 --- a/zebrad/tests/acceptance.rs +++ b/zebrad/tests/acceptance.rs @@ -2625,8 +2625,12 @@ async fn state_format_test( .zebrad_config(test_name, false, Some(dir.path()), network) .expect("already checked config")?; - zebra_state::write_database_format_version_to_disk(fake_version, &config.state, network) - .expect("can't write fake database version to disk"); + zebra_state::write_state_database_format_version_to_disk( + &config.state, + fake_version, + network, + ) + .expect("can't write fake database version to disk"); // Give zebra_state enough time to actually write the database version to disk. tokio::time::sleep(Duration::from_secs(1)).await;