Skip to content

Commit 3258afe

Browse files
committed
WIP: questions & todos
1 parent 816ed20 commit 3258afe

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

ouroboros-network/src/Ouroboros/Network/TxSubmission/Inbound/Registry.hs

+5
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ data PeerTxAPI m txid tx = PeerTxAPI {
100100

101101
withMempoolSem :: m (Either (txid, tx) (txid, tx))
102102
-> m (Either (txid, tx) (txid, tx))
103+
-- TODO:
104+
-- the split into `addTx` in the `Server` and `withMempoolSem` is artificial.
105+
-- Better exose: `addTxToMempool :: txid -> tx -> m ()` which composes both
106+
-- actions. We can ignore the result, since it is ignored in the `Server`.
103107
}
104108

105109

@@ -239,6 +243,7 @@ withPeer tracer
239243
inflightTxs' = foldl' purgeInflightTxs inflightTxs requestedTxsInflight
240244
inflightTxsSize' = inflightTxsSize - requestedTxsInflightSize
241245

246+
-- TODO: describe why we need to add `toMempoolTxs` to `limboTxs`.
242247
limboTxs' =
243248
foldl' (flip $ Map.update
244249
\cnt -> if cnt > 1

ouroboros-network/src/Ouroboros/Network/TxSubmission/Inbound/State.hs

+2
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ acknowledgeTxIds
145145
, 0
146146
, TxsToMempool []
147147
, RefCountDiff Map.empty
148+
-- Q: why we don't return `toMempoolTxs'` in this case?
148149
, ps
149150
)
150151
where
@@ -241,6 +242,7 @@ tickTimedTxs now st@SharedTxState{ timedTxs
241242
, bufferedTxs } =
242243
let (expiredTxs, timedTxs') = Map.split now timedTxs
243244
expiredTxs' = -- Map.split doesn't include the `now` entry in any map
245+
-- TODO: there must be a better way.
244246
case Map.lookup now timedTxs of
245247
Just txids -> Map.insert now txids expiredTxs
246248
Nothing -> expiredTxs

0 commit comments

Comments
 (0)