File tree 1 file changed +13
-2
lines changed
hydra-node/test/Hydra/Model
1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -10,13 +10,13 @@ import Cardano.Binary (serialize', unsafeDeserialize')
10
10
import Control.Concurrent.Class.MonadSTM (
11
11
MonadLabelledSTM ,
12
12
MonadSTM (newTVarIO , writeTVar ),
13
- flushTQueue ,
14
13
labelTQueueIO ,
15
14
labelTVarIO ,
16
15
modifyTVar ,
17
16
newTQueueIO ,
18
17
newTVarIO ,
19
18
readTVarIO ,
19
+ tryReadTQueue ,
20
20
writeTQueue ,
21
21
writeTVar ,
22
22
)
@@ -195,7 +195,7 @@ mockChainAndNetwork tr seedKeys commits = do
195
195
rollForward nodes chain queue = do
196
196
threadDelay blockTime
197
197
atomically $ do
198
- transactions <- flushTQueue queue
198
+ transactions <- flushQueue queue
199
199
addNewBlockToChain chain transactions
200
200
doRollForward nodes chain
201
201
@@ -328,3 +328,14 @@ mkMockTxIn vk ix = TxIn (TxId tid) (TxIx ix)
328
328
where
329
329
-- NOTE: Ugly, works because both binary representations are 32-byte long.
330
330
tid = unsafeDeserialize' (serialize' vk)
331
+
332
+ -- NOTE: This is a workaround until the upstream PR is merged:
333
+ -- https://github.com/input-output-hk/io-sim/issues/133
334
+ flushQueue :: MonadSTM m => TQueue m a -> STM m [a ]
335
+ flushQueue queue = go []
336
+ where
337
+ go as = do
338
+ hasA <- tryReadTQueue queue
339
+ case hasA of
340
+ Just a -> go (a : as)
341
+ Nothing -> pure as
You can’t perform that action at this time.
0 commit comments