packages feed

haskoin-store 0.18.8 → 0.18.9

raw patch · 3 files changed

+27/−3 lines, 3 files

Files

CHANGELOG.md view
@@ -4,6 +4,13 @@ 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.18.9+### Added+- Endpoint to locate a block by unix timestamp.++### Removed+- No more persistence for peers due to dependency on newest haskoin-node.+ ## 0.18.8 ### Added - Transaction and block timeouts for health check.
haskoin-store.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: 88361eb08860af74fe1889c4b02d3ae0e4289cc2d4b2d8249e19e22d94ea2b05+-- hash: ae63b94f9946af9c24a7c77d5c813b16fd1f2756702562e7d73fe71330d06cf1  name:           haskoin-store-version:        0.18.8+version:        0.18.9 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/Web.hs view
@@ -272,6 +272,21 @@                      streamAny net proto io                  flush' +scottyBlockTime ::+       (MonadLoggerIO m, MonadUnliftIO m) => Network -> Bool -> WebT m ()+scottyBlockTime net raw = do+    cors+    q <- param "time"+    n <- parseNoTx+    proto <- setupBin+    m <- blockAtOrBefore q+    if raw+        then maybeSerial net proto =<<+             case m of+                 Nothing -> return Nothing+                 Just d -> Just <$> rawBlock d+        else maybeSerial net proto m+ scottyBlockHeights :: (MonadLoggerIO m, MonadUnliftIO m) => Network -> WebT m () scottyBlockHeights net = do     cors@@ -727,6 +742,8 @@         S.get "/block/:block/raw" $ scottyBlock net True         S.get "/block/height/:height" $ scottyBlockHeight net False         S.get "/block/height/:height/raw" $ scottyBlockHeight net True+        S.get "/block/time/:time" $ scottyBlockTime net False+        S.get "/block/time/:time/raw" $ scottyBlockTime net True         S.get "/block/heights" $ scottyBlockHeights net         S.get "/block/latest" $ scottyBlockLatest net         S.get "/blocks" $ scottyBlocks net@@ -919,9 +936,9 @@ healthCheck net mgr ch tos = do     maybe_chain_best <- timeout (5 * 1000 * 1000) $ chainGetBest ch     maybe_block_best <- runMaybeT $ MaybeT . getBlock =<< MaybeT getBestBlock-    now <- fromIntegral . systemSeconds <$> liftIO getSystemTime     peers <- timeout (5 * 1000 * 1000) $ managerGetPeers mgr     maybe_mempool_last <- runConduit $ getMempool .| mapC fst .| headC+    now <- fromIntegral . systemSeconds <$> liftIO getSystemTime     let maybe_block_time_delta =             (now -) . fromIntegral . blockTimestamp . blockDataHeader <$>             maybe_block_best