packages feed

haskoin-store 0.65.10 → 0.65.11

raw patch · 3 files changed

+25/−15 lines, 3 filesdep ~haskoin-store-dataPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: haskoin-store-data

API changes (from Hackage documentation)

Files

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.11+### Fixed+- Backport fixes from version 1.5.0.+ ## 0.65.10 ### Changed - Revert to older LTS Haskell to attempt to resolve memory leak.
haskoin-store.cabal view
@@ -1,11 +1,11 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.35.1.+-- This file has been generated from package.yaml by hpack version 0.36.0. -- -- see: https://github.com/sol/hpack  name:           haskoin-store-version:        0.65.10+version:        0.65.11 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@@ -61,7 +61,7 @@     , hashtables >=1.2.4.2     , haskoin-core >=0.21.1     , haskoin-node >=0.18.0-    , haskoin-store-data ==0.65.5+    , haskoin-store-data ==0.65.11     , hedis >=0.12.13     , http-types >=0.12.3     , lens >=4.18.1@@ -118,7 +118,7 @@     , haskoin-core >=0.21.1     , haskoin-node >=0.18.0     , haskoin-store-    , haskoin-store-data ==0.65.5+    , haskoin-store-data ==0.65.11     , hedis >=0.12.13     , http-types >=0.12.3     , lens >=4.18.1@@ -180,7 +180,7 @@     , haskoin-core >=0.21.1     , haskoin-node >=0.18.0     , haskoin-store-    , haskoin-store-data ==0.65.5+    , haskoin-store-data ==0.65.11     , hedis >=0.12.13     , hspec >=2.7.1     , http-types >=0.12.3
src/Haskoin/Store/Common.hs view
@@ -59,7 +59,9 @@ import Control.Monad.Trans.Reader (runReaderT) import Data.ByteString (ByteString) import Data.Default (Default (..))+import qualified Data.Graph as G import qualified Data.HashSet as H+import qualified Data.HashMap.Strict as M import Data.Hashable (Hashable) import Data.IntMap.Strict (IntMap) import qualified Data.IntMap.Strict as I@@ -343,17 +345,21 @@ applyLimitC l = takeC (fromIntegral l)  sortTxs :: [Tx] -> [(Word32, Tx)]-sortTxs txs = go [] thset $ zip [0 ..] txs+sortTxs txs = ts   where-    thset = H.fromList (map txHash txs)-    go [] _ [] = []-    go orphans ths [] = go [] ths orphans-    go orphans ths ((i, tx) : xs) =-      let ops = map (outPointHash . prevOutput) (txIn tx)-          orp = any (`H.member` ths) ops-       in if orp-            then go ((i, tx) : orphans) ths xs-            else (i, tx) : go orphans (txHash tx `H.delete` ths) xs+    hm :: M.HashMap TxHash Int+    hm = M.fromList $ zip (map txHash txs) [0 ..]+    ns :: [(Tx, Int, [Int])]+    ns =+      let is tx = nub' $ map (outPointHash . prevOutput) (txIn tx)+          hs tx = mapMaybe (`M.lookup` hm) (is tx)+          tp i tx = (tx, i, hs tx)+       in zipWith tp [0 ..] txs+    (g, n, _) = G.graphFromEdges ns+    vs = G.reverseTopSort g+    ts =+      let f (tx, i, _) = (fromIntegral i, tx)+       in map (f . n) vs  nub' :: (Eq a, Hashable a) => [a] -> [a] nub' = H.toList . H.fromList