Skip to content

Commit da65f88

Browse files
authored
Merge pull request #1382 from input-output-hk/avoid-rollback-race-condition
Limit rollback frequency in MockChain
2 parents c9d3553 + d55f09f commit da65f88

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

hydra-node/test/Hydra/Model/MockChain.hs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,11 @@ mockChainAndNetwork tr seedKeys commits = do
269269
doRollBackward nodes chain numberOfBlocks
270270
replicateM_ (fromIntegral numberOfBlocks) $
271271
doRollForward nodes chain
272+
-- NOTE: There seems to be a race condition on multiple consecutive
273+
-- rollbackAndForward calls, which would require some minimal (1ms) delay
274+
-- here. However, waiting here for one blockTime is not wrong and enforces
275+
-- rollbacks / chain switches to be not more often than blocks being added.
276+
threadDelay blockTime
272277

273278
doRollBackward nodes chain nbBlocks = do
274279
(slotNum, position, blocks, _) <- readTVarIO chain

0 commit comments

Comments
 (0)