packages feed

haskoin-store 0.19.4 → 0.19.5

raw patch · 5 files changed

+18/−23 lines, 5 files

Files

CHANGELOG.md view
@@ -4,6 +4,11 @@ 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.19.5+### Changed+- Minor refactor to block import code.+- Minor fix to transaction timeout check.+ ## 0.19.4 ### Changed - Clarify and correct health check algorithm.
haskoin-store.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 533fa2e36c8d6eecd9a95ddf073fc36b3ba6758e1afb7f8dce86192bba8eafd7+-- hash: 26faa85a93fdd1e9052201cb5f666112daf3c90e2d738cf1251cc8764cb03aa2  name:           haskoin-store-version:        0.19.4+version:        0.19.5 synopsis:       Storage and index for Bitcoin and Bitcoin Cash description:    Store blocks, transactions, and balances for Bitcoin or Bitcoin Cash, and make that information via REST API. category:       Bitcoin, Finance, Network
src/Network/Haskoin/Store/Block.hs view
@@ -11,17 +11,14 @@       ) where  import           Conduit-import           Control.Arrow import           Control.Monad.Except import           Control.Monad.Logger import           Control.Monad.Reader import           Control.Monad.Trans.Maybe-import qualified Data.HashMap.Strict                 as M import           Data.Maybe import           Data.String import           Data.String.Conversions import           Data.Time.Clock.System-import           Database.RocksDB import           Haskoin import           Haskoin.Node import           Network.Haskoin.Store.Data@@ -112,9 +109,9 @@     run =         withAsync (pingMe (inboxToMailbox inbox)) . const . forever $ do             $(logDebugS) "Block" "Awaiting message..."-            receive inbox >>= \msg ->+            receive inbox >>= \x ->                 ReaderT $ \r ->-                    runResourceT (runReaderT (processBlockMessage msg) r)+                    runResourceT (runReaderT (processBlockMessage x) r)  isSynced :: (MonadLoggerIO m, MonadUnliftIO m) => ReaderT BlockRead m Bool isSynced = do@@ -246,7 +243,7 @@         False -> $(logDebugS) "Block" "Not importing orphans as not yet in sync"         True -> do             now <- fromIntegral . systemSeconds <$> liftIO getSystemTime-            (ldb, net) <- asks ((blockConfDB &&& blockConfNet) . myConfig)+            net <- asks (blockConfNet . myConfig)             $(logDebugS) "Block" "Getting expired orphan transactions..."             old <- runConduit $ getOldOrphans now .| sinkList             case old of@@ -256,8 +253,7 @@                     $(logDebugS) "Block" $                         "Removing " <> cs (show (length old)) <>                         "expired orphan transactions..."-                    runImport $ mapM_ deleteOrphanTx old-                    return ()+                    void . runImport $ mapM_ deleteOrphanTx old             $(logDebugS) "Block" "Selecting orphan transactions to import..."             orphans <- runConduit $ getOrphans .| sinkList             case orphans of
src/Network/Haskoin/Store/Logic.hs view
@@ -21,7 +21,6 @@ import           Data.String.Conversions             (cs) import           Data.Text                           (Text) import           Data.Word-import           Database.RocksDB import           Haskoin import           Network.Haskoin.Block.Headers       (computeSubsidy) import           Network.Haskoin.Store.Data@@ -640,7 +639,7 @@     -> OutPoint     -> TxOut     -> m ()-newOutput net br op to = do+newOutput _ br op to = do     insertUnspent u     case scriptToAddressBS (scriptOutput to) of         Left _ -> return ()@@ -770,7 +769,7 @@     => Network     -> OutPoint     -> m ()-unspendOutput net op = do+unspendOutput _ op = do         t <- getImportTx (outPointHash op)         o <- getTxOutput (outPointIndex op) t         s <-@@ -868,7 +867,6 @@         if c             then "confirmed"             else "unconfirmed"-    addr = fromMaybe "???" (addrToString net a)  increaseBalance ::        ( StoreRead m@@ -913,11 +911,6 @@                       then v                       else 0             }-  where-    conf =-        if c-            then "confirmed"-            else "unconfirmed"  updateAddressCounts ::        (StoreWrite m, StoreRead m, Monad m, MonadError ImportException m)
src/Network/Haskoin/Store/Web.hs view
@@ -973,7 +973,7 @@         bk = block_ok bb         pk = peer_count_ok pc         bd = block_time_delta tm cb-        td = tx_time_delta tm cb ml+        td = tx_time_delta tm bd ml         lk = timeout_ok (blockTimeout tos) bd         tk = timeout_ok (txTimeout tos) td         ok = ck && bk && pk && lk && tk@@ -1007,9 +1007,10 @@     block_time_delta tm cb = do         bt <- node_timestamp <$> cb         return $ compute_delta bt tm-    tx_time_delta tm cb ml = do-        tt <- fst <$> ml <|> node_timestamp <$> cb-        return $ compute_delta tt tm+    tx_time_delta tm bd ml = do+        bd' <- bd+        tt <- fst <$> ml <|> bd+        return $ min (compute_delta tt tm) bd'     timeout_ok to td = fromMaybe False $ do         td' <- td         return $