@@ -20,33 +20,35 @@ import DMQ.Protocol.SigSubmission.Type (Sig (..))
20
20
21
21
import Network.TypedProtocol.Codec.CBOR
22
22
import Ouroboros.Network.Protocol.LocalTxSubmission.Codec qualified as LTX
23
+ import Ouroboros.Network.TxSubmission.Mempool.Simple
23
24
24
25
codecLocalMsgSubmission
25
26
:: forall crypto m .
26
27
( MonadST m
27
28
, Crypto crypto
28
29
)
29
- => (SigMempoolFail -> CBOR. Encoding )
30
- -> (forall s . CBOR. Decoder s SigMempoolFail )
30
+ => (MempoolAddFail ( Sig crypto ) -> CBOR. Encoding )
31
+ -> (forall s . CBOR. Decoder s ( MempoolAddFail ( Sig crypto )) )
31
32
-> AnnotatedCodec (LocalMsgSubmission (Sig crypto )) CBOR. DeserialiseFailure m ByteString
32
33
codecLocalMsgSubmission =
33
34
LTX. anncodecLocalTxSubmission' SigWithBytes SigSubmission. encodeSig SigSubmission. decodeSig
34
35
35
- encodeReject :: SigMempoolFail -> CBOR. Encoding
36
- encodeReject = \ case
37
- SigInvalid reason -> CBOR. encodeListLen 2 <> CBOR. encodeWord 0 <> CBOR. encodeString reason
38
- SigDuplicate -> CBOR. encodeListLen 1 <> CBOR. encodeWord 1
39
- SigExpired -> CBOR. encodeListLen 1 <> CBOR. encodeWord 2
40
- SigResultOther reason
41
- -> CBOR. encodeListLen 2 <> CBOR. encodeWord 3 <> CBOR. encodeString reason
42
-
43
- decodeReject :: CBOR. Decoder s SigMempoolFail
44
- decodeReject = do
45
- len <- CBOR. decodeListLen
46
- tag <- CBOR. decodeWord
47
- case (tag, len) of
48
- (0 , 2 ) -> SigInvalid <$> CBOR. decodeString
49
- (1 , 1 ) -> pure SigDuplicate
50
- (2 , 1 ) -> pure SigExpired
51
- (3 , 2 ) -> SigResultOther <$> CBOR. decodeString
52
- _otherwise -> fail $ printf " unrecognized (tag,len) = (%d, %d)" tag len
36
+ encodeReject :: MempoolAddFail (Sig crypto ) -> CBOR. Encoding
37
+ encodeReject = undefined
38
+ -- encodeReject = \case
39
+ -- SigInvalid reason -> CBOR.encodeListLen 2 <> CBOR.encodeWord 0 <> CBOR.encodeString reason
40
+ -- SigDuplicate -> CBOR.encodeListLen 1 <> CBOR.encodeWord 1
41
+ -- SigExpired -> CBOR.encodeListLen 1 <> CBOR.encodeWord 2
42
+ -- SigResultOther reason
43
+ -- -> CBOR.encodeListLen 2 <> CBOR.encodeWord 3 <> CBOR.encodeString reason
44
+
45
+ decodeReject :: CBOR. Decoder s (MempoolAddFail (Sig crypto ))
46
+ decodeReject = return undefined -- do
47
+ -- len <- CBOR.decodeListLen
48
+ -- tag <- CBOR.decodeWord
49
+ -- case (tag, len) of
50
+ -- (0, 2) -> SigInvalid <$> CBOR.decodeString
51
+ -- (1, 1) -> pure SigDuplicate
52
+ -- (2, 1) -> pure SigExpired
53
+ -- (3, 2) -> SigResultOther <$> CBOR.decodeString
54
+ -- _otherwise -> fail $ printf "unrecognized (tag,len) = (%d, %d)" tag len
0 commit comments