gateway: don't panic when local slabstore index is higher than gateway's slabstore index

This commit is contained in:
ghassmo
2021-10-19 15:01:17 +03:00
parent 90892a45b4
commit eecf039924

View File

@@ -220,11 +220,18 @@ impl GatewayClient {
pub async fn sync(&mut self) -> Result<u64> {
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) {