Skip to content

Commit 91e4938

Browse files
committed
simulation: accumulate number of votes rather than vote msgs
1 parent 8ede260 commit 91e4938

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

simulation/src/LeiosProtocol/Short/VizSim.hs

+6-1
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ leiosSimVizModel =
300300
}
301301
EventVote x ->
302302
vs
303-
{ voteMsgs = accumLeiosMsgs now nid event x vs.voteMsgs
303+
{ voteMsgs = adjustNumVotes event x $ accumLeiosMsgs now nid event x vs.voteMsgs
304304
, voteDiffusionLatency = accumDiffusionLatency' now nid event x.id x vs.voteDiffusionLatency
305305
}
306306
accumEventVizState now (LeiosEventNode (LabelNode nid (PraosNodeEvent (PraosNodeEventGenerate blk)))) vs =
@@ -420,6 +420,11 @@ leiosSimVizModel =
420420
secondsAgo30 :: Time
421421
secondsAgo30 = addTime (-30) now
422422

423+
-- | Vote messages contain multiple votes each, so we bump the count by that amount
424+
adjustNumVotes :: BlockEvent -> VoteMsg -> LeiosSimVizMsgsState VoteId VoteMsg -> LeiosSimVizMsgsState VoteId VoteMsg
425+
adjustNumVotes Generate msg vs = vs{numMsgsGenerated = numMsgsGenerated vs + fromIntegral msg.votes - 1}
426+
adjustNumVotes _ _ vs = vs
427+
423428
initMsgs :: LeiosSimVizMsgsState id msg
424429
initMsgs =
425430
LeiosSimVizMsgsState

0 commit comments

Comments
 (0)