diff --git a/src/Zenith/CLI.hs b/src/Zenith/CLI.hs index 2ae18c6..ab6549c 100644 --- a/src/Zenith/CLI.hs +++ b/src/Zenith/CLI.hs @@ -840,11 +840,11 @@ scanZebra dbP zHost zPort b eChan znet = do logDebugN $ "dbBlock: " <> T.pack (show dbBlock) <> " chkBlock: " <> T.pack (show chkBlock) - when (chkBlock /= dbBlock) $ rewindWalletData pool chkBlock let sb = if chkBlock == dbBlock then max dbBlock b else max chkBlock b + when (chkBlock /= dbBlock && chkBlock /= 1) $ rewindWalletData pool sb if sb > zgb_blocks bStatus || sb < 1 then do liftIO $ diff --git a/src/Zenith/GUI.hs b/src/Zenith/GUI.hs index 28737a2..19003a0 100644 --- a/src/Zenith/GUI.hs +++ b/src/Zenith/GUI.hs @@ -1632,12 +1632,12 @@ scanZebra dbPath zHost zPort net sendMsg = do if syncChk then sendMsg (ShowError "Sync already in progress") else do - unless (chkBlock == dbBlock) $ - runStderrLoggingT $ rewindWalletData pool chkBlock let sb = if chkBlock == dbBlock then max dbBlock b else max chkBlock b + unless (chkBlock == dbBlock || chkBlock == 1) $ + runStderrLoggingT $ rewindWalletData pool sb if sb > zgb_blocks bStatus || sb < 1 then sendMsg (ShowError "Invalid starting block for scan") else do diff --git a/src/Zenith/RPC.hs b/src/Zenith/RPC.hs index 01a9e21..a88e014 100644 --- a/src/Zenith/RPC.hs +++ b/src/Zenith/RPC.hs @@ -892,12 +892,12 @@ scanZebra dbPath zHost zPort net = do chkBlock <- checkIntegrity dbPath zHost zPort dbBlock 1 syncChk <- isSyncing pool unless syncChk $ do - unless (chkBlock == dbBlock) $ - runStderrLoggingT $ rewindWalletData pool chkBlock let sb = if chkBlock == dbBlock then max dbBlock b else max chkBlock b + unless (chkBlock == dbBlock || chkBlock == 1) $ + runStderrLoggingT $ rewindWalletData pool sb unless (sb > zgb_blocks bStatus || sb < 1) $ do let bList = [(sb + 1) .. (zgb_blocks bStatus)] unless (null bList) $ do