diff --git a/lib/jormungandr/src/Cardano/Wallet/Jormungandr/Binary.hs b/lib/jormungandr/src/Cardano/Wallet/Jormungandr/Binary.hs index 59f641b2d0a..0629eef3e02 100644 --- a/lib/jormungandr/src/Cardano/Wallet/Jormungandr/Binary.hs +++ b/lib/jormungandr/src/Cardano/Wallet/Jormungandr/Binary.hs @@ -111,6 +111,9 @@ import qualified Codec.CBOR.Read as CBOR import qualified Data.ByteString as BS import qualified Data.ByteString.Lazy as BL +-- Do-notation is favoured over applicative syntax for readability: +{-# ANN module ("HLint: ignore Use <$>" :: String) #-} + data BlockHeader = BlockHeader { version :: Word16 , contentSize :: Word32 @@ -128,9 +131,6 @@ data SignedUpdateProposal = SignedUpdateProposal data SignedVote = SignedVote deriving (Eq, Show) --- Do-notation is favoured over applicative syntax for readability: -{-# ANN module ("HLint: ignore Use <$>" :: String) #-} - getBlockHeader :: Get BlockHeader getBlockHeader = label "getBlockHeader" $ (fromIntegral <$> getWord16be) >>= \size -> isolate size $ do @@ -142,7 +142,6 @@ getBlockHeader = label "getBlockHeader" $ chainLength <- getWord32be contentHash <- Hash <$> getByteString 32 -- or 256 bits parentHeaderHash <- Hash <$> getByteString 32 - -- Proof. -- There are three different types of proofs: -- 1. no proof (used for the genesis blockheader) @@ -228,10 +227,8 @@ getInitial = label "getInitial" $ do getTransaction :: Get (Tx, [TxWitness]) getTransaction = label "getTransaction" $ do (ins, outs) <- getTokenTransfer - let witnessCount = length ins wits <- replicateM witnessCount getWitness - return $ (Tx ins outs, wits) where getWitness = do @@ -274,7 +271,6 @@ putWitness witness = ScriptWitness _ -> error "unimplemented: serialize script witness" RedeemWitness _ -> error "unimplemented: serialize redeem witness" - {------------------------------------------------------------------------------- Common Structure -------------------------------------------------------------------------------} @@ -320,9 +316,6 @@ getTokenTransfer = label "getTokenTransfer" $ do value <- Coin <$> getWord64be return $ TxOut addr value - - - {------------------------------------------------------------------------------- Config Parameters -------------------------------------------------------------------------------} @@ -373,7 +366,6 @@ getConfigParam = label "getConfigParam" $ do taglen <- getWord16be let tag = taglen `shift` (-6) let len = fromIntegral $ taglen .&. (63) -- 0b111111 - isolate len $ case tag of 1 -> Discrimination <$> getNetwork 2 -> Block0Date <$> getWord64be @@ -441,7 +433,6 @@ getBool = getWord8 >>= \case other -> fail $ "Unexpected integer: " ++ show other ++ ". Expected a boolean 0 or 1." - {------------------------------------------------------------------------------- Addresses -------------------------------------------------------------------------------}