|
12 | 12 | -- | Legacy `tx-submission` inbound peer.
|
13 | 13 | --
|
14 | 14 | module Ouroboros.Network.TxSubmission.Inbound
|
15 |
| - ( txSubmissionInbound |
16 |
| - , TxSubmissionMempoolWriter (..) |
17 |
| - , TraceTxSubmissionInbound (..) |
18 |
| - , TxSubmissionProtocolError (..) |
| 15 | + ( -- * New Tx-Submission server |
| 16 | + module Server |
| 17 | + , module Types |
| 18 | + , module Decision |
| 19 | + , module Registry |
| 20 | + , module Policy |
| 21 | + -- * Legacy Tx-Submission server |
| 22 | + , txSubmissionInbound |
19 | 23 | , ProcessedTxCount (..)
|
20 | 24 | ) where
|
21 | 25 |
|
@@ -47,70 +51,19 @@ import Ouroboros.Network.NodeToNode.Version (NodeToNodeVersion)
|
47 | 51 | import Ouroboros.Network.Protocol.Limits
|
48 | 52 | import Ouroboros.Network.Protocol.TxSubmission2.Server
|
49 | 53 | import Ouroboros.Network.Protocol.TxSubmission2.Type
|
50 |
| -import Ouroboros.Network.TxSubmission.Inbound.Decision (TxDecision) |
51 | 54 | import Ouroboros.Network.TxSubmission.Mempool.Reader (MempoolSnapshot (..),
|
52 | 55 | TxSubmissionMempoolReader (..))
|
53 | 56 |
|
54 |
| --- | The consensus layer functionality that the inbound side of the tx |
55 |
| --- submission logic requires. |
56 | 57 | --
|
57 |
| --- This is provided to the tx submission logic by the consensus layer. |
| 58 | +-- re-exports |
58 | 59 | --
|
59 |
| -data TxSubmissionMempoolWriter txid tx idx m = |
60 |
| - TxSubmissionMempoolWriter { |
61 | 60 |
|
62 |
| - -- | Compute the transaction id from a transaction. |
63 |
| - -- |
64 |
| - -- This is used in the protocol handler to verify a full transaction |
65 |
| - -- matches a previously given transaction id. |
66 |
| - -- |
67 |
| - txId :: tx -> txid, |
| 61 | +import Ouroboros.Network.TxSubmission.Inbound.Types as Types |
| 62 | +import Ouroboros.Network.TxSubmission.Inbound.Decision as Decision |
| 63 | +import Ouroboros.Network.TxSubmission.Inbound.Registry as Registry |
| 64 | +import Ouroboros.Network.TxSubmission.Inbound.Policy as Policy |
| 65 | +import Ouroboros.Network.TxSubmission.Inbound.Server as Server |
68 | 66 |
|
69 |
| - -- | Supply a batch of transactions to the mempool. They are either |
70 |
| - -- accepted or rejected individually, but in the order supplied. |
71 |
| - -- |
72 |
| - -- The 'txid's of all transactions that were added successfully are |
73 |
| - -- returned. |
74 |
| - mempoolAddTxs :: [tx] -> m [txid] |
75 |
| - } |
76 |
| - |
77 |
| -data ProcessedTxCount = ProcessedTxCount { |
78 |
| - -- | Just accepted this many transactions. |
79 |
| - ptxcAccepted :: Int |
80 |
| - -- | Just rejected this many transactions. |
81 |
| - , ptxcRejected :: Int |
82 |
| - } |
83 |
| - deriving (Eq, Show) |
84 |
| - |
85 |
| -data TraceTxSubmissionInbound txid tx = |
86 |
| - -- | Number of transactions just about to be inserted. |
87 |
| - TraceTxSubmissionCollected Int |
88 |
| - -- | Just processed transaction pass/fail breakdown. |
89 |
| - | TraceTxSubmissionProcessed ProcessedTxCount |
90 |
| - -- | Server received 'MsgDone' |
91 |
| - | TraceTxInboundCanRequestMoreTxs Int |
92 |
| - | TraceTxInboundCannotRequestMoreTxs Int |
93 |
| - |
94 |
| - -- |
95 |
| - -- messages emitted by the new implementation of the server in |
96 |
| - -- "Ouroboros.Network.TxSubmission.Inbound.Server"; some of them are also |
97 |
| - -- used in this module. |
98 |
| - -- |
99 |
| - |
100 |
| - | TraceTxInboundTerminated |
101 |
| - | TraceTxInboundDecision (TxDecision txid tx) |
102 |
| - deriving (Eq, Show) |
103 |
| - |
104 |
| -data TxSubmissionProtocolError = |
105 |
| - ProtocolErrorTxNotRequested |
106 |
| - | ProtocolErrorTxIdsNotRequested |
107 |
| - deriving Show |
108 |
| - |
109 |
| -instance Exception TxSubmissionProtocolError where |
110 |
| - displayException ProtocolErrorTxNotRequested = |
111 |
| - "The peer replied with a transaction we did not ask for." |
112 |
| - displayException ProtocolErrorTxIdsNotRequested = |
113 |
| - "The peer replied with more txids than we asked for." |
114 | 67 |
|
115 | 68 |
|
116 | 69 | -- | Information maintained internally in the 'txSubmissionInbound' server
|
|
0 commit comments