packages feed

haskoin-store 0.22.0 → 0.22.1

raw patch · 3 files changed

+22/−7 lines, 3 files

Files

CHANGELOG.md view
@@ -4,6 +4,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## 0.22.1+### Added+- More debug logging for cache hits.++### Fixed+- Bug using maximum against empty list.+ ## 0.22.0 ### Changed - Extreme code refactoring.
haskoin-store.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 7200ad7a5b35e08670d60a7a256a04aed6ff5a16c24b137f95d4bdbd483d4be9+-- hash: f3c4b3255b61e04e753f990846948489835c294b9d7759ac68a62ef6543d69d9  name:           haskoin-store-version:        0.22.0+version:        0.22.1 synopsis:       Storage and index for Bitcoin and Bitcoin Cash description:    Store and index Bitcoin or Bitcoin Cash blocks, transactions, balances and unspent outputs.                 All data is available via REST API in JSON or binary format.
src/Haskoin/Store/Cache.hs view
@@ -192,7 +192,11 @@                             cs (show (lenNotNull bals)) <>                             " balances"                         return uns-        bals -> process bals+        bals -> do+            $(logDebugS) "Cache" $+                "Cache hit for xpub with " <> cs (show (length bals)) <>+                " xpub balances"+            process bals   where     process bals = do         ops <- map snd <$> cacheGetXPubUnspents xpub start offset limit@@ -231,7 +235,11 @@                             cs (show (lenNotNull bals)) <>                             " balances"                         return bals-        bals -> return bals+        bals -> do+            $(logDebugS) "Cache" $+                "Cache hit for xpub with " <> cs (show (length bals)) <>+                " xpub balances"+            return bals  cacheGetXPubBalances :: MonadIO m => XPubSpec -> CacheT m [XPubBal] cacheGetXPubBalances xpub = do@@ -776,8 +784,8 @@             return $ HashMap.fromList xbs'     newaddrs xpub bals =         let paths = HashMap.lookupDefault [] xpub xpubmap-            ext = maximum . map (head . tail) $ filter ((== 0) . head) paths-            chg = maximum . map (head . tail) $ filter ((== 1) . head) paths+            ext = maximum . (0 :) . map (head . tail) $ filter ((== 0) . head) (paths)+            chg = maximum . (0 :) . map (head . tail) $ filter ((== 1) . head) (paths)             extnew =                 addrsToAdd                     bals@@ -836,7 +844,7 @@     ebals <- redisGetXPubBalances xpub     case ebals of         Right bals -> go (map (balanceAddress . xPubBal) bals)-        Left _ -> return $ ebals >> return 0+        Left _     -> return $ ebals >> return 0   where     go addrs = do         addrcount <-