Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ data NodeToClientVersion
-- ^ new codecs for @PParams@ and @CompactGenesis@
| NodeToClientV_22
-- ^ support SRV records in @GetBigLedgerPeerSnapshot@ query
| NodeToClientV_23
-- ^ added @QueryDRepsDelegations@,
deriving (Eq, Ord, Enum, Bounded, Show, Generic, NFData)

-- | We set 16ths bit to distinguish `NodeToNodeVersion` and
Expand All @@ -76,6 +78,7 @@ nodeToClientVersionCodec = CodecCBORTerm { encodeTerm, decodeTerm }
NodeToClientV_20 -> enc 20
NodeToClientV_21 -> enc 21
NodeToClientV_22 -> enc 22
NodeToClientV_23 -> enc 23
where
enc :: Int -> CBOR.Term
enc = CBOR.TInt . (`setBit` nodeToClientVersionBit)
Expand All @@ -89,6 +92,7 @@ nodeToClientVersionCodec = CodecCBORTerm { encodeTerm, decodeTerm }
20 -> Right NodeToClientV_20
21 -> Right NodeToClientV_21
22 -> Right NodeToClientV_22
23 -> Right NodeToClientV_23
n -> Left (unknownTag n)
where
dec :: CBOR.Term -> Either (Text, Maybe Int) Int
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ instance FromJSON NodeToClientVersion where
Number 20 -> pure NodeToClientV_20
Number 21 -> pure NodeToClientV_21
Number 22 -> pure NodeToClientV_22
Number 23 -> pure NodeToClientV_23
Number x -> fail $ "FromJSON.NodeToClientVersion: unsupported node-to-client protocol version " ++ show x
x -> fail $ "FromJSON.NodeToClientVersion: error parsing NodeToClientVersion: " ++ show x

Expand All @@ -95,6 +96,7 @@ instance ToJSON NodeToClientVersion where
NodeToClientV_20 -> Number 20
NodeToClientV_21 -> Number 21
NodeToClientV_22 -> Number 22
NodeToClientV_23 -> Number 23

instance ToJSON NodeToNodeVersionData where
toJSON (NodeToNodeVersionData (NetworkMagic m) dm ps q) = object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ versionTable = { * versionNumber => nodeToClientVersionData }


; as of version 2 (which is no longer supported) we set 16th bit to 1
; 16 / 17 / 18 / 19 / 20 / 21 / 22
versionNumber = 32784 / 32785 / 32786 / 32787 / 32788 / 32789 / 32790
; 16 / 17 / 18 / 19 / 20 / 21 / 22 / 23
versionNumber = 32784 / 32785 / 32786 / 32787 / 32788 / 32789 / 32790 / 32791

; As of version 15 and higher
nodeToClientVersionData = [networkMagic, query]

networkMagic = uint
networkMagic = uint
query = bool

refuseReason
Expand Down
Loading