packages feed

haskoin-store 0.23.16 → 0.23.18

raw patch · 6 files changed

+57/−9 lines, 6 filesdep ~haskoin-node

Dependency ranges changed: haskoin-node

Files

CHANGELOG.md view
@@ -4,6 +4,17 @@ 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.23.18+### Changed+- Allow setting peer timeouts in command line.++### Fixed+- Bump Haskoin Node dependency to fix another premature timeout condition.++## 0.23.17+### Fixed+- Touch syncing peer whenever we process one of its blocks to avoid premature timeout.+ ## 0.23.16 ### Changed - Better algorithm to avoid importing transaction multiple times in cache.
app/Main.hs view
@@ -50,6 +50,8 @@     , configRedisMin    :: !Int     , configRedisMax    :: !Integer     , configWipeMempool :: !Bool+    , configPeerTimeout :: !Int+    , configPeerTooOld  :: !Int     }  defPort :: Int@@ -67,6 +69,12 @@ defRedisMax :: Integer defRedisMax = 100 * 1000 * 1000 +defPeerTimeout :: Int+defPeerTimeout = 120++defPeerTooOld :: Int+defPeerTooOld = 48 * 3600+ config :: Parser Config config = do     configDir <-@@ -139,6 +147,18 @@         help "Last transaction broadcast timeout (0 for infinite)" <>         showDefault <>         value (txTimeout def)+    configPeerTimeout <-+        option auto $+        metavar "TIMEOUT" <> long "peertimeout" <>+        help "Disconnect if peer doesn't send message for this many seconds" <>+        showDefault <>+        value defPeerTimeout+    configPeerTooOld <-+        option auto $+        metavar "TIMEOUT" <> long "peertooold" <>+        help "Disconnect if peer has been connected for this many seconds" <>+        showDefault <>+        value defPeerTooOld     configRedis <-         switch $ long "cache" <> help "Redis cache for extended public keys"     configRedisURL <-@@ -224,6 +244,8 @@            , configRedisMin = cachemin            , configRedisMax = redismax            , configWipeMempool = wipemempool+           , configPeerTimeout = peertimeout+           , configPeerTooOld = peerold            } =     runStderrLoggingT . filterLogger l $ do         $(logInfoS) "Main" $@@ -246,6 +268,8 @@                     , storeConfCacheMin = cachemin                     , storeConfMaxKeys = redismax                     , storeConfWipeMempool = wipemempool+                    , storeConfPeerTimeout = peertimeout+                    , storeConfPeerTooOld = peerold                     }          in withStore scfg $ \st ->                 let wcfg =
haskoin-store.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 49b9accfed7a4d474c7a08471883565ad6a24898bf560190503132a33eba11c6+-- hash: 7cb9ca2addafaf28c129fa7c583ec3acf75012c194b9ff977699dfab0ac3c672  name:           haskoin-store-version:        0.23.16+version:        0.23.18 synopsis:       Storage and index for Bitcoin and Bitcoin Cash description:    Store and index Bitcoin or Bitcoin Cash blocks, transactions, balances and unspent outputs.                 All data is available via REST API in JSON or binary format.@@ -59,7 +59,7 @@     , deepseq >=1.4.4.0     , hashable >=1.3.0.0     , haskoin-core >=0.12.0-    , haskoin-node >=0.10.0+    , haskoin-node >=0.11.0     , hedis >=0.12.13     , http-types >=0.12.3     , monad-logger >=0.3.32@@ -148,7 +148,7 @@     , deepseq >=1.4.4.0     , hashable >=1.3.0.0     , haskoin-core >=0.12.0-    , haskoin-node >=0.10.0+    , haskoin-node >=0.11.0     , hedis >=0.12.13     , hspec >=2.7.1     , http-types >=0.12.3
src/Haskoin/Store/BlockStore.hs view
@@ -259,7 +259,13 @@             Just _ ->                 getSyncingState >>= \case                     Just Syncing {syncingPeer = syncingpeer}-                        | peer == syncingpeer -> return ()+                        | peer == syncingpeer -> do+                            box <- asks myPeer+                            now <-+                                fromIntegral . systemSeconds <$>+                                liftIO getSystemTime+                            atomically . modifyTVar box . fmap $ \s ->+                                s {syncingTime = now}                     _ -> do                         p' <-                             managerPeerText peer =<<
src/Haskoin/Store/Manager.hs view
@@ -18,9 +18,9 @@                                                 VarString (..),                                                 sockToHostAddress) import           Haskoin.Node                  (Chain, ChainEvent (..),-                                                HostPort, PeerManager,-                                                NodeConfig (..), NodeEvent (..),-                                                PeerEvent (..), node)+                                                HostPort, NodeConfig (..),+                                                NodeEvent (..), PeerEvent (..),+                                                PeerManager, node) import           Haskoin.Store.BlockStore      (BlockStoreConfig (..),                                                 blockStore) import           Haskoin.Store.Cache           (CacheConfig (..), CacheWriter,@@ -79,6 +79,10 @@       -- ^ maximum number of keys in Redis cache         , storeConfWipeMempool :: !Bool       -- ^ wipe mempool when starting+        , storeConfPeerTimeout :: !Int+      -- ^ disconnect peer if message not received for this many seconds+        , storeConfPeerTooOld  :: !Int+      -- ^ disconnect peer if it has been connected this long         }  withStore ::@@ -132,7 +136,8 @@                                   0                                   (sockToHostAddress (SockAddrInet 0 0))                         , nodeConfNet = storeConfNetwork cfg-                        , nodeConfTimeout = 10+                        , nodeConfTimeout = storeConfPeerTimeout cfg+                        , nodeConfPeerOld = storeConfPeerTooOld cfg                         }             withAsync (node nodeconfig managerinbox chaininbox) $ \nodeasync -> do                 link nodeasync
test/Haskoin/StoreSpec.hs view
@@ -87,6 +87,8 @@                         , storeConfCacheMin = 100                         , storeConfMaxKeys = 100 * 1000 * 1000                         , storeConfWipeMempool = False+                        , storeConfPeerTimeout = 60+                        , storeConfPeerTooOld = 48 * 3600                         }             withStore cfg $ \Store {..} -> withSubscription storePublisher $ \sub ->                 lift $