packages feed

haskoin-store 0.40.2 → 0.40.3

raw patch · 3 files changed

+26/−13 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

haskoin-store.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack  name:           haskoin-store-version:        0.40.2+version:        0.40.3 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
@@ -541,10 +541,14 @@ cacheWriterReact ::        (MonadUnliftIO m, MonadLoggerIO m, StoreReadExtra m)     => CacheWriterMessage -> CacheX m ()-cacheWriterReact CacheNewBlock = do+cacheWriterReact CacheNewBlock =+    inSync >>= \s ->+    when s $ do     newBlockC     syncMempoolC-cacheWriterReact CachePing = do+cacheWriterReact CachePing =+    inSync >>= \s ->+    when s $ do     pruneDB     newBlockC     syncMempoolC@@ -561,7 +565,7 @@     t <- xpubText xpub     let n = lenNotNull bals     if x <= n-        then go bals+        then inSync >>= \s -> if s then go bals else return (False, bals)         else do             $(logDebugS) "Cache" $ "Not caching xpub: " <> t             return (False, bals)@@ -595,19 +599,23 @@         $(logDebugS) "Cache" $ "Done caching xpub: " <> xpubtxt         return (True, bals) +inSync :: (MonadUnliftIO m, MonadLoggerIO m, StoreReadExtra m)+       => CacheX m Bool+inSync =+    lift getBestBlock >>= \case+    Nothing -> return False+    Just bb ->+        asks cacheChain >>= \ch ->+        chainGetBest ch >>= \cb ->+        return $ headerHash (nodeHeader cb) == bb+ newBlockC :: (MonadUnliftIO m, MonadLoggerIO m, StoreReadExtra m)           => CacheX m () newBlockC =     lift getBestBlock >>= \m ->-    forM_ m $ \bb ->-    in_sync bb >>= \s ->-    when s $ void $ withLock $ f bb+    forM_ m $ \bb -> void $ withLock $ f bb   where     f bb = cacheGetHead >>= go bb-    in_sync bb =-        asks cacheChain >>= \ch ->-        chainGetBest ch >>= \cb ->-        return $ headerHash (nodeHeader cb) == bb     go bb Nothing =         importBlockC bb     go bb (Just cb)@@ -925,7 +933,9 @@ syncMempoolC :: (MonadUnliftIO m, MonadLoggerIO m, StoreReadExtra m)              => CacheX m () syncMempoolC =-    void . withLock $ isCool >>= \cool -> when cool $ do+    void . withLock $+    isCool >>= \cool ->+    when cool $ do     nodepool <- HashSet.fromList . map snd <$> lift getMempool     cachepool <- HashSet.fromList . map snd <$> cacheGetMempool     txs <- mapM getit . HashSet.toList $@@ -937,6 +947,10 @@         importMultiTxC (rights txs)     startCooldown   where+    in_sync bb =+        asks cacheChain >>= \ch ->+        chainGetBest ch >>= \cb ->+        return $ headerHash (nodeHeader cb) == bb     getit th =         lift (getTxData th) >>= \case         Nothing -> return (Left th)
src/Haskoin/Store/Common.hs view
@@ -313,7 +313,6 @@     | StorePeerPong !Peer !Word64     | StoreTxAvailable !Peer ![TxHash]     | StoreTxReject !Peer !TxHash !RejectCode !ByteString-      -- ^ block no longer head of main chain  data PubExcept = PubNoPeers     | PubReject RejectCode