Skip to content

Commit 8319f03

Browse files
committed
Use a lower ttl in nodespec tests
1 parent 66f36b7 commit 8319f03

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

hydra-node/test/Hydra/NodeSpec.hs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ import Hydra.Chain (Chain (..), ChainEvent (..), OnChainTx (..), PostTxError (..
1515
import Hydra.Chain.ChainState (ChainSlot (ChainSlot), IsChainState)
1616
import Hydra.Events (EventSink (..), EventSource (..), getEventId)
1717
import Hydra.Events.Rotation (EventStore (..))
18-
import Hydra.HeadLogic (Input (..))
18+
import Hydra.HeadLogic (Input (..), TTL)
1919
import Hydra.HeadLogic.Outcome (StateChanged (HeadInitialized), genStateChanged)
2020
import Hydra.HeadLogic.StateEvent (StateEvent (..), genStateEvent)
2121
import Hydra.HeadLogicSpec (inInitialState, receiveMessage, receiveMessageFrom, testSnapshot)
2222
import Hydra.Ledger.Simple (SimpleChainState (..), SimpleTx (..), aValidTx, simpleLedger, utxoRef, utxoRefs)
2323
import Hydra.Logging (Tracer, showLogsOnFailure, traceInTVar)
2424
import Hydra.Logging qualified as Logging
2525
import Hydra.Network (Network (..))
26-
import Hydra.Network.Message (Message (..))
26+
import Hydra.Network.Message (Message (..), NetworkEvent (..))
2727
import Hydra.Node (
2828
DraftHydraNode,
2929
HydraNode (..),
@@ -264,9 +264,9 @@ spec = parallel $ do
264264
sigBob = sign bobSk snapshot
265265
inputs =
266266
inputsToOpenHead
267-
<> [ receiveMessageFrom bob ReqTx{transaction = tx1}
268-
, receiveMessageFrom bob ReqTx{transaction = tx2}
269-
, receiveMessage ReqSn{snapshotVersion = 0, snapshotNumber = 1, transactionIds = [2], decommitTx = Nothing, depositTxId = Nothing}
267+
<> [ NetworkInput testTTL $ ReceivedMessage{sender = bob, msg = ReqTx{transaction = tx1}}
268+
, NetworkInput testTTL $ ReceivedMessage{sender = bob, msg = ReqTx{transaction = tx2}}
269+
, NetworkInput testTTL $ ReceivedMessage{sender = alice, msg = ReqSn{snapshotVersion = 0, snapshotNumber = 1, transactionIds = [2], decommitTx = Nothing, depositTxId = Nothing}}
270270
]
271271
(node, getNetworkEvents) <-
272272
testHydraNode tracer bobSk [alice, carol] cperiod inputs
@@ -452,6 +452,11 @@ testHydraNode tracer signingKey otherParties contestationPeriod inputs = do
452452
-- as this is a simulated network.
453453
participants = deriveOnChainId <$> (party : otherParties)
454454

455+
-- | A lot shorter than the real world ttl which requires to be long to overcome
456+
-- some longer chain observation delays, but would just make tests longer.
457+
testTTL :: TTL
458+
testTTL = 5
459+
455460
recordNetwork :: HydraNode tx IO -> IO (HydraNode tx IO, IO [Message tx])
456461
recordNetwork node = do
457462
(record, query) <- messageRecorder

0 commit comments

Comments
 (0)