Skip to content

Commit 784531d

Browse files
committed
Trace TraceTxSubmissionOutboundSendMsgReplyTxs events after txs are sent
1 parent 6d5873a commit 784531d

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

ouroboros-network/protocol-tests/Ouroboros/Network/Protocol/TxSubmission/Direct.hs

+2-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ directPipelined (TxSubmissionServerPipelined mserver)
5353
directSender q (SendMsgRequestTxsPipelined txids serverNext)
5454
ClientStIdle{recvMsgRequestTxs} = do
5555
server' <- serverNext
56-
SendMsgReplyTxs txs client' <- recvMsgRequestTxs txids
56+
SendMsgReplyTxs txs onTxsSent client' <- recvMsgRequestTxs txids
57+
_ <- onTxsSent txs
5758
directSender (enqueue (CollectTxs txids txs) q) server' client'
5859

5960
directSender q (CollectPipelined (Just server') _) client =

ouroboros-network/protocol-tests/Ouroboros/Network/Protocol/TxSubmission/Examples.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ txSubmissionClient tracer txId txSize maxUnacked =
141141
traceWith tracer (EventRecvMsgRequestTxs unackedSeq unackedMap
142142
remainingTxs txids)
143143
case [ txid | txid <- txids, txid `Map.notMember` unackedMap ] of
144-
[] -> pure (SendMsgReplyTxs txs client')
144+
[] -> pure (SendMsgReplyTxs txs (const $ pure ()) client')
145145
where
146146
txs = map (unackedMap Map.!) txids
147147
client' = client unackedSeq unackedMap' remainingTxs

ouroboros-network/src/Ouroboros/Network/Protocol/TxSubmission/Client.hs

+3-3
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ data ClientStTxIds blocking txid tx m a where
8080

8181
data ClientStTxs txid tx m a where
8282
SendMsgReplyTxs :: [tx]
83+
-> ([tx] -> m ())
8384
-> ClientStIdle txid tx m a
8485
-> ClientStTxs txid tx m a
8586

@@ -110,8 +111,7 @@ txSubmissionClientPeer (TxSubmissionClient client) =
110111
(Done TokDone result)
111112

112113
MsgRequestTxs txids -> Effect $ do
113-
SendMsgReplyTxs txs k <- recvMsgRequestTxs txids
114+
SendMsgReplyTxs txs onTxsSent k <- recvMsgRequestTxs txids
114115
return $ Yield (ClientAgency TokTxs)
115116
(MsgReplyTxs txs)
116-
(go k)
117-
117+
(Effect $ onTxsSent txs >> return (go k))

ouroboros-network/src/Ouroboros/Network/TxSubmission/Outbound.hs

+3-3
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ txSubmissionOutbound tracer maxUnacked TxSubmissionMempoolReader{..} =
189189
!unackedMap' = foldl' (flip Map.delete) unackedMap txids
190190
client' = client unackedSeq unackedMap' lastIdx
191191

192-
-- Trace the transactions to be sent in the response.
193-
traceWith tracer (TraceTxSubmissionOutboundSendMsgReplyTxs txs)
192+
-- Trace the transactions to be sent in the response.
193+
traceTxsSent = traceWith tracer . TraceTxSubmissionOutboundSendMsgReplyTxs
194194

195-
return $ SendMsgReplyTxs txs client'
195+
return $ SendMsgReplyTxs txs traceTxsSent client'

0 commit comments

Comments
 (0)