@@ -25,6 +25,8 @@ module Ouroboros.Network.Protocol.TxSubmission2.Server
2525 ) where
2626
2727import Data.List.NonEmpty (NonEmpty )
28+ import Data.Map.Strict (Map )
29+ import Data.Map.Strict qualified as Map
2830
2931import Network.TypedProtocol.Core
3032import Network.TypedProtocol.Peer.Server
@@ -51,7 +53,7 @@ data Collect txid tx =
5153 -- contains the transactions sent, but this pairs them up with the
5254 -- transactions requested. This is because the peer can determine that
5355 -- some transactions are no longer needed.
54- | CollectTxs [ txid ] [tx ]
56+ | CollectTxs ( Map txid SizeInBytes ) [tx ]
5557
5658
5759data ServerStIdle (n :: N ) txid tx m a where
@@ -77,16 +79,16 @@ data ServerStIdle (n :: N) txid tx m a where
7779 -- |
7880 --
7981 SendMsgRequestTxsPipelined
80- :: [ txid ]
82+ :: Map txid SizeInBytes
8183 -> m (ServerStIdle (S n ) txid tx m a )
8284 -> ServerStIdle n txid tx m a
8385
8486 -- | Collect a pipelined result.
8587 --
8688 CollectPipelined
87- :: Maybe (ServerStIdle (S n ) txid tx m a )
88- -> (Collect txid tx -> m (ServerStIdle n txid tx m a ))
89- -> ServerStIdle (S n ) txid tx m a
89+ :: Maybe (m ( ServerStIdle (S n ) txid tx m a ) )
90+ -> (Collect txid tx -> m ( ServerStIdle n txid tx m a ))
91+ -> ServerStIdle (S n ) txid tx m a
9092
9193
9294-- | Transform a 'TxSubmissionServerPipelined' into a 'PeerPipelined'.
@@ -127,12 +129,12 @@ txSubmissionServerPeerPipelined (TxSubmissionServerPipelined server) =
127129
128130 go (SendMsgRequestTxsPipelined txids k) =
129131 YieldPipelined
130- (MsgRequestTxs txids)
132+ (MsgRequestTxs $ Map. keys txids)
131133 (ReceiverAwait \ case
132134 MsgReplyTxs txs -> ReceiverDone (CollectTxs txids txs))
133135 (Effect (go <$> k))
134136
135137 go (CollectPipelined mNone collect) =
136- Collect (fmap go mNone)
137- (Effect . fmap go . collect)
138+ Collect (Effect . fmap go <$> mNone)
139+ (Effect . fmap go . collect)
138140
0 commit comments