haskoin-store 0.34.5 → 0.34.6
raw patch · 2 files changed
+17/−24 lines, 2 filesdep ~haskoin-storedep ~haskoin-store-data
Dependency ranges changed: haskoin-store, haskoin-store-data
Files
- haskoin-store.cabal +6/−6
- src/Haskoin/Store/Logic.hs +11/−18
haskoin-store.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: c91ec3f40f326feff8440f979eb63614fcbf81492936beffdd3f70d4d7ed52a4+-- hash: dd21f0f4970f6a7ce36389dbb15c2bc3ef79981853e55d20b333d96cafe77682 name: haskoin-store-version: 0.34.5+version: 0.34.6 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.34.5+ , haskoin-store-data ==0.34.6 , 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.34.5+ , haskoin-store-data ==0.34.6 , 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.34.5- , haskoin-store-data ==0.34.5+ , haskoin-store ==0.34.6+ , haskoin-store-data ==0.34.6 , hedis >=0.12.13 , hspec >=2.7.1 , http-types >=0.12.3
src/Haskoin/Store/Logic.hs view
@@ -54,8 +54,7 @@ TxRef (..), UnixTime, Unspent (..), confirmed) import Haskoin.Store.Database.Writer (MemoryTx, WriterT, runTx)-import UnliftIO (Exception, MonadIO, asyncBound,- liftIO, wait)+import UnliftIO (Exception, MonadIO, liftIO) type MonadImport m = ( MonadError ImportException m@@ -119,30 +118,24 @@ getActiveTxData (txHash tx) >>= \case Just _ -> return False Nothing -> do- preLoadMemory False [tx]+ preLoadMemory [tx] freeOutputs True True [tx] rbf <- isRBF (MemRef w) tx checkNewTx tx runMonadMemory $ importTx (MemRef w) w rbf tx return True -preLoadMemory :: MonadLoggerIO m => Bool -> [Tx] -> WriterT m ()-preLoadMemory as txs = do+preLoadMemory :: MonadLoggerIO m => [Tx] -> WriterT m ()+preLoadMemory txs = do $(logDebugS) "BlockStore" "Pre-loading memory" ReaderT $ \r -> do l <- askLoggerIO liftIO (runLoggingT (runReaderT go r) l) where- go- | as = do- as1 <- mapM (asyncBound . loadPrevOut) (concatMap prevOuts txs)- as2 <- mapM (asyncBound . loadOutputBalances) txs- runTx . setMempool =<< getMempool- mapM_ wait $ as1 ++ as2- | otherwise = do- mapM_ loadPrevOut (concatMap prevOuts txs)- mapM_ loadOutputBalances txs- runTx . setMempool =<< getMempool+ go = do+ mapM_ loadPrevOut (concatMap prevOuts txs)+ mapM_ loadOutputBalances txs+ runTx . setMempool =<< getMempool bestBlockData :: MonadImport m => WriterT m BlockData bestBlockData = do@@ -167,7 +160,7 @@ "Cannot revert non-head block: " <> blockHashToHex bh throwError BlockNotBest tds <- mapM getImportTxData (blockDataTxs bd)- preLoadMemory True $ map txData tds+ preLoadMemory $ map txData tds runTx $ do setBest (prevBlock (blockDataHeader bd)) insertBlock bd {blockDataMainChain = False}@@ -194,7 +187,7 @@ importOrConfirm :: MonadImport m => BlockNode -> [Tx] -> WriterT m () importOrConfirm bn txs = do- preLoadMemory True txs+ preLoadMemory txs freeOutputs True False txs mapM_ (uncurry action) (sortTxs txs) where@@ -520,7 +513,7 @@ "Deleting tx: " <> txHashToHex th getSpenders th >>= \case m | I.null m -> do- preLoadMemory False [txData td]+ preLoadMemory [txData td] runTx $ commitDelTx td | otherwise -> do $(logErrorS) "BlockStore" $