File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
ouroboros-network/src/Ouroboros/Network/TxSubmission/Mempool Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -60,7 +60,11 @@ getReader :: forall tx txid m.
6060 -> Mempool m tx
6161 -> TxSubmissionMempoolReader txid tx Int m
6262getReader getTxId getTxSize (Mempool mempool) =
63- TxSubmissionMempoolReader { mempoolGetSnapshot, mempoolZeroIdx = 0 }
63+ -- Using `0`-based index. `mempoolZeroIdx = -1` so that
64+ -- `mempoolTxIdsAfter mempoolZeroIdx` returns all txs.
65+ TxSubmissionMempoolReader { mempoolGetSnapshot,
66+ mempoolZeroIdx = - 1
67+ }
6468 where
6569 mempoolGetSnapshot :: STM m (MempoolSnapshot txid tx Int )
6670 mempoolGetSnapshot = getSnapshot <$> readTVar mempool
@@ -69,10 +73,9 @@ getReader getTxId getTxSize (Mempool mempool) =
6973 -> MempoolSnapshot txid tx Int
7074 getSnapshot seq =
7175 MempoolSnapshot {
72- mempoolTxIdsAfter =
73- \ idx -> zipWith f [idx + 1 .. ] (toList $ Seq. drop idx seq ),
74- -- why do I need to use `pred`?
75- mempoolLookupTx = flip Seq. lookup seq . pred ,
76+ mempoolTxIdsAfter = \ idx -> zipWith f [idx + 1 .. ]
77+ (toList $ Seq. drop (idx + 1 ) seq ),
78+ mempoolLookupTx = \ idx -> Seq. lookup idx seq ,
7679 mempoolHasTx = \ txid -> isJust $ find (\ tx -> getTxId tx == txid) seq
7780 }
7881
You can’t perform that action at this time.
0 commit comments