haskoin-store 0.17.0 → 0.17.1
raw patch · 4 files changed
+33/−27 lines, 4 files
Files
- CHANGELOG.md +8/−0
- haskoin-store.cabal +2/−2
- src/Network/Haskoin/Store/Messages.hs +1/−3
- src/Network/Haskoin/Store/Web.hs +22/−22
CHANGELOG.md view
@@ -4,6 +4,14 @@ 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.17.1+### Changed+- When posting a transaction to the network, timeout is now five seconds.+- Improve error message when transaction post timeout reached.+- Remove obsolete `not found` error for transaction post.+- Endpoints for retrieving blocks now do streaming for better performance.+- Improve Swagger API documentation.+ ## 0.17.0 ### Added - Endpoints for retrieving block transactions.
haskoin-store.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: b7810db1948eede5d827a01e80f1a69e535d911af283efb7b4b5077a1e2c14ce+-- hash: 606922c9587a5c632a26585ce6c4e65dfbb82928fd1aad63ace29554f1aa2651 name: haskoin-store-version: 0.17.0+version: 0.17.1 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/Messages.hs view
@@ -111,7 +111,6 @@ = PubNoPeers | PubReject RejectCode | PubTimeout- | PubNotFound | PubPeerDisconnected deriving Eq @@ -128,8 +127,7 @@ RejectDust -> "dust" RejectInsufficientFee -> "insufficient fee" RejectCheckpoint -> "checkpoint"- show PubTimeout = "timeout"- show PubNotFound = "not found"+ show PubTimeout = "peer timeout or silent rejection" show PubPeerDisconnected = "peer disconnected" instance Exception PubExcept
src/Network/Haskoin/Store/Web.hs view
@@ -199,14 +199,13 @@ height <- param "height" n <- parseNoTx proto <- setupBin- res <-- fmap catMaybes $ do- hs <- getBlocksAtHeight height- forM hs $ \h ->- runMaybeT $ do- b <- MaybeT $ getBlock h- return $ pruneTx n b- protoSerial net proto res+ db <- askDB+ hs <- getBlocksAtHeight height+ stream $ \io flush' -> do+ runResourceT . withLayeredDB db . runConduit $+ yieldMany hs .| concatMapMC getBlock .| mapC (pruneTx n) .|+ streamAny net proto io+ flush' scottyBlockHeights :: MonadLoggerIO m => Network -> WebT m () scottyBlockHeights net = do@@ -214,13 +213,15 @@ heights <- param "heights" n <- parseNoTx proto <- setupBin+ db <- askDB bs <- concat <$> mapM getBlocksAtHeight (nub heights)- res <-- fmap catMaybes . forM bs $ \bh ->- runMaybeT $ do- b <- MaybeT $ getBlock bh- return $ pruneTx n b- protoSerial net proto res+ stream $ \io flush' -> do+ runResourceT . withLayeredDB db . runConduit $+ yieldMany (nub heights) .| concatMapMC getBlocksAtHeight .|+ concatMapMC getBlock .|+ mapC (pruneTx n) .|+ streamAny net proto io+ flush' scottyBlockLatest :: MonadLoggerIO m => Network -> WebT m () scottyBlockLatest net = do@@ -253,12 +254,12 @@ blocks <- param "blocks" n <- parseNoTx proto <- setupBin- res <-- fmap catMaybes . forM blocks $ \bh ->- runMaybeT $ do- b <- MaybeT $ getBlock bh- return $ pruneTx n b- protoSerial net proto res+ db <- askDB+ stream $ \io flush' -> do+ runResourceT . withLayeredDB db . runConduit $+ yieldMany (nub blocks) .| concatMapMC getBlock .| mapC (pruneTx n) .|+ streamAny net proto io+ flush' scottyMempool :: (MonadLoggerIO m, MonadUnliftIO m) => Network -> WebT m () scottyMempool net = do@@ -524,7 +525,6 @@ PubNoPeers -> status status500 PubTimeout -> status status500 PubPeerDisconnected -> status status500- PubNotFound -> status status500 PubReject _ -> status status400 protoSerial net proto (UserError (show e)) finish@@ -1083,7 +1083,7 @@ (MGetData (GetData [InvVector t (getTxHash (txHash tx))])) p f p s- t = 15 * 1000 * 1000+ t = 5 * 1000 * 1000 f p s = liftIO (timeout t (g p s)) >>= \case Nothing -> return $ Left PubTimeout