haskoin-store 0.65.6 → 0.65.7
raw patch · 3 files changed
+28/−24 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +4/−0
- haskoin-store.cabal +1/−1
- src/Haskoin/Store/Cache.hs +23/−23
CHANGELOG.md view
@@ -4,6 +4,10 @@ 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.65.7+### Changed+- Do not sync mempool to Redis if node is not up-to-date.+ ## 0.65.6 ### Changed - Improve caching ingestion performance.
haskoin-store.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack name: haskoin-store-version: 0.65.6+version: 0.65.7 synopsis: Storage and index for Bitcoin and Bitcoin Cash description: Please see the README on GitHub at <https://github.com/haskoin/haskoin-store#readme> category: Bitcoin, Finance, Network
src/Haskoin/Store/Cache.hs view
@@ -896,27 +896,26 @@ Just bb -> do ch <- asks cacheChain cb <- chainGetBest ch- return $ headerHash (nodeHeader cb) == bb+ return $ nodeHeight cb > 0 && headerHash (nodeHeader cb) == bb newBlockC :: (MonadUnliftIO m, MonadLoggerIO m, StoreReadExtra m) => CacheX m () newBlockC =- inSync >>= \s ->- when s . void $ withLock $ do- ch <- asks cacheChain- bn <- chainGetBest ch- cn <- cacheGetHead- case cn of- Nothing -> do- $(logInfoS) "Cache" "Initializing best cache block"- do_import bn- Just hb ->- if hb == headerHash (nodeHeader bn)- then $(logDebugS) "Cache" "Cache in sync"- else do- sync ch hb bn- void pruneDB+ inSync >>= \s -> when s . void . withLock $ do+ ch <- asks cacheChain+ bn <- chainGetBest ch+ cn <- cacheGetHead+ case cn of+ Nothing -> do+ $(logInfoS) "Cache" "Initializing best cache block"+ do_import bn+ Just hb ->+ if hb == headerHash (nodeHeader bn)+ then $(logDebugS) "Cache" "Cache in sync"+ else do+ sync ch hb bn+ void pruneDB where sync ch hb bn = chainGetBlock hb ch >>= \case@@ -1235,13 +1234,14 @@ syncMempoolC :: (MonadUnliftIO m, MonadLoggerIO m, StoreReadExtra m) => CacheX m ()-syncMempoolC = void . withLock $ do- nodepool <- HashSet.fromList . map snd <$> lift getMempool- cachepool <- HashSet.fromList . map snd <$> cacheGetMempool- getem (HashSet.difference nodepool cachepool)- refreshLock- getem (HashSet.difference cachepool nodepool)- refreshLock+syncMempoolC =+ inSync >>= \s -> when s . void . withLock $ do+ nodepool <- HashSet.fromList . map snd <$> lift getMempool+ cachepool <- HashSet.fromList . map snd <$> cacheGetMempool+ getem (HashSet.difference nodepool cachepool)+ refreshLock+ getem (HashSet.difference cachepool nodepool)+ refreshLock where getem tset = do let tids = HashSet.toList tset