File tree 3 files changed +29
-28
lines changed
ouroboros-network/src/Ouroboros/Network/TxSubmission/Inbound
3 files changed +29
-28
lines changed Original file line number Diff line number Diff line change @@ -315,15 +315,14 @@ txSubmissionInbound tracer initDelay (NumTxIdsToAck maxUnacked) mpReader mpWrite
315
315
txidsAccepted <- mempoolAddTxs txsReady
316
316
! end <- getMonotonicTime
317
317
let duration = diffTime end start
318
- traceWith tracer $
319
- TraceTxInboundAddedToMempool txidsAccepted duration
320
318
let ! accepted = length txidsAccepted
321
319
322
320
traceWith tracer $ TraceTxSubmissionProcessed ProcessedTxCount {
323
321
ptxcAccepted = accepted
324
322
, ptxcRejected = length txs - accepted
325
323
, ptxcScore = 0 -- This implementatin does not track score
326
324
}
325
+ duration
327
326
328
327
continueWithStateM (serverIdle n) st {
329
328
bufferedTxs = bufferedTxs3,
Original file line number Diff line number Diff line change @@ -256,18 +256,16 @@ withPeer tracer
256
256
bracket_ (atomically $ waitTSem mempoolSem)
257
257
(atomically $ signalTSem mempoolSem)
258
258
$ do
259
- res <- addTx
259
+ ( res, cnts) <- addTx
260
260
start <- getMonotonicTime
261
261
atomically $ modifyTVar sharedStateVar (updateBufferedTx start res)
262
262
end <- getMonotonicTime
263
263
let duration = end `diffTime` start
264
- case res of
265
- TxAccepted -> traceWith txTracer (TraceTxInboundAddedToMempool [txid] duration)
266
- TxRejected -> traceWith txTracer (TraceTxInboundRejectedFromMempool [txid] duration)
264
+ traceWith txTracer (TraceTxSubmissionProcessed cnts duration)
267
265
268
266
where
269
267
-- add the tx to the mempool
270
- addTx :: m TxMempoolResult
268
+ addTx :: m ( TxMempoolResult , ProcessedTxCount )
271
269
addTx = do
272
270
mpSnapshot <- atomically mempoolGetSnapshot
273
271
@@ -278,32 +276,38 @@ withPeer tracer
278
276
then do
279
277
! now <- getMonotonicTime
280
278
! s <- countRejectedTxs now 1
281
- traceWith txTracer $ TraceTxSubmissionProcessed ProcessedTxCount {
282
- ptxcAccepted = 0
283
- , ptxcRejected = 1
284
- , ptxcScore = s
285
- }
286
- return TxRejected
279
+ return
280
+ ( TxRejected
281
+ , ProcessedTxCount {
282
+ ptxcAccepted = 0
283
+ , ptxcRejected = 1
284
+ , ptxcScore = s
285
+ }
286
+ )
287
287
else do
288
288
acceptedTxs <- mempoolAddTxs [tx]
289
289
end <- getMonotonicTime
290
290
if null acceptedTxs
291
291
then do
292
292
! s <- countRejectedTxs end 1
293
- traceWith txTracer $ TraceTxSubmissionProcessed ProcessedTxCount {
294
- ptxcAccepted = 0
295
- , ptxcRejected = 1
296
- , ptxcScore = s
297
- }
298
- return TxRejected
293
+ return
294
+ ( TxRejected
295
+ , ProcessedTxCount {
296
+ ptxcAccepted = 0
297
+ , ptxcRejected = 1
298
+ , ptxcScore = s
299
+ }
300
+ )
299
301
else do
300
302
! s <- countRejectedTxs end 0
301
- traceWith txTracer $ TraceTxSubmissionProcessed ProcessedTxCount {
302
- ptxcAccepted = 1
303
- , ptxcRejected = 0
304
- , ptxcScore = s
305
- }
306
- return TxAccepted
303
+ return
304
+ ( TxAccepted
305
+ , ProcessedTxCount {
306
+ ptxcAccepted = 1
307
+ , ptxcRejected = 0
308
+ , ptxcScore = s
309
+ }
310
+ )
307
311
308
312
updateBufferedTx :: Time
309
313
-> TxMempoolResult
Original file line number Diff line number Diff line change @@ -362,11 +362,9 @@ data TraceTxSubmissionInbound txid tx =
362
362
-- | Number of transactions just about to be inserted.
363
363
TraceTxSubmissionCollected [txid ]
364
364
-- | Just processed transaction pass/fail breakdown.
365
- | TraceTxSubmissionProcessed ProcessedTxCount
365
+ | TraceTxSubmissionProcessed ProcessedTxCount DiffTime
366
366
| TraceTxInboundCanRequestMoreTxs Int
367
367
| TraceTxInboundCannotRequestMoreTxs Int
368
- | TraceTxInboundAddedToMempool [txid ] DiffTime
369
- | TraceTxInboundRejectedFromMempool [txid ] DiffTime
370
368
371
369
--
372
370
-- messages emitted by the new implementation of the server in
You can’t perform that action at this time.
0 commit comments