Skip to content

Commit

Permalink
Make waitForAllConfirmations compile
Browse files Browse the repository at this point in the history
  • Loading branch information
ch1bo committed Jul 20, 2021
1 parent 750a7e1 commit f78fbf2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
11 changes: 5 additions & 6 deletions local-cluster/bench/Bench/EndToEnd.hs
Expand Up @@ -38,6 +38,7 @@ import HydraNode (
withMockChain,
)
import Test.QuickCheck (generate)
import Data.Set ((\\))

aliceSk, bobSk, carolSk :: SignKeyDSIGN MockDSIGN
aliceSk = 10
Expand Down Expand Up @@ -79,7 +80,7 @@ bench = do
txs <- generate $ genSequenceOfValidTransactions initialUtxo

for_ txs (newTx registry n1)
`concurrently` waitForAllConfirmations n1 registry txs
`concurrently_` waitForAllConfirmations n1 registry txs

send n1 $ input "close" []
waitMatch (contestationPeriod + 3) n1 $ \v ->
Expand Down Expand Up @@ -144,9 +145,7 @@ waitForAllConfirmations n1 registry txs =
| Set.null remainingIds = pure ()
| otherwise = do
res <- waitMatch 1 n1 $ \v -> do
guard
(v ^? key "output" == Just "snapshotConfirmed")
v
^? key "snapshot" . key "confirmedTransactions" . _Array
guard (v ^? key "output" == Just "snapshotConfirmed")
v ^? key "snapshot" . key "confirmedTransactions" . _Array
confirmedIds <- mapM (confirmTx registry) res
go (remainingIds Set.\\ Set.fromList confirmedIds)
go (remainingIds \\ Set.fromList (toList confirmedIds))
4 changes: 2 additions & 2 deletions local-cluster/src/HydraNode.hs
Expand Up @@ -245,10 +245,10 @@ checkProcessHasNotDied processHandle =
allNodeIds :: [Int]
allNodeIds = [1 .. 3]

waitForNodesConnected :: [HydraClient] -> IO ()
waitForNodesConnected :: HasCallStack => [HydraClient] -> IO ()
waitForNodesConnected = mapM_ waitForNodeConnected

waitForNodeConnected :: HydraClient -> IO ()
waitForNodeConnected :: HasCallStack => HydraClient -> IO ()
waitForNodeConnected n@HydraClient{hydraNodeId} =
-- HACK(AB): This is gross, we hijack the node ids and because we know
-- keys are just integers we can compute them but that's ugly -> use property
Expand Down

0 comments on commit f78fbf2

Please sign in to comment.