packages feed

haskoin-node 0.14.1 → 0.15.0

raw patch · 4 files changed

+17/−21 lines, 4 filesdep +rocksdb-haskell-jpruppdep −rocksdb-haskell

Dependencies added: rocksdb-haskell-jprupp

Dependencies removed: rocksdb-haskell

Files

CHANGELOG.md view
@@ -4,6 +4,10 @@ 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.15.0+### Changed+- Use new Haskell bindings for RocksDB.+ ## 0.14.1 ### Fixed - Correct flawed peer locking logic in Chain actor.
haskoin-node.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: b18b0ea7428050a6d41c0bbd2a235b1c06b2ae8792339a9a1e7475ab94db23fc+-- hash: 8910b7a1cab081e2bc9808f152235026188f3dccc612d569cfa102a5fe7fa709  name:           haskoin-node-version:        0.14.1+version:        0.15.0 synopsis:       P2P library for Bitcoin and Bitcoin Cash description:    Please see the README on GitHub at <https://github.com/haskoin/haskoin-node#readme> category:       Bitcoin, Finance, Network@@ -52,7 +52,7 @@     , nqe >=0.6.3     , random     , resourcet-    , rocksdb-haskell+    , rocksdb-haskell-jprupp     , rocksdb-query >=0.3.1     , string-conversions     , text@@ -90,7 +90,7 @@     , nqe >=0.6.3     , random     , resourcet-    , rocksdb-haskell+    , rocksdb-haskell-jprupp     , rocksdb-query >=0.3.1     , safe     , string-conversions
src/Haskoin/Node/Chain.hs view
@@ -34,7 +34,6 @@ import           Control.Monad.Trans       (lift) import           Control.Monad.Trans.Maybe (MaybeT (..), runMaybeT) import qualified Data.ByteString           as B-import           Data.Default              (def) import           Data.Function             (on) import           Data.List                 (delete, nub) import           Data.Maybe                (isJust, isNothing)@@ -66,7 +65,6 @@                                             modifyTVar, newTVarIO, readTVar,                                             readTVarIO, withAsync, writeTVar) import           UnliftIO.Concurrent       (threadDelay)-import           UnliftIO.Resource         (runResourceT)  -- | Mailbox for chain header syncing process. data Chain = Chain { chainMailbox :: !(Mailbox ChainMessage)@@ -177,10 +175,10 @@         h = headerHash (nodeHeader bn)     getBlockHeader bh = do         db <- ask-        retrieve db def (BlockHeaderKey bh)+        retrieve db (BlockHeaderKey bh)     getBestBlockHeader = do         db <- ask-        retrieve db def BestBlockKey >>= \case+        retrieve db BestBlockKey >>= \case             Nothing -> error "Could not get best block from database"             Just b -> return b     setBestBlockHeader bn = do@@ -368,10 +366,10 @@ initChainDB = do     db <- asks (chainConfDB . myConfig)     net <- asks (chainConfNetwork . myConfig)-    ver <- retrieve db def ChainDataVersionKey+    ver <- retrieve db ChainDataVersionKey     when (ver /= Just dataVersion) $ purgeChainDB >>= writeBatch db     insert db ChainDataVersionKey dataVersion-    retrieve db def BestBlockKey >>= \b ->+    retrieve db BestBlockKey >>= \b ->         when (isNothing (b :: Maybe BlockNode)) $         withBlockHeaders $ do             addBlockHeader (genesisNode net)@@ -382,7 +380,7 @@ purgeChainDB :: MonadChain m => m [R.BatchOp] purgeChainDB = do     db <- asks (chainConfDB . myConfig)-    runResourceT . R.withIterator db def $ \it -> do+    R.withIter db $ \it -> do         R.iterSeek it $ B.singleton 0x90         recurse_delete it db   where@@ -390,7 +388,7 @@         R.iterKey it >>= \case             Just k                 | B.head k == 0x90 || B.head k == 0x91 -> do-                    R.delete db def k+                    R.delete db k                     R.iterNext it                     (R.Del k :) <$> recurse_delete it db             _ -> return []
test/Haskoin/NodeSpec.hs view
@@ -15,6 +15,7 @@ import           Data.ByteString        (ByteString) import qualified Data.ByteString        as B import           Data.ByteString.Base64 (decodeBase64Lenient)+import           Data.Default           (def) import           Data.Either            (fromRight) import           Data.List              (find) import           Data.Maybe             (isJust, mapMaybe)@@ -182,15 +183,8 @@ withTestNode net str f =     runNoLoggingT $     withSystemTempDirectory ("haskoin-node-test-" <> str <> "-") $ \w ->-    withPublisher $ \pub -> do-        db <--            R.open-                w-                R.defaultOptions-                    { R.createIfMissing = True-                    , R.errorIfExists = True-                    , R.compression = R.SnappyCompression-                    }+    withPublisher $ \pub ->+    R.withDB w def{R.createIfMissing = True, R.errorIfExists = True} $ \db -> do         let ad = NetworkAddress                  nodeNetwork                  (sockToHostAddress (SockAddrInet 0 0))