Skip to content
Permalink
Browse files

WIP codecTxSubmissionId

  • Loading branch information...
mrBliss committed Jul 12, 2019
1 parent fb48f1c commit 3521396e54f35efb2b2b14f56acad19f6df4d5fa
Showing with 18 additions and 0 deletions.
  1. +18 −0 ouroboros-network/src/Ouroboros/Network/Protocol/TxSubmission/Codec.hs
@@ -8,6 +8,7 @@

module Ouroboros.Network.Protocol.TxSubmission.Codec (
codecTxSubmission
, codecTxSubmissionId
) where

import Control.Monad.Class.MonadST
@@ -139,3 +140,20 @@ codecTxSubmission encodeTxId decodeTxId
(ClientAgency TokTxs, _, _) ->
fail "codecTxSubmission.Tx: unexpected message key"

codecTxSubmissionId
:: forall txid tx m. Monad m
=> Codec (TxSubmission txid tx) CodecFailure m (AnyMessage (TxSubmission txid tx))
codecTxSubmissionId = Codec encode decode
where
encode :: forall (pr :: PeerRole) st st'.
PeerHasAgency pr st
-> Message (TxSubmission txid tx) st st'
-> AnyMessage (TxSubmission txid tx)
encode _ = AnyMessage

decode :: forall (pr :: PeerRole) st.
PeerHasAgency pr st
-> m (DecodeStep (AnyMessage (TxSubmission txid tx))
CodecFailure m (SomeMessage st))
decode stok = return $ DecodePartial $ \bytes -> case (stok, bytes) of
_ -> error "TODO"

0 comments on commit 3521396

Please sign in to comment.
You can’t perform that action at this time.