Skip to content

Commit

Permalink
Apply suggestions from @KtorZ's review.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanknowles committed Mar 12, 2019
1 parent 6dd6e91 commit aa28cd1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/Cardano/Wallet/Binary.hs
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ import qualified Data.Set as Set
decodeAddress :: CBOR.Decoder s Address
decodeAddress = do
_ <- CBOR.decodeListLenCanonicalOf 2
-- ^ CRC Protection Wrapper
-- CRC Protection Wrapper
tag <- CBOR.decodeTag
-- ^ Mysterious hard-coded tag cardano-sl seems to so much like
-- Mysterious hard-coded tag cardano-sl seems to so much like
bytes <- CBOR.decodeBytes
-- ^ Addr Root + Attributes + Type
-- Addr Root + Attributes + Type
crc <- CBOR.decodeWord32 -- CRC
-- NOTE 1:
-- Treating addresses as a blob here, so we just re-encode them as such
Expand Down
6 changes: 3 additions & 3 deletions src/Cardano/Wallet/BlockSyncer.hs
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ tickingFunction getNextBlocks action tickTime = go
-> IO ()
go (BlockHeadersConsumed headersConsumed) = do
blocksDownloaded <- getNextBlocks
let blocksToProcess =
filter (checkIfAlreadyConsumed headersConsumed)
(L.nub blocksDownloaded)
let blocksToProcess = filter
(checkIfAlreadyConsumed headersConsumed)
(L.nub blocksDownloaded)
mapM_ action blocksToProcess
threadDelay $ (fromIntegral . toMicroseconds) tickTime
go $ BlockHeadersConsumed
Expand Down
6 changes: 4 additions & 2 deletions src/Cardano/Wallet/Primitive.hs
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,10 @@ instance Dom UTxO where

balance :: UTxO -> Integer
balance =
Map.foldl' (\total out -> total + fromIntegral (getCoin (coin out))) 0
. getUTxO
Map.foldl' fn 0 . getUTxO
where
fn :: Integer -> TxOut -> Integer
fn total out = total + fromIntegral (getCoin (coin out))

-- ins⋪ u
excluding :: UTxO -> Set TxIn -> UTxO
Expand Down

0 comments on commit aa28cd1

Please sign in to comment.