diff --git a/cardano-testnet/src/Testnet/Components/Query.hs b/cardano-testnet/src/Testnet/Components/Query.hs index 4f7f83ac2f1..3af3ecf75a6 100644 --- a/cardano-testnet/src/Testnet/Components/Query.hs +++ b/cardano-testnet/src/Testnet/Components/Query.hs @@ -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