Skip to content

Commit

Permalink
Added callback providing tx size to txSubmission{Inbound, Outbound}
Browse files Browse the repository at this point in the history
  • Loading branch information
crocodile-dentist committed Aug 9, 2024
1 parent bb98a12 commit 6ed20d5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import Network.TypedProtocol.Pipelined (N, Nat (..), natToInt)

import Ouroboros.Network.NodeToNode.Version (NodeToNodeVersion)
import Ouroboros.Network.Protocol.TxSubmission2.Server
import Ouroboros.Network.SizeInBytes
import Ouroboros.Network.Protocol.TxSubmission2.Type
import Ouroboros.Network.TxSubmission.Mempool.Reader (MempoolSnapshot (..),
TxSubmissionMempoolReader (..))
Expand Down Expand Up @@ -181,9 +182,10 @@ txSubmissionInbound
-> NumTxIdsToAck -- ^ Maximum number of unacknowledged txids allowed
-> TxSubmissionMempoolReader txid tx idx m
-> TxSubmissionMempoolWriter txid tx idx m
-> (tx -> SizeInBytes) -- ^ get size of CBOR encoded transaction
-> NodeToNodeVersion
-> TxSubmissionServerPipelined txid tx m ()
txSubmissionInbound tracer (NumTxIdsToAck maxUnacked) mpReader mpWriter _version =
txSubmissionInbound tracer (NumTxIdsToAck maxUnacked) mpReader mpWriter _txSize _version =
TxSubmissionServerPipelined $
continueWithStateM (serverIdle Zero) initialServerState
where
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import Ouroboros.Network.ControlMessage (ControlMessage, ControlMessageSTM,
timeoutWithControlMessage)
import Ouroboros.Network.NodeToNode.Version (NodeToNodeVersion)
import Ouroboros.Network.Protocol.TxSubmission2.Client
import Ouroboros.Network.SizeInBytes
import Ouroboros.Network.Protocol.TxSubmission2.Type
import Ouroboros.Network.TxSubmission.Mempool.Reader (MempoolSnapshot (..),
TxSubmissionMempoolReader (..))
Expand Down Expand Up @@ -80,10 +81,11 @@ txSubmissionOutbound
=> Tracer m (TraceTxSubmissionOutbound txid tx)
-> NumTxIdsToAck -- ^ Maximum number of unacknowledged txids allowed
-> TxSubmissionMempoolReader txid tx idx m
-> (tx -> SizeInBytes) -- ^ get size of CBOR encoded transaction
-> NodeToNodeVersion
-> ControlMessageSTM m
-> TxSubmissionClient txid tx m ()
txSubmissionOutbound tracer maxUnacked TxSubmissionMempoolReader{..} _version controlMessageSTM =
txSubmissionOutbound tracer maxUnacked TxSubmissionMempoolReader{..} _txSize _version controlMessageSTM =
TxSubmissionClient (pure (client Seq.empty mempoolZeroIdx))
where
client :: StrictSeq (txid, idx) -> idx -> ClientStIdle txid tx m ()
Expand Down

0 comments on commit 6ed20d5

Please sign in to comment.