packages feed

haskoin-store 0.37.2 → 0.37.3

raw patch · 2 files changed

+16/−26 lines, 2 filesdep ~haskoin-storedep ~haskoin-store-data

Dependency ranges changed: haskoin-store, haskoin-store-data

Files

haskoin-store.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 19e16f531b4684565261115fe5913e67ca2b6d20d45e90afe3e3beacd520f3c2+-- hash: fe2151b6cf88eb8b5b1710e232de31add84c191400a70d900dd7e6ce15affa22  name:           haskoin-store-version:        0.37.2+version:        0.37.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@@ -53,7 +53,7 @@     , hashable >=1.3.0.0     , haskoin-core >=0.13.6     , haskoin-node >=0.14.1-    , haskoin-store-data ==0.37.2+    , haskoin-store-data ==0.37.3     , hedis >=0.12.13     , http-types >=0.12.3     , monad-logger >=0.3.32@@ -96,7 +96,7 @@     , haskoin-core >=0.13.6     , haskoin-node >=0.14.1     , haskoin-store-    , haskoin-store-data ==0.37.2+    , haskoin-store-data ==0.37.3     , monad-logger >=0.3.32     , mtl >=2.2.2     , nqe >=0.6.1@@ -135,8 +135,8 @@     , hashable >=1.3.0.0     , haskoin-core >=0.13.6     , haskoin-node >=0.14.1-    , haskoin-store ==0.37.2-    , haskoin-store-data ==0.37.2+    , haskoin-store ==0.37.3+    , haskoin-store-data ==0.37.3     , hedis >=0.12.13     , hspec >=2.7.1     , http-types >=0.12.3
src/Haskoin/Store/Logic.hs view
@@ -24,7 +24,6 @@ import qualified Data.ByteString       as B import qualified Data.ByteString.Short as B.Short import           Data.Either           (rights)-import qualified Data.HashSet          as S import qualified Data.IntMap.Strict    as I import           Data.List             (nub) import           Data.Maybe            (catMaybes, fromMaybe, isJust, isNothing)@@ -101,7 +100,7 @@         Just _ ->             return False         Nothing -> do-            freeOutputs True True [tx]+            freeOutputs True True tx             rbf <- isRBF (MemRef w) tx             checkNewTx tx             importTx (MemRef w) w rbf tx@@ -154,10 +153,11 @@                 throwError PrevBlockNotBest  importOrConfirm :: MonadImport m => BlockNode -> [Tx] -> m ()-importOrConfirm bn txs = do-    freeOutputs True False txs-    mapM_ (uncurry action) (sortTxs txs)+importOrConfirm bn txns = do+    mapM_ (freeOutputs True False . snd) (reverse txs)+    mapM_ (uncurry action) txs   where+    txs = sortTxs txns     br i = BlockRef {blockRefHeight = nodeHeight bn, blockRefPos = i}     bn_time = fromIntegral . blockTimestamp $ nodeHeader bn     action i tx =@@ -374,24 +374,14 @@     :: MonadImport m     => Bool -- ^ only delete transaction if unconfirmed     -> Bool -- ^ only delete RBF-    -> [Tx]+    -> Tx     -> m ()-freeOutputs memonly rbfcheck txs =-    forM_ txs $ \tx ->+freeOutputs memonly rbfcheck tx =     forM_ (prevOuts tx) $ \op ->-    unless (outPointHash op `S.member` ths) $     getUnspent op >>= \u -> when (isNothing u) $-        getSpender op >>= \case-            Just Spender { spenderHash = h } ->-                unless (h == txHash tx) $-                deleteTx memonly rbfcheck h-            Nothing -> do-                $(logErrorS) "BlockStore" $-                    "Missing unspent output for tx: "-                    <> txHashToHex (txHash tx)-                throwError Orphan-  where-    ths = S.fromList (map txHash txs)+    getSpender op >>= \p -> forM_ p $ \s ->+    unless (spenderHash s == txHash tx) $+    deleteTx memonly rbfcheck (spenderHash s)  deleteConfirmedTx :: MonadImport m => TxHash -> m () deleteConfirmedTx = deleteTx False False