From 3e64582b6bce408a03b20af3f9f191fe70fcb347 Mon Sep 17 00:00:00 2001 From: Sebastian Nagel Date: Wed, 21 Jul 2021 12:54:00 +0200 Subject: [PATCH] Reset "balance" on SnapshotDone --- src/Hydra/Tail/Simulation.hs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Hydra/Tail/Simulation.hs b/src/Hydra/Tail/Simulation.hs index 22941bc..49f48f8 100644 --- a/src/Hydra/Tail/Simulation.hs +++ b/src/Hydra/Tail/Simulation.hs @@ -188,6 +188,13 @@ analyzeSimulation notify trace = do , sl ) ) + (_threadLabel, Time _t, TraceClient (TraceClientSnapshotDone clientId)) -> + ( \(!m, !sl) -> + pure + ( Map.alter (updateBalance (const 0)) clientId m + , sl + ) + ) (_threadLabel, _time, TraceClient (TraceClientWakeUp sl')) -> ( \(!m, !sl) -> if sl' > sl @@ -635,6 +642,7 @@ runClient tracer events serverId opts Client{multiplexer, identifier} = do threadDelay settlementDelay_ sendTo multiplexer serverId SnapshotDone pure st + traceWith tracer (TraceClientSnapshotDone identifier) (nodeId, msg) -> throwIO $ UnexpectedClientMsg nodeId msg where @@ -728,6 +736,7 @@ data TraceClient | TraceClientWakeUp SlotNo | TraceClientAck ClientId MockTx | TraceClientNotify ClientId MockTx + | TraceClientSnapshotDone ClientId deriving (Show) --