From e5f5d92051757362ece3ab810f42b9d30cfd6f36 Mon Sep 17 00:00:00 2001 From: rymnc <43716372+rymnc@users.noreply.github.com> Date: Mon, 23 Sep 2024 16:35:00 +0530 Subject: [PATCH] fix: dont sync if nothing in onchain db --- crates/fuel-core/src/combined_database.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/crates/fuel-core/src/combined_database.rs b/crates/fuel-core/src/combined_database.rs index b798c7c2d52..08a7ddbd239 100644 --- a/crates/fuel-core/src/combined_database.rs +++ b/crates/fuel-core/src/combined_database.rs @@ -316,12 +316,11 @@ impl CombinedDatabase { where S: ShutdownListener, { - let on_chain_height = self - .on_chain() - .latest_height_from_metadata()? - .ok_or(anyhow::anyhow!("on-chain database doesn't have height"))?; + if let Some(on_chain_height) = self.on_chain().latest_height_from_metadata()? { + self.rollback_to(on_chain_height, shutdown_listener)?; + }; - self.rollback_to(on_chain_height, shutdown_listener) + Ok(()) } }