Skip to content

Commit e291414

Browse files
committed
Rename isTxAdded and isTxRejected functions
1 parent a9bebb3 commit e291414

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

ouroboros-consensus/src/Ouroboros/Consensus/Mempool/API.hs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ module Ouroboros.Consensus.Mempool.API (
1717
, HasTxId(..)
1818
, GenTxId
1919
, MempoolAddTxResult (..)
20-
, isTxAdded
21-
, isTxRejected
20+
, isMempoolTxAdded
21+
, isMempoolTxRejected
2222
, MempoolSize (..)
2323
, TraceEventMempool(..)
2424
, HasTxs(..)
@@ -242,13 +242,13 @@ data MempoolAddTxResult blk
242242
deriving instance Eq (ApplyTxErr blk) => Eq (MempoolAddTxResult blk)
243243
deriving instance Show (ApplyTxErr blk) => Show (MempoolAddTxResult blk)
244244

245-
isTxAdded :: MempoolAddTxResult blk -> Bool
246-
isTxAdded MempoolTxAdded = True
247-
isTxAdded _ = False
245+
isMempoolTxAdded :: MempoolAddTxResult blk -> Bool
246+
isMempoolTxAdded MempoolTxAdded = True
247+
isMempoolTxAdded _ = False
248248

249-
isTxRejected :: MempoolAddTxResult blk -> Bool
250-
isTxRejected (MempoolTxRejected _) = True
251-
isTxRejected _ = False
249+
isMempoolTxRejected :: MempoolAddTxResult blk -> Bool
250+
isMempoolTxRejected (MempoolTxRejected _) = True
251+
isMempoolTxRejected _ = False
252252

253253
-- | Wrapper around 'implTryAddTxs' that blocks until all transaction have
254254
-- either been added to the Mempool or rejected.

ouroboros-consensus/src/Ouroboros/Consensus/NodeKernel.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,6 @@ getMempoolWriter
630630
getMempoolWriter mempool = Inbound.TxSubmissionMempoolWriter
631631
{ Inbound.txId = txId
632632
, mempoolAddTxs = \txs ->
633-
map (txId . fst) . filter (isTxAdded . snd) <$>
633+
map (txId . fst) . filter (isMempoolTxAdded . snd) <$>
634634
addTxs mempool txs
635635
}

ouroboros-consensus/test-consensus/Test/Consensus/Mempool.hs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ prop_Mempool_addTxs_result setup =
114114
withTestMempool (testSetup setup) $ \TestMempool { mempool } -> do
115115
result <- addTxs mempool (allTxs setup)
116116
return $ counterexample (ppTxs (txs setup)) $
117-
[(tx, isTxAdded res) | (tx, res) <- result] ===
118-
[(testTx, valid) | (testTx, valid) <- txs setup]
117+
[(tx, isMempoolTxAdded res) | (tx, res) <- result] ===
118+
[(testTx, valid) | (testTx, valid) <- txs setup]
119119

120120
-- | Test that invalid transactions are never added to the 'Mempool'.
121121
prop_Mempool_InvalidTxsNeverAdded :: TestSetupWithTxs -> Property
@@ -186,13 +186,13 @@ prop_Mempool_Capacity (MempoolCapTestSetup testSetupWithTxs) =
186186
MempoolCapacityBytes capacity = testMempoolCap testSetup
187187

188188
-- | Convert 'MempoolAddTxResult' into a 'Bool':
189-
-- isTxAdded -> True, isTxRejected -> False.
189+
-- isMempoolTxAdded -> True, isMempoolTxRejected -> False.
190190
blindErrors
191191
:: ([(GenTx TestBlock, MempoolAddTxResult blk)], [GenTx TestBlock])
192192
-> ([(GenTx TestBlock, Bool)], [GenTx TestBlock])
193193
blindErrors (processed, toAdd) = (processed', toAdd)
194194
where
195-
processed' = [ (tx, isTxAdded txAddRes)
195+
processed' = [ (tx, isMempoolTxAdded txAddRes)
196196
| (tx, txAddRes) <- processed ]
197197

198198
expectedResult
@@ -670,8 +670,8 @@ withTestMempool setup@TestSetup { testLedgerState, testInitialTxs, testMempoolCa
670670
result <- addTxs mempool testInitialTxs
671671
-- the invalid transactions are reported in the same order they were
672672
-- added, so the first error is not the result of a cascade
673-
whenJust (find (isTxRejected . snd) result) $ \(invalidTx, _) -> error $
674-
"Invalid initial transaction: " <> condense invalidTx
673+
whenJust (find (isMempoolTxRejected . snd) result) $ \(invalidTx, _) ->
674+
error $ "Invalid initial transaction: " <> condense invalidTx
675675

676676
-- Clear the trace
677677
atomically $ writeTVar varEvents []

0 commit comments

Comments
 (0)