Skip to content

Commit

Permalink
Adjust indentation of getBlockHeader
Browse files Browse the repository at this point in the history
  • Loading branch information
Anviking committed Jun 11, 2019
1 parent 6cb662c commit 2189175
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions lib/jormungandr/src/Cardano/Wallet/Jormungandr/Binary.hs
Original file line number Diff line number Diff line change
Expand Up @@ -103,27 +103,27 @@ data SignedVote = SignedVote
{-# ANN module ("HLint: ignore Use <$>" :: String) #-}

getBlockHeader :: Get BlockHeader
getBlockHeader = label "getBlockHeader"
$ (fromIntegral <$> getWord16be) >>= \s -> isolate s $ do
version <- getWord16be
contentSize <- getWord32be
slotEpoch <- fromIntegral <$> getWord32be
slotId <- fromIntegral <$> getWord32be
chainLength <- getWord32be
contentHash <- Hash <$> getByteString 32 -- or 256 bits
parentHeaderHash <- Hash <$> getByteString 32

-- TODO: Handle special case for BFT
-- TODO: Handle special case for Praos/Genesis

return $ BlockHeader
{ version
, contentSize
, slot = (SlotId slotId slotEpoch)
, chainLength
, contentHash
, parentHeaderHash
}
getBlockHeader = label "getBlockHeader" $
(fromIntegral <$> getWord16be) >>= \s -> isolate s $ do
version <- getWord16be
contentSize <- getWord32be
slotEpoch <- fromIntegral <$> getWord32be
slotId <- fromIntegral <$> getWord32be
chainLength <- getWord32be
contentHash <- Hash <$> getByteString 32 -- or 256 bits
parentHeaderHash <- Hash <$> getByteString 32

-- TODO: Handle special case for BFT
-- TODO: Handle special case for Praos/Genesis

return $ BlockHeader
{ version
, contentSize
, slot = (SlotId slotId slotEpoch)
, chainLength
, contentHash
, parentHeaderHash
}

getBlock :: Get Block
getBlock = label "getBlock" $ do
Expand Down

0 comments on commit 2189175

Please sign in to comment.