diff --git a/ouroboros-consensus-diffusion/src/ouroboros-consensus-diffusion/Ouroboros/Consensus/NodeKernel.hs b/ouroboros-consensus-diffusion/src/ouroboros-consensus-diffusion/Ouroboros/Consensus/NodeKernel.hs index 56c48ae875..68603f7b62 100644 --- a/ouroboros-consensus-diffusion/src/ouroboros-consensus-diffusion/Ouroboros/Consensus/NodeKernel.hs +++ b/ouroboros-consensus-diffusion/src/ouroboros-consensus-diffusion/Ouroboros/Consensus/NodeKernel.hs @@ -307,21 +307,19 @@ initInternalState NodeKernelArgs { tracers, chainDB, registry, cfg varLedgerJudgement <- do wasCaughtUp <- GSM.hasMarkerFile gsmMarkerFileView initJudgment <- - if not wasCaughtUp - then do - GSM.removeMarkerFile gsmMarkerFileView - return GSM.TooOld - else do - extLedgerState <- atomically $ ChainDB.getCurrentLedger chainDB - dur <- - computeDurationuntilTooOld - cfg - durationUntilTooOld - (ledgerState extLedgerState) - return $ case dur of - GSM.After{} -> GSM.YoungEnough - GSM.Already -> GSM.TooOld - GSM.UnsafeNever -> GSM.YoungEnough + if not wasCaughtUp then pure GSM.TooOld else do + extLedgerState <- atomically $ ChainDB.getCurrentLedger chainDB + dur <- + computeDurationuntilTooOld + cfg + durationUntilTooOld + (ledgerState extLedgerState) + case dur of + GSM.After{} -> return GSM.YoungEnough + GSM.UnsafeNever -> return GSM.YoungEnough + GSM.Already -> do + GSM.removeMarkerFile gsmMarkerFileView + return GSM.TooOld LazySTM.newTVarIO initJudgment varCandidates <- newTVarIO mempty