Skip to content

Commit

Permalink
Merge pull request #4685 from input-output-hk/ch1bo/cardano-api-chain…
Browse files Browse the repository at this point in the history
…-point-ord-instance

[cardano-api] Add an Ord ChainPoint instance
  • Loading branch information
Jimbo4350 authored Dec 8, 2022
2 parents fe5508a + b8460b1 commit 4d416ff
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cardano-api/src/Cardano/Api/Block.hs
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,11 @@ data ChainPoint = ChainPointAtGenesis
| ChainPoint !SlotNo !(Hash BlockHeader)
deriving (Eq, Show)

instance Ord ChainPoint where
compare ChainPointAtGenesis ChainPointAtGenesis = EQ
compare ChainPointAtGenesis _ = LT
compare _ ChainPointAtGenesis = GT
compare (ChainPoint sn _) (ChainPoint sn' _) = compare sn sn'

toConsensusPointInMode :: ConsensusMode mode
-> ChainPoint
Expand Down

0 comments on commit 4d416ff

Please sign in to comment.