From efe4040bbb1dabf51f63d0bdbc173b138a9eda48 Mon Sep 17 00:00:00 2001 From: Daniel Xifra Date: Wed, 23 Sep 2026 15:54:27 -0300 Subject: [PATCH] move open_store as down as possible --- crates/malachite-app/src/node.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/crates/malachite-app/src/node.rs b/crates/malachite-app/src/node.rs index 402c5d66..5aab8b0d 100644 --- a/crates/malachite-app/src/node.rs +++ b/crates/malachite-app/src/node.rs @@ -781,11 +781,6 @@ impl App { // Setup metrics let (app_metrics, db_metrics, process_metrics) = self.setup_metrics(); - // Open the store - let (store, store_monitor) = self - .open_store(db_metrics, env_config.db_cache_size) - .await?; - // Connect to the execution engine and resolve consensus spec and genesis // hash. The EL may be restarting underneath us, so retry with a fresh // connection until it serves or the startup deadline elapses. @@ -854,6 +849,13 @@ impl App { #[cfg(not(feature = "byzantine"))] let state_ctx = ctx; + // Open the store only after the execution engine is reachable: a startup failure + // before this point must not leave the store without a quick-repair commit, which + // would force a full database repair on the next start. + let (store, store_monitor) = self + .open_store(db_metrics, env_config.db_cache_size) + .await?; + // Initialize the application state with the resolved spec and genesis block. let mut state = State::builder(state_ctx) .identity(identity.consensus.clone())