Skip to content

Commit

Permalink
cardano-tools: condition locally defined
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Karg <michael.karg@iohk.io>
  • Loading branch information
mgmeier committed Aug 8, 2022
1 parent 440033b commit 76a43c8
Showing 1 changed file with 7 additions and 8 deletions.
Expand Up @@ -53,13 +53,6 @@ data ForgeState =
initialForgeState :: ForgeState
initialForgeState = ForgeState 0 0 0

forgingDone :: ForgeLimit -> ForgeState -> Bool
forgingDone (ForgeLimitSlot s) = (s == ) . currentSlot
forgingDone (ForgeLimitBlock b) = (b == ) . forged
forgingDone (ForgeLimitEpoch e) = (e == ) . currentEpoch
{-# INLINE forgingDone #-}


-- DUPLICATE: runForge mirrors forging loop from ouroboros-consensus/src/Ouroboros/Consensus/NodeKernel.hs
-- For an extensive commentary of the forging loop, see there.

Expand All @@ -81,9 +74,15 @@ runForge epochSize_ opts chainDB blockForging cfg = do
where
epochSize = unEpochSize epochSize_

forgingDone :: ForgeState -> Bool
forgingDone = case opts of
ForgeLimitSlot s -> (s == ) . currentSlot
ForgeLimitBlock b -> (b == ) . forged
ForgeLimitEpoch e -> (e == ) . currentEpoch

go :: ForgeState -> IO ForgeState
go forgeState@ForgeState{currentSlot, forged, currentEpoch}
| forgingDone opts forgeState = pure forgeState
| forgingDone forgeState = pure forgeState
| otherwise =
let
currentSlot' = currentSlot + 1
Expand Down

0 comments on commit 76a43c8

Please sign in to comment.