Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Pablo Lamela <[email protected]>
  • Loading branch information
carbolymer and palas authored May 14, 2024
1 parent 1bbdef6 commit 236af21
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions cardano-testnet/src/Testnet/Components/Query.hs
Original file line number Diff line number Diff line change
Expand Up @@ -115,17 +115,17 @@ waitForBlocks
=> EpochStateView
-> Word64 -- ^ Number of blocks to wait
-> m BlockNo -- ^ The block number reached
waitForBlocks epochStateView numberOfBlocks = withFrozenCallStack $ do
fmap BlockNo . flip evalStateT Nothing $ do
watchEpochStateUpdate epochStateView $ \(_, _, BlockNo blockNumber) -> do
waitForBlocks epochStateView numberOfBlocks = withFrozenCallStack $
fmap BlockNo . flip evalStateT Nothing $
watchEpochStateUpdate epochStateView $ \(_, _, BlockNo blockNumber) ->
get >>= \case
Nothing -> do
Nothing ->
-- register starting block
Nothing <$ put (Just blockNumber)
Just startingBlockNumber ->
Just startingBlockNumber -> pure $
if blockNumber >= startingBlockNumber + numberOfBlocks
then pure (Just blockNumber)
else pure Nothing
then Just blockNumber
else Nothing

-- | A read-only mutable pointer to an epoch state, updated automatically
data EpochStateView = EpochStateView
Expand Down

0 comments on commit 236af21

Please sign in to comment.