From eecf039924325ff9709141ab5c1908a7920cddf3 Mon Sep 17 00:00:00 2001 From: ghassmo Date: Tue, 19 Oct 2021 15:01:17 +0300 Subject: [PATCH] gateway: don't panic when local slabstore index is higher than gateway's slabstore index --- src/service/gateway.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/service/gateway.rs b/src/service/gateway.rs index fb66d8f6e..8952be25a 100644 --- a/src/service/gateway.rs +++ b/src/service/gateway.rs @@ -220,11 +220,18 @@ impl GatewayClient { pub async fn sync(&mut self) -> Result { debug!(target: "GATEWAY CLIENT", "Start Syncing"); + let local_last_index = self.slabstore.get_last_index()?; let last_index = self.get_last_index().await?; - assert!(last_index >= local_last_index); + if last_index < local_last_index { + return Err(Error::SlabsStore( + "Local slabstore has higher index than gateway's slabstore. + Delete slabstore database \"darkfid_client.db\" and wallet database + \" darkfid_wallet.db\" in config directory.".into(), + )); + } if last_index > 0 { for index in (local_last_index + 1)..(last_index + 1) {