Skip to content

Commit d85b45b

Browse files
authored
Merge pull request #5357 from IntersectMBO/coot/submitTxToMempool-result
tx-submission v2: return results in submitTxToMempool
2 parents 0e84bce + 5285cdd commit d85b45b

2 files changed

Lines changed: 27 additions & 2 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!--
2+
A new scriv changelog fragment.
3+
4+
Uncomment the section that is right (remove the HTML comment wrapper).
5+
For top level release notes, leave all the headers commented out.
6+
-->
7+
8+
### Breaking
9+
10+
- `submitTxToMempool` returns the `TxMempoolResult`
11+
12+
<!--
13+
### Non-Breaking
14+
15+
- A bullet item for the Non-Breaking category.
16+
17+
-->
18+
<!--
19+
### Patch
20+
21+
- A bullet item for the Patch category.
22+
23+
-->

ouroboros-network/lib/Ouroboros/Network/TxSubmission/Inbound/V2/Registry.hs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ module Ouroboros.Network.TxSubmission.Inbound.V2.Registry
88
( TxChannels (..)
99
, TxChannelsVar
1010
, TxMempoolSem
11+
, TxMempoolResult (..)
1112
, SharedTxStateVar
1213
, newSharedTxStateVar
1314
, newTxChannelsVar
@@ -85,7 +86,7 @@ data PeerTxAPI m txid tx = PeerTxAPI {
8586
-- ^ handle received txs
8687

8788
submitTxToMempool :: Tracer m (TraceTxSubmissionInbound txid tx)
88-
-> txid -> tx -> m ()
89+
-> txid -> tx -> m TxMempoolResult
8990
-- ^ submit the given (txid, tx) to the mempool.
9091
}
9192

@@ -248,7 +249,7 @@ withPeer tracer
248249
-- PeerTxAPI
249250
--
250251

251-
submitTxToMempool :: Tracer m (TraceTxSubmissionInbound txid tx) -> txid -> tx -> m ()
252+
submitTxToMempool :: Tracer m (TraceTxSubmissionInbound txid tx) -> txid -> tx -> m TxMempoolResult
252253
submitTxToMempool txTracer txid tx =
253254
bracket_ (atomically $ waitTSem mempoolSem)
254255
(atomically $ signalTSem mempoolSem)
@@ -261,6 +262,7 @@ withPeer tracer
261262
case res of
262263
TxAccepted -> traceWith txTracer (TraceTxInboundAddedToMempool [txid] duration)
263264
TxRejected -> traceWith txTracer (TraceTxInboundRejectedFromMempool [txid] duration)
265+
return res
264266

265267
where
266268
-- add the tx to the mempool

0 commit comments

Comments
 (0)