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 <[email protected]>
  • Loading branch information
mgmeier committed Aug 3, 2022
1 parent e413903 commit 4efc9e5
Showing 1 changed file with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
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 4efc9e5

Please sign in to comment.