summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxenog <>2019-04-15 15:33:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2019-04-15 15:33:00 (GMT)
commit09d6abf4db741bd6e6226ca75b638ab30175f0a1 (patch)
tree5f45c3f7a44f6f07d4b988a457e88d76602c2246
parent6c8bb9c5f1a358979f6796dd8654cfc643992f08 (diff)
version 0.14.00.14.0
-rw-r--r--CHANGELOG.md11
-rw-r--r--app/Main.hs367
-rw-r--r--haskoin-store.cabal39
-rw-r--r--src/Haskoin/Store.hs86
-rw-r--r--src/Network/Haskoin/Store/Block.hs187
-rw-r--r--src/Network/Haskoin/Store/Data.hs430
-rw-r--r--src/Network/Haskoin/Store/Data/ImportDB.hs261
-rw-r--r--src/Network/Haskoin/Store/Data/KeyValue.hs46
-rw-r--r--src/Network/Haskoin/Store/Data/RocksDB.hs115
-rw-r--r--src/Network/Haskoin/Store/Data/STM.hs (renamed from src/Network/Haskoin/Store/Data/HashMap.hs)273
-rw-r--r--src/Network/Haskoin/Store/Logic.hs397
-rw-r--r--src/Network/Haskoin/Store/Proto.hs437
-rw-r--r--src/Network/Haskoin/Store/ProtocolBuffers.hs23
-rw-r--r--src/Network/Haskoin/Store/ProtocolBuffers/Balance.hs128
-rw-r--r--src/Network/Haskoin/Store/ProtocolBuffers/BalanceList.hs82
-rw-r--r--src/Network/Haskoin/Store/ProtocolBuffers/BlockData.hs228
-rw-r--r--src/Network/Haskoin/Store/ProtocolBuffers/BlockDataList.hs82
-rw-r--r--src/Network/Haskoin/Store/ProtocolBuffers/BlockRef.hs110
-rw-r--r--src/Network/Haskoin/Store/ProtocolBuffers/BlockRef/Block.hs88
-rw-r--r--src/Network/Haskoin/Store/ProtocolBuffers/BlockRef/Block_ref.hs28
-rw-r--r--src/Network/Haskoin/Store/ProtocolBuffers/BlockRef/Mempool.hs81
-rw-r--r--src/Network/Haskoin/Store/ProtocolBuffers/BlockTx.hs90
-rw-r--r--src/Network/Haskoin/Store/ProtocolBuffers/BlockTxList.hs82
-rw-r--r--src/Network/Haskoin/Store/ProtocolBuffers/Error.hs81
-rw-r--r--src/Network/Haskoin/Store/ProtocolBuffers/Event.hs89
-rw-r--r--src/Network/Haskoin/Store/ProtocolBuffers/Event/Type.hs65
-rw-r--r--src/Network/Haskoin/Store/ProtocolBuffers/EventList.hs82
-rw-r--r--src/Network/Haskoin/Store/ProtocolBuffers/HealthCheck.hs164
-rw-r--r--src/Network/Haskoin/Store/ProtocolBuffers/Input.hs164
-rw-r--r--src/Network/Haskoin/Store/ProtocolBuffers/Output.hs109
-rw-r--r--src/Network/Haskoin/Store/ProtocolBuffers/Peer.hs117
-rw-r--r--src/Network/Haskoin/Store/ProtocolBuffers/PeerList.hs82
-rw-r--r--src/Network/Haskoin/Store/ProtocolBuffers/Spender.hs89
-rw-r--r--src/Network/Haskoin/Store/ProtocolBuffers/Transaction.hs202
-rw-r--r--src/Network/Haskoin/Store/ProtocolBuffers/TransactionList.hs82
-rw-r--r--src/Network/Haskoin/Store/ProtocolBuffers/TxAfterHeight.hs81
-rw-r--r--src/Network/Haskoin/Store/ProtocolBuffers/TxId.hs81
-rw-r--r--src/Network/Haskoin/Store/ProtocolBuffers/TxIdList.hs82
-rw-r--r--src/Network/Haskoin/Store/ProtocolBuffers/Unspent.hs128
-rw-r--r--src/Network/Haskoin/Store/ProtocolBuffers/UnspentList.hs82
-rw-r--r--src/Network/Haskoin/Store/ProtocolBuffers/XPubBalance.hs90
-rw-r--r--src/Network/Haskoin/Store/ProtocolBuffers/XPubBalanceList.hs82
-rw-r--r--src/Network/Haskoin/Store/ProtocolBuffers/XPubUnspent.hs90
-rw-r--r--src/Network/Haskoin/Store/ProtocolBuffers/XPubUnspentList.hs82
-rw-r--r--test/Spec.hs51
45 files changed, 1210 insertions, 4636 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ff17bed..c788b43 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,17 @@ All notable changes to this project will be documented in this file.
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.14.0
+### Removed
+- Dump slow protobuf serialization.
+
+### Added
+- Add custom serialization.
+- Extra debug logging.
+
+### Changed
+- Bump `haskoin-core` nad `haskoin-node`.
+
## 0.13.1
### Changed
- Bump `haskoin-node` in `stack.yaml`.
diff --git a/app/Main.hs b/app/Main.hs
index 269ba52..3b94502 100644
--- a/app/Main.hs
+++ b/app/Main.hs
@@ -12,6 +12,8 @@ import Control.Exception ()
import Control.Monad
import Control.Monad.Logger
import Control.Monad.Trans.Maybe
+import Data.Aeson.Encoding (encodingToLazyByteString,
+ fromEncoding)
import Data.Bits
import Data.ByteString.Builder
import qualified Data.ByteString.Lazy as L
@@ -121,16 +123,16 @@ peerReader s = do
defHandler :: Monad m => Network -> Except -> ActionT Except m ()
defHandler net e = do
- proto <- setupProto
+ proto <- setupBin
case e of
ThingNotFound -> status status404
- BadRequest -> status status400
- UserError _ -> status status400
+ BadRequest -> status status400
+ UserError _ -> status status400
StringError _ -> status status400
- ServerError -> status status500
+ ServerError -> status status500
S.raw $ serialAny net proto e
-maybeSerial :: (Monad m, JsonSerial a, ProtoSerial a) => Network -> Bool -- ^ protobuf
+maybeSerial :: (Monad m, JsonSerial a, BinSerial a) => Network -> Bool -- ^ protobuf
-> Maybe a -> ActionT Except m ()
maybeSerial _ _ Nothing = raise ThingNotFound
maybeSerial net proto (Just x) = S.raw $ serialAny net proto x
@@ -195,12 +197,13 @@ runWeb conf st db pub = do
S.get "/block/best" $ do
cors
n <- parse_no_tx
- proto <- setupProto
+ proto <- setupBin
res <-
runMaybeT $ do
- let d = (db, defaultReadOptions)
- bh <- MaybeT $ getBestBlock d
- b <- MaybeT $ getBlock d bh
+ bh <-
+ MaybeT $ withBlockDB defaultReadOptions db getBestBlock
+ b <-
+ MaybeT . withBlockDB defaultReadOptions db $ getBlock bh
if n
then return b {blockDataTxs = take 1 (blockDataTxs b)}
else return b
@@ -209,11 +212,12 @@ runWeb conf st db pub = do
cors
block <- param "block"
n <- parse_no_tx
- proto <- setupProto
+ proto <- setupBin
res <-
runMaybeT $ do
- let d = (db, defaultReadOptions)
- b <- MaybeT $ getBlock d block
+ b <-
+ MaybeT . withBlockDB defaultReadOptions db $
+ getBlock block
if n
then return b {blockDataTxs = take 1 (blockDataTxs b)}
else return b
@@ -222,13 +226,16 @@ runWeb conf st db pub = do
cors
height <- param "height"
no_tx <- parse_no_tx
- proto <- setupProto
+ proto <- setupBin
res <-
- do let d = (db, defaultReadOptions)
- bs <- getBlocksAtHeight d height
+ do bs <-
+ withBlockDB defaultReadOptions db $
+ getBlocksAtHeight height
fmap catMaybes . forM bs $ \bh ->
runMaybeT $ do
- b <- MaybeT $ getBlock d bh
+ b <-
+ MaybeT . withBlockDB defaultReadOptions db $
+ getBlock bh
return
b
{ blockDataTxs =
@@ -241,38 +248,38 @@ runWeb conf st db pub = do
cors
heights <- param "heights"
no_tx <- parse_no_tx
- proto <- setupProto
+ proto <- setupBin
res <-
- do let d = (db, defaultReadOptions)
- bs <- concat <$> mapM (getBlocksAtHeight d) (nub heights)
- fmap catMaybes . forM bs $ \bh ->
- runMaybeT $ do
- b <- MaybeT $ getBlock d bh
- return
- b
- { blockDataTxs =
- if no_tx
- then take 1 (blockDataTxs b)
- else blockDataTxs b
- }
+ withBlockDB defaultReadOptions db $ do
+ bs <- concat <$> mapM getBlocksAtHeight (nub heights)
+ fmap catMaybes . forM bs $ \bh ->
+ runMaybeT $ do
+ b <- MaybeT $ getBlock bh
+ return
+ b
+ { blockDataTxs =
+ if no_tx
+ then take 1 (blockDataTxs b)
+ else blockDataTxs b
+ }
S.raw $ serialAny net proto res
S.get "/blocks" $ do
cors
blocks <- param "blocks"
no_tx <- parse_no_tx
- proto <- setupProto
+ proto <- setupBin
res <-
- do let d = (db, defaultReadOptions)
- fmap catMaybes . forM blocks $ \bh ->
- runMaybeT $ do
- b <- MaybeT $ getBlock d bh
- return
- b
- { blockDataTxs =
- if no_tx
- then take 1 (blockDataTxs b)
- else blockDataTxs b
- }
+ withBlockDB defaultReadOptions db $
+ fmap catMaybes . forM blocks $ \bh ->
+ runMaybeT $ do
+ b <- MaybeT $ getBlock bh
+ return
+ b
+ { blockDataTxs =
+ if no_tx
+ then take 1 (blockDataTxs b)
+ else blockDataTxs b
+ }
S.raw $ serialAny net proto res
S.get "/mempool" $ do
cors
@@ -284,27 +291,23 @@ runWeb conf st db pub = do
UserError "mempool transactions do not have height"
Just (MemRef t) -> return $ Just t
Nothing -> return Nothing
- proto <- setupProto
- stream $ \io flush' -> do
- let d = (db, defaultReadOptions)
- runResourceT . runConduit $
- getMempool d mpu .| mapC snd .| apply_limit mlimit .|
- streamAny net proto io
- liftIO flush'
+ proto <- setupBin
+ stream $ \io flush' ->
+ runResourceT . withBlockDB defaultReadOptions db $ do
+ runConduit $
+ getMempool mpu .| mapC snd .| apply_limit mlimit .|
+ streamAny net proto io
+ liftIO flush'
S.get "/transaction/:txid" $ do
cors
txid <- param "txid"
- proto <- setupProto
- res <-
- do let d = (db, defaultReadOptions)
- getTransaction d txid
+ proto <- setupBin
+ res <- withBlockDB defaultReadOptions db $ getTransaction txid
maybeSerial net proto res
S.get "/transaction/:txid/hex" $ do
cors
txid <- param "txid"
- res <-
- do let d = (db, defaultReadOptions)
- getTransaction d txid
+ res <- withBlockDB defaultReadOptions db $ getTransaction txid
case res of
Nothing -> raise ThingNotFound
Just x ->
@@ -312,9 +315,7 @@ runWeb conf st db pub = do
S.get "/transaction/:txid/bin" $ do
cors
txid <- param "txid"
- res <-
- do let d = (db, defaultReadOptions)
- getTransaction d txid
+ res <- withBlockDB defaultReadOptions db $ getTransaction txid
case res of
Nothing -> raise ThingNotFound
Just x -> do
@@ -324,171 +325,169 @@ runWeb conf st db pub = do
cors
txid <- param "txid"
height <- param "height"
- proto <- setupProto
+ proto <- setupBin
res <-
- do let d = (db, defaultReadOptions)
- cbAfterHeight d 10000 height txid
+ withBlockDB defaultReadOptions db $
+ cbAfterHeight 10000 height txid
S.raw $ serialAny net proto res
S.get "/transactions" $ do
cors
txids <- param "txids"
- proto <- setupProto
+ proto <- setupBin
res <-
- do let d = (db, defaultReadOptions)
- catMaybes <$> mapM (getTransaction d) (nub txids)
+ withBlockDB defaultReadOptions db $
+ catMaybes <$> mapM getTransaction (nub txids)
S.raw $ serialAny net proto res
S.get "/transactions/hex" $ do
cors
txids <- param "txids"
res <-
- do let d = (db, defaultReadOptions)
- catMaybes <$> mapM (getTransaction d) (nub txids)
+ withBlockDB defaultReadOptions db $
+ catMaybes <$> mapM getTransaction (nub txids)
S.json $ map (encodeHex . Serialize.encode . transactionData) res
S.get "/transactions/bin" $ do
cors
txids <- param "txids"
res <-
- do let d = (db, defaultReadOptions)
- catMaybes <$> mapM (getTransaction d) (nub txids)
+ withBlockDB defaultReadOptions db $
+ catMaybes <$> mapM getTransaction (nub txids)
S.setHeader "Content-Type" "application/octet-stream"
S.raw . L.concat $ map (Serialize.encodeLazy . transactionData) res
S.get "/address/:address/transactions" $ do
cors
address <- parse_address
(mlimit, mbr) <- parse_limits
- proto <- setupProto
- stream $ \io flush' -> do
- let d = (db, defaultReadOptions)
- runResourceT . runConduit $
- getAddressTxs d address mbr .| apply_limit mlimit .|
- streamAny net proto io
- liftIO flush'
+ proto <- setupBin
+ stream $ \io flush' ->
+ runResourceT . withBlockDB defaultReadOptions db $ do
+ runConduit $
+ getAddressTxs address mbr .| apply_limit mlimit .|
+ streamAny net proto io
+ liftIO flush'
S.get "/address/transactions" $ do
cors
addresses <- parse_addresses
(mlimit, mbr) <- parse_limits
- proto <- setupProto
- stream $ \io flush' -> do
- let d = (db, defaultReadOptions)
- runResourceT . runConduit $
- mergeSourcesBy
- (flip compare `on` blockTxBlock)
- (map (\a -> getAddressTxs d a mbr) addresses) .|
- dedup .|
- apply_limit mlimit .|
- streamAny net proto io
- liftIO flush'
+ proto <- setupBin
+ stream $ \io flush' ->
+ runResourceT . withBlockDB defaultReadOptions db $ do
+ runConduit $
+ mergeSourcesBy
+ (flip compare `on` blockTxBlock)
+ (map (`getAddressTxs` mbr) addresses) .|
+ dedup .|
+ apply_limit mlimit .|
+ streamAny net proto io
+ liftIO flush'
S.get "/address/:address/unspent" $ do
cors
address <- parse_address
(mlimit, mbr) <- parse_limits
- proto <- setupProto
- stream $ \io flush' -> do
- let d = (db, defaultReadOptions)
- runResourceT . runConduit $
- getAddressUnspents d address mbr .| apply_limit mlimit .|
- streamAny net proto io
- liftIO flush'
+ proto <- setupBin
+ stream $ \io flush' ->
+ runResourceT . withBlockDB defaultReadOptions db $ do
+ runConduit $
+ getAddressUnspents address mbr .| apply_limit mlimit .|
+ streamAny net proto io
+ liftIO flush'
S.get "/address/unspent" $ do
cors
addresses <- parse_addresses
(mlimit, mbr) <- parse_limits
- proto <- setupProto
- stream $ \io flush' -> do
- let d = (db, defaultReadOptions)
- runResourceT . runConduit $
- mergeSourcesBy
- (flip compare `on` unspentBlock)
- (map (\a -> getAddressUnspents d a mbr) addresses) .|
- apply_limit mlimit .|
- streamAny net proto io
- liftIO flush'
+ proto <- setupBin
+ stream $ \io flush' ->
+ runResourceT . withBlockDB defaultReadOptions db $ do
+ runConduit $
+ mergeSourcesBy
+ (flip compare `on` unspentBlock)
+ (map (`getAddressUnspents` mbr) addresses) .|
+ apply_limit mlimit .|
+ streamAny net proto io
+ liftIO flush'
S.get "/address/:address/balance" $ do
cors
address <- parse_address
- proto <- setupProto
+ proto <- setupBin
res <-
- do let d = (db, defaultReadOptions)
- getBalance d address >>= \case
- Just b -> return b
- Nothing ->
- return
- Balance
- { balanceAddress = address
- , balanceAmount = 0
- , balanceUnspentCount = 0
- , balanceZero = 0
- , balanceTxCount = 0
- , balanceTotalReceived = 0
- }
+ withBlockDB defaultReadOptions db $
+ getBalance address >>= \case
+ Just b -> return b
+ Nothing ->
+ return
+ Balance
+ { balanceAddress = address
+ , balanceAmount = 0
+ , balanceUnspentCount = 0
+ , balanceZero = 0
+ , balanceTxCount = 0
+ , balanceTotalReceived = 0
+ }
S.raw $ serialAny net proto res
S.get "/address/balances" $ do
cors
addresses <- parse_addresses
- proto <- setupProto
+ proto <- setupBin
res <-
- do let d = (db, defaultReadOptions)
- f a Nothing =
- Balance
- { balanceAddress = a
- , balanceAmount = 0
- , balanceUnspentCount = 0
- , balanceZero = 0
- , balanceTxCount = 0
- , balanceTotalReceived = 0
- }
- f _ (Just b) = b
- mapM (\a -> f a <$> getBalance d a) addresses
+ withBlockDB defaultReadOptions db $ do
+ let f a Nothing =
+ Balance
+ { balanceAddress = a
+ , balanceAmount = 0
+ , balanceUnspentCount = 0
+ , balanceZero = 0
+ , balanceTxCount = 0
+ , balanceTotalReceived = 0
+ }
+ f _ (Just b) = b
+ mapM (\a -> f a <$> getBalance a) addresses
S.raw $ serialAny net proto res
S.get "/xpub/:xpub/balances" $ do
cors
xpub <- parse_xpub
- proto <- setupProto
- res <-
- do let d = (db, defaultReadOptions)
- xpubBals d xpub
+ proto <- setupBin
+ res <- withBlockDB defaultReadOptions db $ xpubBals xpub
S.raw $ serialAny net proto res
S.get "/xpub/:xpub/transactions" $ do
cors
xpub <- parse_xpub
(mlimit, mbr) <- parse_limits
- proto <- setupProto
- stream $ \io flush' -> do
- let d = (db, defaultReadOptions)
- runResourceT . runConduit $
- xpubTxs d mbr xpub .| dedup .| apply_limit mlimit .|
- streamAny net proto io
- liftIO flush'
+ proto <- setupBin
+ stream $ \io flush' ->
+ runResourceT . withBlockDB defaultReadOptions db $ do
+ runConduit $
+ xpubTxs mbr xpub .| dedup .| apply_limit mlimit .|
+ streamAny net proto io
+ liftIO flush'
S.get "/xpub/:xpub/unspent" $ do
cors
xpub <- parse_xpub
- proto <- setupProto
+ proto <- setupBin
(mlimit, mbr) <- parse_limits
- stream $ \io flush' -> do
- let d = (db, defaultReadOptions)
- runResourceT . runConduit $
- xpubUnspent d mbr xpub .| apply_limit mlimit .|
- streamAny net proto io
- liftIO flush'
+ stream $ \io flush' ->
+ runResourceT . withBlockDB defaultReadOptions db $ do
+ runConduit $
+ xpubUnspent mbr xpub .| apply_limit mlimit .|
+ streamAny net proto io
+ liftIO flush'
S.post "/transactions" $ do
cors
- proto <- setupProto
+ proto <- setupBin
b <- body
let bin = eitherToMaybe . Serialize.decode
hex = bin <=< decodeHex . cs . C.filter (not . isSpace)
tx <-
case hex b <|> bin (L.toStrict b) of
Nothing -> raise (UserError "decode tx fail")
- Just x -> return x
+ Just x -> return x
lift (publishTx pub st db tx) >>= \case
Right () -> S.raw $ serialAny net proto (TxId (txHash tx))
Left e -> do
case e of
- PubNoPeers -> status status500
- PubTimeout -> status status500
+ PubNoPeers -> status status500
+ PubTimeout -> status status500
PubPeerDisconnected -> status status500
- PubNotFound -> status status500
- PubReject _ -> status status400
+ PubNotFound -> status status500
+ PubReject _ -> status status400
S.raw $ serialAny net proto (UserError (show e))
finish
S.get "/dbstats" $ do
@@ -496,7 +495,7 @@ runWeb conf st db pub = do
getProperty db Stats >>= text . cs . fromJust
S.get "/events" $ do
cors
- proto <- setupProto
+ proto <- setupBin
stream $ \io flush' ->
withSubscription pub $ \sub ->
forever $
@@ -519,19 +518,15 @@ runWeb conf st db pub = do
io (lazyByteString bs)
S.get "/peers" $ do
cors
- proto <- setupProto
+ proto <- setupBin
ps <- getPeersInformation (storeManager st)
S.raw $ serialAny net proto ps
S.get "/health" $ do
cors
- proto <- setupProto
+ proto <- setupBin
h <-
- liftIO $
- healthCheck
- net
- (db, defaultReadOptions)
- (storeManager st)
- (storeChain st)
+ liftIO . withBlockDB defaultReadOptions db $
+ healthCheck net (storeManager st) (storeChain st)
when (not (healthOK h) || not (healthSynced h)) $ status status503
S.raw $ serialAny net proto h
notFound $ raise ThingNotFound
@@ -551,7 +546,7 @@ runWeb conf st db pub = do
_ -> return ()
mbr <- Just <$> b <|> Just <$> m <|> return Nothing
return (mlimit, mbr)
- apply_limit Nothing = mapC id
+ apply_limit Nothing = mapC id
apply_limit (Just l) = takeC l
dedup =
let dd Nothing =
@@ -573,7 +568,7 @@ runWeb conf st db pub = do
address <- param "address"
case stringToAddr net address of
Nothing -> next
- Just a -> return a
+ Just a -> return a
parse_addresses = do
addresses <- param "addresses"
let as = mapMaybe (stringToAddr net) addresses
@@ -583,7 +578,7 @@ runWeb conf st db pub = do
t <- param "xpub"
case xPubImport net t of
Nothing -> next
- Just x -> return x
+ Just x -> return x
net = configNetwork conf
parse_no_tx = param "notx" `rescue` const (return False)
runner f l = do
@@ -591,35 +586,38 @@ runWeb conf st db pub = do
unliftIO u (runLoggingT l f)
cors = setHeader "Access-Control-Allow-Origin" "*"
-serialAny :: (JsonSerial a, ProtoSerial a) => Network -> Bool -- ^ protobuf
- -> a -> L.ByteString
-serialAny net True = protoSerial net
-serialAny net False = toLazyByteString . jsonSerial net
+serialAny ::
+ (JsonSerial a, BinSerial a)
+ => Network
+ -> Bool -- ^ binary
+ -> a
+ -> L.ByteString
+serialAny net True = runPutLazy . binSerial net
+serialAny net False = encodingToLazyByteString . jsonSerial net
streamAny ::
- (JsonSerial i, ProtoSerial [i], MonadIO m)
+ (JsonSerial i, BinSerial i, MonadIO m)
=> Network
-> Bool -- ^ protobuf
-> (Builder -> IO ())
-> ConduitT i o m ()
-streamAny net True io = protoConduit net .| mapC lazyByteString .| streamConduit io
+streamAny net True io = binConduit net .| mapC lazyByteString .| streamConduit io
streamAny net False io = jsonListConduit net .| streamConduit io
jsonListConduit :: (JsonSerial a, Monad m) => Network -> ConduitT a Builder m ()
jsonListConduit net =
- yield "[" >> mapC (jsonSerial net) .| intersperseC "," >> yield "]"
+ yield "[" >> mapC (fromEncoding . jsonSerial net) .| intersperseC "," >> yield "]"
-protoConduit ::
- (ProtoSerial [a], Monad m) => Network -> ConduitT a L.ByteString m ()
-protoConduit net = mapC (protoSerial net . (: []))
+binConduit :: (BinSerial i, Monad m) => Network -> ConduitT i L.ByteString m ()
+binConduit net = mapC (runPutLazy . binSerial net)
streamConduit :: MonadIO m => (i -> IO ()) -> ConduitT i o m ()
streamConduit io = mapM_C (liftIO . io)
-setupProto :: Monad m => ActionT Except m Bool
-setupProto =
+setupBin :: Monad m => ActionT Except m Bool
+setupBin =
let p = do
- setHeader "Content-Type" "application/x-protobuf"
+ setHeader "Content-Type" "application/octet-stream"
return True
j = do
setHeader "Content-Type" "application/json"
@@ -627,18 +625,13 @@ setupProto =
in S.header "accept" >>= \case
Nothing -> j
Just x ->
- if is_proto x
+ if is_binary x
then p
else j
where
- is_proto x =
+ is_binary x =
let ts =
map
(T.takeWhile (/= ';'))
(T.splitOn "," (T.filter (not . isSpace) x))
- ps =
- [ "application/x-protobuf"
- , "application/protobuf"
- , "application/vnd.google.protobuf"
- ]
- in any (`elem` ps) ts
+ in elem "application/octet-stream" ts
diff --git a/haskoin-store.cabal b/haskoin-store.cabal
index a4cebc0..b1032c8 100644
--- a/haskoin-store.cabal
+++ b/haskoin-store.cabal
@@ -4,10 +4,10 @@ cabal-version: 1.12
--
-- see: https://github.com/sol/hpack
--
--- hash: b700d8634d497c251ec017815799d98a980e0be0531db74b2ebfcbb733bd9b60
+-- hash: 73e4ade5ce40c1a0dd2274fe3a2072c7dd75edd5c9ce325cd27f67b5966d7069
name: haskoin-store
-version: 0.13.1
+version: 0.14.0
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
@@ -32,45 +32,12 @@ library
other-modules:
Network.Haskoin.Store.Block
Network.Haskoin.Store.Data
- Network.Haskoin.Store.Data.HashMap
Network.Haskoin.Store.Data.ImportDB
Network.Haskoin.Store.Data.KeyValue
Network.Haskoin.Store.Data.RocksDB
+ Network.Haskoin.Store.Data.STM
Network.Haskoin.Store.Logic
Network.Haskoin.Store.Messages
- Network.Haskoin.Store.Proto
- Network.Haskoin.Store.ProtocolBuffers
- Network.Haskoin.Store.ProtocolBuffers.Balance
- Network.Haskoin.Store.ProtocolBuffers.BalanceList
- Network.Haskoin.Store.ProtocolBuffers.BlockData
- Network.Haskoin.Store.ProtocolBuffers.BlockDataList
- Network.Haskoin.Store.ProtocolBuffers.BlockRef
- Network.Haskoin.Store.ProtocolBuffers.BlockRef.Block
- Network.Haskoin.Store.ProtocolBuffers.BlockRef.Block_ref
- Network.Haskoin.Store.ProtocolBuffers.BlockRef.Mempool
- Network.Haskoin.Store.ProtocolBuffers.BlockTx
- Network.Haskoin.Store.ProtocolBuffers.BlockTxList
- Network.Haskoin.Store.ProtocolBuffers.Error
- Network.Haskoin.Store.ProtocolBuffers.Event
- Network.Haskoin.Store.ProtocolBuffers.Event.Type
- Network.Haskoin.Store.ProtocolBuffers.EventList
- Network.Haskoin.Store.ProtocolBuffers.HealthCheck
- Network.Haskoin.Store.ProtocolBuffers.Input
- Network.Haskoin.Store.ProtocolBuffers.Output
- Network.Haskoin.Store.ProtocolBuffers.Peer
- Network.Haskoin.Store.ProtocolBuffers.PeerList
- Network.Haskoin.Store.ProtocolBuffers.Spender
- Network.Haskoin.Store.ProtocolBuffers.Transaction
- Network.Haskoin.Store.ProtocolBuffers.TransactionList
- Network.Haskoin.Store.ProtocolBuffers.TxAfterHeight
- Network.Haskoin.Store.ProtocolBuffers.TxId
- Network.Haskoin.Store.ProtocolBuffers.TxIdList
- Network.Haskoin.Store.ProtocolBuffers.Unspent
- Network.Haskoin.Store.ProtocolBuffers.UnspentList
- Network.Haskoin.Store.ProtocolBuffers.XPubBalance
- Network.Haskoin.Store.ProtocolBuffers.XPubBalanceList
- Network.Haskoin.Store.ProtocolBuffers.XPubUnspent
- Network.Haskoin.Store.ProtocolBuffers.XPubUnspentList
Paths_haskoin_store
hs-source-dirs:
src
diff --git a/src/Haskoin/Store.hs b/src/Haskoin/Store.hs
index 8318025..b6961ce 100644
--- a/src/Haskoin/Store.hs
+++ b/src/Haskoin/Store.hs
@@ -28,7 +28,7 @@ module Haskoin.Store
, Event(..)
, TxAfterHeight(..)
, JsonSerial(..)
- , ProtoSerial(..)
+ , BinSerial(..)
, Except(..)
, TxId(..)
, withStore
@@ -54,45 +54,34 @@ module Haskoin.Store
, transactionData
, isCoinbase
, confirmed
- , blockDataToJSON
- , blockDataToEncoding
- , transactionToJSON
- , transactionToEncoding
- , outputToJSON
- , outputToEncoding
- , inputToJSON
- , inputToEncoding
- , unspentToJSON
- , unspentToEncoding
- , balanceToJSON
- , balanceToEncoding
- , xPubBalToJSON
- , xPubBalToEncoding
- , xPubUnspentToJSON
- , xPubUnspentToEncoding
, cbAfterHeight
, healthCheck
, mergeSourcesBy
+ , withBlockDB
+ , withBlockSTM
+ , withBalanceSTM
+ , withUnspentSTM
) where
import Conduit
import Control.Monad
-import qualified Control.Monad.Except as E
+import qualified Control.Monad.Except as E
import Control.Monad.Logger
import Control.Monad.Trans.Maybe
import Data.Foldable
import Data.Function
import Data.List
import Data.Maybe
-import Data.Serialize (decode)
-import Database.RocksDB as R
+import Data.Serialize (decode)
+import Database.RocksDB as R
import Haskoin
import Haskoin.Node
import Network.Haskoin.Store.Block
import Network.Haskoin.Store.Data
+import Network.Haskoin.Store.Data.RocksDB
+import Network.Haskoin.Store.Data.STM
import Network.Haskoin.Store.Messages
-import Network.Haskoin.Store.Proto
-import Network.Socket (SockAddr (..))
+import Network.Socket (SockAddr (..))
import NQE
import System.Random
import UnliftIO
@@ -227,18 +216,17 @@ storeDispatch _ pub (PeerEvent (PeerMessage p (MReject r))) =
storeDispatch _ _ (PeerEvent _) = return ()
healthCheck ::
- (MonadUnliftIO m, StoreRead r m)
+ (MonadUnliftIO m, StoreRead m)
=> Network
- -> r
-> Manager
-> Chain
-> m HealthCheck
-healthCheck net i mgr ch = do
+healthCheck net mgr ch = do
n <- timeout (5 * 1000 * 1000) $ chainGetBest ch
b <-
runMaybeT $ do
- h <- MaybeT $ getBestBlock i
- MaybeT $ getBlock i h
+ h <- MaybeT getBestBlock
+ MaybeT $ getBlock h
p <- timeout (5 * 1000 * 1000) $ managerGetPeers mgr
let k = isNothing n || isNothing b || maybe False (not . null) p
s =
@@ -267,9 +255,9 @@ publishTx ::
-> Tx
-> m (Either PubExcept ())
publishTx pub st db tx =
- withSubscription pub $ \s -> do
- let d = (db, defaultReadOptions)
- getTransaction d (txHash tx) >>= \case
+ withSubscription pub $ \s ->
+ withBlockDB defaultReadOptions db $
+ getTransaction (txHash tx) >>= \case
Just _ -> return $ Right ()
Nothing ->
E.runExceptT $
@@ -317,17 +305,16 @@ getPeersInformation mgr = mapMaybe toInfo <$> managerGetPeers mgr
, peerRelay = rl
}
-xpubBals :: (Monad m, BalanceRead i m) => i -> XPubKey -> m [XPubBal]
-xpubBals i xpub = (<>) <$> go 0 0 <*> go 1 0
+xpubBals :: (Monad m, BalanceRead m) => XPubKey -> m [XPubBal]
+xpubBals xpub = (<>) <$> go 0 0 <*> go 1 0
where
- g = getBalance i
go m n = do
xs <- catMaybes <$> mapM (uncurry b) (as m n)
case xs of
[] -> return []
_ -> (xs <>) <$> go m (n + 20)
b a p =
- g a >>= \case
+ getBalance a >>= \case
Nothing -> return Nothing
Just b' -> return $ Just XPubBal {xPubBalPath = p, xPubBal = b'}
as m n =
@@ -336,29 +323,27 @@ xpubBals i xpub = (<>) <$> go 0 0 <*> go 1 0
(take 20 (deriveAddrs (pubSubKey xpub m) n))
xpubTxs ::
- (Monad m, BalanceRead i m, StoreStream i m)
- => i
- -> Maybe BlockRef
+ (Monad m, BalanceRead m, StoreStream m)
+ => Maybe BlockRef
-> XPubKey
-> ConduitT () BlockTx m ()
-xpubTxs i mbr xpub = do
- bals <- lift $ xpubBals i xpub
+xpubTxs mbr xpub = do
+ bals <- lift $ xpubBals xpub
xs <-
forM bals $ \XPubBal {xPubBal = b} ->
- return $ getAddressTxs i (balanceAddress b) mbr
+ return $ getAddressTxs (balanceAddress b) mbr
mergeSourcesBy (flip compare `on` blockTxBlock) xs
xpubUnspent ::
- (Monad m, StoreStream i m, BalanceRead i m, StoreRead i m)
- => i
- -> Maybe BlockRef
+ (Monad m, StoreStream m, BalanceRead m, StoreRead m)
+ => Maybe BlockRef
-> XPubKey
-> ConduitT () XPubUnspent m ()
-xpubUnspent i mbr xpub = do
- bals <- lift $ xpubBals i xpub
+xpubUnspent mbr xpub = do
+ bals <- lift $ xpubBals xpub
xs <-
forM bals $ \XPubBal {xPubBalPath = p, xPubBal = b} ->
- return $ getAddressUnspents i (balanceAddress b) mbr .| mapC (f p)
+ return $ getAddressUnspents (balanceAddress b) mbr .| mapC (f p)
mergeSourcesBy (flip compare `on` (unspentBlock . xPubUnspent)) xs
where
f p t = XPubUnspent {xPubUnspentPath = p, xPubUnspent = t}
@@ -367,13 +352,12 @@ xpubUnspent i mbr xpub = do
-- specified height. Returns 'Nothing' if answer cannot be computed before
-- hitting limits.
cbAfterHeight ::
- (Monad m, StoreRead i m)
- => i
- -> Int -- ^ how many ancestors to test before giving up
+ (Monad m, StoreRead m)
+ => Int -- ^ how many ancestors to test before giving up
-> BlockHeight
-> TxHash
-> m TxAfterHeight
-cbAfterHeight i d h t
+cbAfterHeight d h t
| d <= 0 = return $ TxAfterHeight Nothing
| otherwise = TxAfterHeight <$> runMaybeT (snd <$> tst d t)
where
@@ -381,7 +365,7 @@ cbAfterHeight i d h t
| e <= 0 = MaybeT $ return Nothing
| otherwise = do
let e' = e - 1
- tx <- MaybeT $ getTransaction i x
+ tx <- MaybeT $ getTransaction x
if any isCoinbase (transactionInputs tx)
then return (e', blockRefHeight (transactionBlock tx) > h)
else case transactionBlock tx of
diff --git a/src/Network/Haskoin/Store/Block.hs b/src/Network/Haskoin/Store/Block.hs
index ccb64c7..abc8cfa 100644
--- a/src/Network/Haskoin/Store/Block.hs
+++ b/src/Network/Haskoin/Store/Block.hs
@@ -9,6 +9,7 @@ module Network.Haskoin.Store.Block
( blockStore
) where
+import Control.Arrow
import Control.Monad.Except
import Control.Monad.Logger
import Control.Monad.Reader
@@ -16,13 +17,15 @@ 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
-import Network.Haskoin.Store.Data.HashMap
import Network.Haskoin.Store.Data.ImportDB
+import Network.Haskoin.Store.Data.RocksDB
+import Network.Haskoin.Store.Data.STM
import Network.Haskoin.Store.Logic
import Network.Haskoin.Store.Messages
import NQE
@@ -76,10 +79,8 @@ blockStore cfg inbox = do
}
where
ini = do
- db <- blockConfDB <$> asks myConfig
- net <- blockConfNet <$> asks myConfig
- um <- asks myUnspent
- bm <- asks myBalances
+ (db, net) <- (blockConfDB &&& blockConfNet) <$> asks myConfig
+ (um, bm) <- asks (myUnspent &&& myBalances)
runExceptT (initDB net db um bm) >>= \case
Left e -> do
$(logErrorS) "Block" $
@@ -87,51 +88,54 @@ blockStore cfg inbox = do
throwIO e
Right () -> $(logInfoS) "Block" "Initialization complete"
run =
- withAsync (pingMe (inboxToMailbox inbox)) $ \_ ->
- forever $ receive inbox >>= processBlockMessage
+ withAsync (pingMe (inboxToMailbox inbox)) . const . forever $ do
+ $(logDebugS) "Block" "Awaiting message..."
+ receive inbox >>= processBlockMessage
-isSynced :: (MonadReader BlockRead m, MonadUnliftIO m) => m Bool
+isSynced :: (MonadUnliftIO m) => ReaderT BlockRead m Bool
isSynced = do
- db <- blockConfDB <$> asks myConfig
- getBestBlock (db, defaultReadOptions) >>= \case
- Nothing -> throwIO Uninitialized
- Just bb -> do
- ch <- blockConfChain <$> asks myConfig
- chainGetBest ch >>= \cb -> return (headerHash (nodeHeader cb) == bb)
+ (db, ch) <- (blockConfDB &&& blockConfChain) <$> asks myConfig
+ withBlockDB defaultReadOptions db $
+ getBestBlock >>= \case
+ Nothing -> throwIO Uninitialized
+ Just bb ->
+ chainGetBest ch >>= \cb ->
+ return (headerHash (nodeHeader cb) == bb)
mempool ::
- (MonadReader BlockRead m, MonadUnliftIO m, MonadLoggerIO m) => Peer -> m ()
+ (MonadUnliftIO m, MonadLoggerIO m) => Peer -> ReaderT BlockRead m ()
mempool p = MMempool `sendMessage` p
-pruneCache :: (MonadReader BlockRead m, MonadUnliftIO m, MonadLoggerIO m) => m ()
+pruneCache :: (MonadUnliftIO m, MonadLoggerIO m) => ReaderT BlockRead m ()
pruneCache = do
um <- asks myUnspent
bm <- asks myBalances
- u <- readTVarIO um
- b <- readTVarIO bm
- $(logDebugS) "Block" $
- "Unspent output cache pre-prune tx count: " <>
- fromString (show (M.size u))
- $(logDebugS) "Block" $
- "Address cache pre-prune count: " <> fromString (show (M.size (fst b)))
- pruneUnspent um
- pruneBalance bm
- u' <- readTVarIO um
- b' <- readTVarIO bm
- $(logDebugS) "Block" $
- "Unspent output cache post-prune tx count: " <>
- fromString (show (M.size u'))
- $(logDebugS) "Block" $
- "Address cache post-prune count: " <>
- fromString (show (M.size (fst b')))
+ do u <- readTVarIO um
+ b <- readTVarIO bm
+ $(logDebugS) "Block" $
+ "Unspent output cache pre-prune tx count: " <>
+ fromString (show (M.size u))
+ $(logDebugS) "Block" $
+ "Address cache pre-prune count: " <>
+ fromString (show (M.size (fst b)))
+ atomically $
+ withUnspentSTM um pruneUnspent >> withBalanceSTM bm pruneBalance
+ do u <- readTVarIO um
+ b <- readTVarIO bm
+ $(logDebugS) "Block" $
+ "Unspent output cache post-prune tx count: " <>
+ fromString (show (M.size u))
+ $(logDebugS) "Block" $
+ "Address cache post-prune count: " <>
+ fromString (show (M.size (fst b)))
processBlock ::
- (MonadReader BlockRead m, MonadUnliftIO m, MonadLoggerIO m)
+ (MonadUnliftIO m, MonadLoggerIO m)
=> Peer
-> Block
- -> m ()
+ -> ReaderT BlockRead m ()
processBlock p b = do
- $(logDebugS) "Block" ("Processing incoming block " <> hex)
+ $(logDebugS) "Block" ("Processing incoming block: " <> hex)
void . runMaybeT $ do
iss >>= \x ->
unless x $ do
@@ -162,16 +166,16 @@ processBlock p b = do
where
hex = blockHashToHex (headerHash (blockHeader b))
upr =
- asks myPeer >>= \box ->
- readTVarIO box >>= \case
- Nothing -> throwIO SyncingPeerExpected
- Just s@Syncing {syncingHead = h} ->
- if nodeHeader h == blockHeader b
- then resetPeer
- else do
- now <- systemSeconds <$> liftIO getSystemTime
- atomically . writeTVar box $
- Just s {syncingTime = now}
+ asks myPeer >>= readTVarIO >>= \case
+ Nothing -> throwIO SyncingPeerExpected
+ Just s@Syncing {syncingHead = h} ->
+ if nodeHeader h == blockHeader b
+ then resetPeer
+ else do
+ now <- systemSeconds <$> liftIO getSystemTime
+ asks myPeer >>=
+ atomically .
+ (`writeTVar` Just s {syncingTime = now})
iss =
asks myPeer >>= readTVarIO >>= \case
Just Syncing {syncingPeer = p'} -> return $ p == p'
@@ -188,46 +192,56 @@ processBlock p b = do
Just n -> return n
processNoBlocks ::
- (MonadReader BlockRead m, MonadUnliftIO m, MonadLoggerIO m)
+ (MonadUnliftIO m, MonadLoggerIO m)
=> Peer
-> [BlockHash]
- -> m ()
+ -> ReaderT BlockRead m ()
processNoBlocks p _bs = do
- $(logErrorS) "Block" "Killing peer that could not find blocks"
- killPeer (PeerMisbehaving "Sent notfound message with block hashes") p
+ $(logErrorS) "Block" "We do not like peers that cannot find them blocks"
+ killPeer
+ (PeerMisbehaving "We do not like peers that cannot find them blocks")
+ p
processTx ::
- (MonadReader BlockRead m, MonadUnliftIO m, MonadLoggerIO m)
+ (MonadUnliftIO m, MonadLoggerIO m)
=> Peer
-> Tx
- -> m ()
+ -> ReaderT BlockRead m ()
processTx _p tx =
- isSynced >>= \x ->
- when x $ do
+ isSynced >>= \case
+ False ->
+ $(logDebugS) "Block" $
+ "Ignoring incoming tx (not synced yet): " <> txHashToHex (txHash tx)
+ True -> do
$(logInfoS) "Block" $ "Incoming tx: " <> txHashToHex (txHash tx)
now <- preciseUnixTime <$> liftIO getSystemTime
- net <- blockConfNet <$> asks myConfig
- db <- blockConfDB <$> asks myConfig
+ (net, db) <- (blockConfNet &&& blockConfDB) <$> asks myConfig
um <- asks myUnspent
bm <- asks myBalances
- runExceptT (runImportDB db um bm $ \i -> newMempoolTx net i tx now) >>= \case
+ runExceptT (runImportDB db um bm $ newMempoolTx net tx now) >>= \case
Left e ->
$(logErrorS) "Block" $
"Error importing tx: " <> txHashToHex (txHash tx) <> ": " <>
fromString (show e)
Right True -> do
l <- blockConfListener <$> asks myConfig
+ $(logDebugS) "Block" $
+ "Received mempool tx: " <> txHashToHex (txHash tx)
atomically $ l (StoreMempoolNew (txHash tx))
- Right False -> return ()
+ Right False ->
+ $(logDebugS) "Block" $
+ "Received invalid mempool tx: " <> txHashToHex (txHash tx)
processTxs ::
- (MonadReader BlockRead m, MonadUnliftIO m, MonadLoggerIO m)
+ (MonadUnliftIO m, MonadLoggerIO m)
=> Peer
-> [TxHash]
- -> m ()
+ -> ReaderT BlockRead m ()
processTxs p hs =
- isSynced >>= \x ->
- when x $ do
+ isSynced >>= \case
+ False ->
+ $(logDebugS) "Block" "Ignoring incoming tx inv (not synced yet)"
+ True -> do
db <- blockConfDB <$> asks myConfig
$(logDebugS) "Block" $
"Received " <> fromString (show (length hs)) <>
@@ -235,7 +249,7 @@ processTxs p hs =
xs <-
fmap catMaybes . forM hs $ \h ->
runMaybeT $ do
- t <- getTxData (db, defaultReadOptions) h
+ t <- withBlockDB defaultReadOptions db $ getTxData h
guard (isNothing t)
return (getTxHash h)
unless (null xs) $ do
@@ -249,35 +263,38 @@ processTxs p hs =
else InvTx
MGetData (GetData (map (InvVector inv) xs)) `sendMessage` p
-checkTime :: (MonadReader BlockRead m, MonadUnliftIO m, MonadLoggerIO m) => m ()
+checkTime :: (MonadUnliftIO m, MonadLoggerIO m) => ReaderT BlockRead m ()
checkTime =
asks myPeer >>= readTVarIO >>= \case
- Nothing -> return ()
+ Nothing -> $(logDebugS) "Block" "Peer timeout check: no syncing peer"
Just Syncing {syncingTime = t, syncingPeer = p} -> do
n <- systemSeconds <$> liftIO getSystemTime
- when (n > t + 60) $ do
- $(logErrorS) "Block" "Peer timeout"
- killPeer PeerTimeout p
+ if n > t + 60
+ then do
+ $(logErrorS) "Block" "Peer timeout"
+ killPeer PeerTimeout p
+ else $(logDebugS) "Block" "Peer timeout not reached"
processDisconnect ::
- (MonadReader BlockRead m, MonadUnliftIO m, MonadLoggerIO m)
+ (MonadUnliftIO m, MonadLoggerIO m)
=> Peer
- -> m ()
+ -> ReaderT BlockRead m ()
processDisconnect p =
asks myPeer >>= readTVarIO >>= \case
- Nothing -> return ()
+ Nothing ->
+ $(logDebugS) "Block" "Ignoring peer disconnection notification"
Just Syncing {syncingPeer = p'}
| p == p' -> do
$(logErrorS) "Block" "Syncing peer disconnected"
resetPeer
syncMe
- | otherwise -> return ()
+ | otherwise -> $(logDebugS) "Block" "Non-syncing peer disconnected"
purgeMempool ::
- (MonadReader BlockRead m, MonadUnliftIO m, MonadLoggerIO m) => m ()
+ (MonadUnliftIO m, MonadLoggerIO m) => ReaderT BlockRead m ()
purgeMempool = $(logErrorS) "Block" "Mempool purging not implemented"
-syncMe :: (MonadReader BlockRead m, MonadUnliftIO m, MonadLoggerIO m) => m ()
+syncMe :: (MonadUnliftIO m, MonadLoggerIO m) => ReaderT BlockRead m ()
syncMe =
void . runMaybeT $ do
rev
@@ -289,10 +306,15 @@ syncMe =
"Not syncing blocks as no peers available"
mzero
Just p -> return p
+ $(logDebugS) "Block" "Syncing blocks against network peer"
b <- mbn
d <- dbn
c <- cbn
- when (end b d c) mzero
+ when (end b d c) $ do
+ $(logDebugS) "Block" $
+ "Already requested up to block height: " <>
+ cs (show (nodeHeight b))
+ mzero
ns <- bls c b
setPeer p (last ns)
net <- blockConfNet <$> asks myConfig
@@ -316,7 +338,7 @@ syncMe =
dbn = do
db <- blockConfDB <$> asks myConfig
bb <-
- getBestBlock (db, defaultReadOptions) >>= \case
+ withBlockDB defaultReadOptions db getBestBlock >>= \case
Nothing -> do
$(logErrorS) "Block" "Best block not in database"
throwIO Uninitialized
@@ -377,7 +399,7 @@ syncMe =
um <- asks myUnspent
bm <- asks myBalances
net <- blockConfNet <$> asks myConfig
- runExceptT (runImportDB db um bm $ \i -> revertBlock net i d) >>= \case
+ runExceptT (runImportDB db um bm $ revertBlock net d) >>= \case
Left e -> do
$(logErrorS) "Block" $
"Could not revert best block: " <>
@@ -385,13 +407,13 @@ syncMe =
throwIO e
Right () -> rev
-resetPeer :: (MonadReader BlockRead m, MonadLoggerIO m) => m ()
+resetPeer :: (MonadLoggerIO m, MonadReader BlockRead m) => m ()
resetPeer = do
$(logDebugS) "Block" "Resetting syncing peer..."
box <- asks myPeer
atomically $ writeTVar box Nothing
-setPeer :: (MonadReader BlockRead m, MonadIO m) => Peer -> BlockNode -> m ()
+setPeer :: (MonadIO m, MonadReader BlockRead m) => Peer -> BlockNode -> m ()
setPeer p b = do
box <- asks myPeer
now <- systemSeconds <$> liftIO getSystemTime
@@ -399,9 +421,9 @@ setPeer p b = do
Just Syncing {syncingPeer = p, syncingHead = b, syncingTime = now}
processBlockMessage ::
- (MonadReader BlockRead m, MonadUnliftIO m, MonadLoggerIO m)
+ (MonadUnliftIO m, MonadLoggerIO m)
=> BlockMessage
- -> m ()
+ -> ReaderT BlockRead m ()
processBlockMessage (BlockNewBest bn) = do
$(logDebugS) "Block" $
"New best block header " <> fromString (show (nodeHeight bn)) <> ": " <>
@@ -418,7 +440,8 @@ processBlockMessage (BlockTxAvailable p ts) = processTxs p ts
processBlockMessage BlockPing = checkTime
processBlockMessage PurgeMempool = purgeMempool
-pingMe :: MonadIO m => Mailbox BlockMessage -> m ()
+pingMe :: MonadLoggerIO m => Mailbox BlockMessage -> m ()
pingMe mbox = forever $ do
threadDelay =<< liftIO (randomRIO (5 * 1000 * 1000, 10 * 1000 * 1000))
+ $(logDebugS) "Block" "Pinging block"
BlockPing `send` mbox
diff --git a/src/Network/Haskoin/Store/Data.hs b/src/Network/Haskoin/Store/Data.hs
index 8fcbb2a..495f601 100644
--- a/src/Network/Haskoin/Store/Data.hs
+++ b/src/Network/Haskoin/Store/Data.hs
@@ -10,9 +10,9 @@ import Control.Applicative
import Control.Monad
import Control.Monad.Trans.Maybe
import Data.Aeson as A
+import qualified Data.Aeson.Encoding as A
import Data.ByteString (ByteString)
import qualified Data.ByteString as B
-import Data.ByteString.Builder
import Data.ByteString.Short (ShortByteString)
import qualified Data.ByteString.Short as B.Short
import Data.Hashable
@@ -22,11 +22,13 @@ import Data.IntMap.Strict (IntMap)
import Data.Maybe
import Data.Serialize as S
import Data.String.Conversions
-import qualified Data.Text.Lazy as T
+import qualified Data.Text as T
+import qualified Data.Text.Encoding as T
+import qualified Data.Text.Lazy as T.Lazy
import Data.Time.Clock.System
import Data.Word
import GHC.Generics
-import Haskoin
+import Haskoin as H
import Network.Socket (SockAddr)
import Paths_haskoin_store as P
import UnliftIO.Exception
@@ -37,63 +39,57 @@ type UnixTime = Int64
newtype InitException = IncorrectVersion Word32
deriving (Show, Read, Eq, Ord, Exception)
-class Applicative m => UnspentWrite u m where
- addUnspent :: u -> Unspent -> m ()
- delUnspent :: u -> OutPoint -> m ()
- pruneUnspent :: u -> m ()
- pruneUnspent _ = pure ()
+class UnspentWrite m where
+ addUnspent :: Unspent -> m ()
+ delUnspent :: OutPoint -> m ()
+ pruneUnspent :: m ()
-class UnspentRead u m where
- getUnspent :: u -> OutPoint -> m (Maybe Unspent)
+class UnspentRead m where
+ getUnspent :: OutPoint -> m (Maybe Unspent)
-class Applicative m => BalanceWrite b m where
- setBalance :: b -> Balance -> m ()
- pruneBalance :: b -> m ()
- pruneBalance _ = pure ()
+class BalanceWrite m where
+ setBalance :: Balance -> m ()
+ pruneBalance :: m ()
-class BalanceRead b m where
- getBalance :: b -> Address -> m (Maybe Balance)
+class BalanceRead m where
+ getBalance :: Address -> m (Maybe Balance)
-class StoreRead r m where
- isInitialized :: r -> m (Either InitException Bool)
- getBestBlock :: r -> m (Maybe BlockHash)
- getBlocksAtHeight :: r -> BlockHeight -> m [BlockHash]
- getBlock :: r -> BlockHash -> m (Maybe BlockData)
- getTxData :: r -> TxHash -> m (Maybe TxData)
- getSpenders :: r -> TxHash -> m (IntMap Spender)
- getSpender :: r -> OutPoint -> m (Maybe Spender)
+class StoreRead m where
+ isInitialized :: m (Either InitException Bool)
+ getBestBlock :: m (Maybe BlockHash)
+ getBlocksAtHeight :: BlockHeight -> m [BlockHash]
+ getBlock :: BlockHash -> m (Maybe BlockData)
+ getTxData :: TxHash -> m (Maybe TxData)
+ getSpenders :: TxHash -> m (IntMap Spender)
+ getSpender :: OutPoint -> m (Maybe Spender)
getTransaction ::
- (Monad m, StoreRead r m) => r -> TxHash -> m (Maybe Transaction)
-getTransaction r h = runMaybeT $ do
- d <- MaybeT $ getTxData r h
- sm <- lift $ getSpenders r h
+ (Monad m, StoreRead m) => TxHash -> m (Maybe Transaction)
+getTransaction h = runMaybeT $ do
+ d <- MaybeT $ getTxData h
+ sm <- lift $ getSpenders h
return $ toTransaction d sm
-class StoreStream r m where
+class StoreStream m where
getMempool ::
- r
- -> Maybe PreciseUnixTime
- -> ConduitT () (PreciseUnixTime, TxHash) m ()
- getAddressUnspents ::
- r -> Address -> Maybe BlockRef -> ConduitT () Unspent m ()
- getAddressTxs ::
- r -> Address -> Maybe BlockRef -> ConduitT () BlockTx m ()
-
-class StoreWrite w m where
- setInit :: w -> m ()
- setBest :: w -> BlockHash -> m ()
- insertBlock :: w -> BlockData -> m ()
- insertAtHeight :: w -> BlockHash -> BlockHeight -> m ()
- insertTx :: w -> TxData -> m ()
- insertSpender :: w -> OutPoint -> Spender -> m ()
- deleteSpender :: w -> OutPoint -> m ()
- insertAddrTx :: w -> Address -> BlockTx -> m ()
- removeAddrTx :: w -> Address -> BlockTx -> m ()
- insertAddrUnspent :: w -> Address -> Unspent -> m ()
- removeAddrUnspent :: w -> Address -> Unspent -> m ()
- insertMempoolTx :: w -> TxHash -> PreciseUnixTime -> m ()
- deleteMempoolTx :: w -> TxHash -> PreciseUnixTime -> m ()
+ Maybe PreciseUnixTime -> ConduitT () (PreciseUnixTime, TxHash) m ()
+ getAddressUnspents :: Address -> Maybe BlockRef -> ConduitT () Unspent m ()
+ getAddressTxs :: Address -> Maybe BlockRef -> ConduitT () BlockTx m ()
+
+class StoreWrite m where
+ setInit :: m ()
+ setBest :: BlockHash -> m ()
+ insertBlock :: BlockData -> m ()
+ insertAtHeight :: BlockHash -> BlockHeight -> m ()
+ insertTx :: TxData -> m ()
+ insertSpender :: OutPoint -> Spender -> m ()
+ deleteSpender :: OutPoint -> m ()
+ insertAddrTx :: Address -> BlockTx -> m ()
+ removeAddrTx :: Address -> BlockTx -> m ()
+ insertAddrUnspent :: Address -> Unspent -> m ()
+ removeAddrUnspent :: Address -> Unspent -> m ()
+ insertMempoolTx :: TxHash -> PreciseUnixTime -> m ()
+ deleteMempoolTx :: TxHash -> PreciseUnixTime -> m ()
-- | Unix time with nanosecond precision for mempool transactions.
newtype PreciseUnixTime = PreciseUnixTime Word64
@@ -115,13 +111,26 @@ instance ToJSON PreciseUnixTime where
toEncoding (PreciseUnixTime w) = toEncoding w
class JsonSerial a where
- jsonSerial :: Network -> a -> Builder
+ jsonSerial :: Network -> a -> Encoding
jsonValue :: Network -> a -> Value
+instance JsonSerial a => JsonSerial [a] where
+ jsonSerial net = A.list (jsonSerial net)
+ jsonValue net = toJSON . map (jsonValue net)
+
instance JsonSerial TxHash where
- jsonSerial _ = fromEncoding . toEncoding
+ jsonSerial _ = toEncoding
jsonValue _ = toJSON
+instance BinSerial TxHash where
+ binSerial _ = put
+
+class BinSerial a where
+ binSerial :: Network -> Putter a
+
+instance BinSerial a => BinSerial [a] where
+ binSerial net = putListOf (binSerial net)
+
-- | Reference to a block where a transaction is stored.
data BlockRef
= BlockRef { blockRefHeight :: !BlockHeight
@@ -145,14 +154,22 @@ instance Serialize BlockRef where
where
getmemref = do
guard . (== 0x00) =<< getWord8
- w <- (maxBound -) <$> getWord64be
- return MemRef {memRefTime = PreciseUnixTime w}
+ MemRef . PreciseUnixTime <$> get
getblockref = do
guard . (== 0x01) =<< getWord8
h <- (maxBound -) <$> getWord32be
p <- (maxBound -) <$> getWord32be
return BlockRef {blockRefHeight = h, blockRefPos = p}
+instance BinSerial BlockRef where
+ binSerial _ BlockRef {blockRefHeight = h, blockRefPos = p} = do
+ putWord8 0x00
+ putWord32be h
+ putWord32be p
+ binSerial _ MemRef {memRefTime = PreciseUnixTime t} = do
+ putWord8 0x01
+ putWord64be t
+
-- | JSON serialization for 'BlockRef'.
blockRefPairs :: A.KeyValue kv => BlockRef -> [kv]
blockRefPairs BlockRef {blockRefHeight = h, blockRefPos = p} =
@@ -187,9 +204,14 @@ instance ToJSON BlockTx where
toEncoding = pairs . mconcat . blockTxPairs
instance JsonSerial BlockTx where
- jsonSerial _ = fromEncoding . toEncoding
+ jsonSerial _ = toEncoding
jsonValue _ = toJSON
+instance BinSerial BlockTx where
+ binSerial net BlockTx { blockTxBlock = b, blockTxHash = h }= do
+ binSerial net b
+ put h
+
-- | Address balance information.
data Balance = Balance
{ balanceAddress :: !Address
@@ -224,12 +246,23 @@ balanceToEncoding :: Network -> Balance -> Encoding
balanceToEncoding net = pairs . mconcat . balancePairs net
instance JsonSerial Balance where
- jsonSerial net = fromEncoding . balanceToEncoding net
+ jsonSerial = balanceToEncoding
jsonValue = balanceToJSON
-instance JsonSerial [Balance] where
- jsonSerial net = fromEncoding . toEncoding . map (balanceToJSON net)
- jsonValue net = toJSON . map (balanceToJSON net)
+instance BinSerial Balance where
+ binSerial net Balance { balanceAddress = a
+ , balanceAmount = v
+ , balanceZero = z
+ , balanceUnspentCount = u
+ , balanceTxCount = c
+ , balanceTotalReceived = t
+ } = do
+ put $ T.encodeUtf8 <$> (addrToString net a)
+ putWord64be v
+ putWord64be z
+ putWord64be u
+ putWord64be c
+ putWord64be t
-- | Unspent output.
data Unspent = Unspent
@@ -273,9 +306,20 @@ unspentToEncoding :: Network -> Unspent -> Encoding
unspentToEncoding net = pairs . mconcat . unspentPairs net
instance JsonSerial Unspent where
- jsonSerial net = fromEncoding . unspentToEncoding net
+ jsonSerial = unspentToEncoding
jsonValue = unspentToJSON
+instance BinSerial Unspent where
+ binSerial net Unspent { unspentBlock = b
+ , unspentPoint = p
+ , unspentAmount = v
+ , unspentScript = s
+ } = do
+ binSerial net b
+ put p
+ putWord64be v
+ put s
+
-- | Database value for a block entry.
data BlockData = BlockData
{ blockDataHeight :: !BlockHeight
@@ -326,55 +370,71 @@ blockDataToEncoding :: Network -> BlockData -> Encoding
blockDataToEncoding net = pairs . mconcat . blockDataPairs net
instance JsonSerial BlockData where
- jsonSerial net = fromEncoding . blockDataToEncoding net
+ jsonSerial = blockDataToEncoding
jsonValue = blockDataToJSON
-instance JsonSerial [BlockData] where
- jsonSerial net = fromEncoding . toEncoding . map (blockDataToJSON net)
- jsonValue net = toJSON . map (blockDataToJSON net)
+instance BinSerial BlockData where
+ binSerial _ BlockData { blockDataHeight = e
+ , blockDataMainChain = m
+ , blockDataHeader = h
+ , blockDataSize = z
+ , blockDataWeight = g
+ , blockDataTxs = t
+ , blockDataOutputs = o
+ , blockDataFees = f
+ , blockDataSubsidy = y
+ } = do
+ put m
+ putWord32be e
+ put h
+ putWord32be z
+ putWord32be g
+ putWord64be o
+ putWord64be f
+ putWord64be y
+ put t
+
-- | Input information.
-data Input
- = Coinbase { inputPoint :: !OutPoint
+data StoreInput
+ = StoreCoinbase { inputPoint :: !OutPoint
-- ^ output being spent (should be null)
- , inputSequence :: !Word32
+ , inputSequence :: !Word32
-- ^ sequence
- , inputSigScript :: !ByteString
+ , inputSigScript :: !ByteString
-- ^ input script data (not valid script)
- , inputWitness :: !(Maybe WitnessStack)
+ , inputWitness :: !(Maybe WitnessStack)
-- ^ witness data for this input (only segwit)
- }
+ }
-- ^ coinbase details
- | Input { inputPoint :: !OutPoint
+ | StoreInput { inputPoint :: !OutPoint
-- ^ output being spent
- , inputSequence :: !Word32
+ , inputSequence :: !Word32
-- ^ sequence
- , inputSigScript :: !ByteString
+ , inputSigScript :: !ByteString
-- ^ signature (input) script
- , inputPkScript :: !ByteString
+ , inputPkScript :: !ByteString
-- ^ pubkey (output) script from previous tx
- , inputAmount :: !Word64
+ , inputAmount :: !Word64
-- ^ amount in satoshi being spent spent
- , inputWitness :: !(Maybe WitnessStack)
+ , inputWitness :: !(Maybe WitnessStack)
-- ^ witness data for this input (only segwit)
- }
+ }
-- ^ input details
deriving (Show, Read, Eq, Ord, Generic, Serialize, Hashable)
--- | Is 'Input' a Coinbase?
-isCoinbase :: Input -> Bool
-isCoinbase Coinbase {} = True
-isCoinbase Input {} = False
-
--- | JSON serialization for 'Input'.
-inputPairs :: A.KeyValue kv => Network -> Input -> [kv]
-inputPairs net Input { inputPoint = OutPoint oph opi
- , inputSequence = sq
- , inputSigScript = ss
- , inputPkScript = ps
- , inputAmount = val
- , inputWitness = wit
- } =
+isCoinbase :: StoreInput -> Bool
+isCoinbase StoreCoinbase {} = True
+isCoinbase StoreInput {} = False
+
+inputPairs :: A.KeyValue kv => Network -> StoreInput -> [kv]
+inputPairs net StoreInput { inputPoint = OutPoint oph opi
+ , inputSequence = sq
+ , inputSigScript = ss
+ , inputPkScript = ps
+ , inputAmount = val
+ , inputWitness = wit
+ } =
[ "coinbase" .= False
, "txid" .= oph
, "output" .= opi
@@ -386,11 +446,11 @@ inputPairs net Input { inputPoint = OutPoint oph opi
] ++
["witness" .= fmap (map encodeHex) wit | getSegWit net]
-inputPairs net Coinbase { inputPoint = OutPoint oph opi
- , inputSequence = sq
- , inputSigScript = ss
- , inputWitness = wit
- } =
+inputPairs net StoreCoinbase { inputPoint = OutPoint oph opi
+ , inputSequence = sq
+ , inputSigScript = ss
+ , inputWitness = wit
+ } =
[ "coinbase" .= True
, "txid" .= oph
, "output" .= opi
@@ -402,12 +462,37 @@ inputPairs net Coinbase { inputPoint = OutPoint oph opi
] ++
["witness" .= fmap (map encodeHex) wit | getSegWit net]
-inputToJSON :: Network -> Input -> Value
+inputToJSON :: Network -> StoreInput -> Value
inputToJSON net = object . inputPairs net
-inputToEncoding :: Network -> Input -> Encoding
+inputToEncoding :: Network -> StoreInput -> Encoding
inputToEncoding net = pairs . mconcat . inputPairs net
+instance BinSerial StoreInput where
+ binSerial net i = do
+ put $
+ case i of
+ StoreCoinbase {} -> True
+ StoreInput {} -> False
+ put $ inputPoint i
+ putWord32be $ inputSequence i
+ put $ inputSigScript i
+ put $ inputWitness i
+ put $
+ case i of
+ StoreCoinbase {} -> Nothing
+ StoreInput {inputPkScript = s} ->
+ fmap T.encodeUtf8 <$> addrToString net =<<
+ eitherToMaybe (scriptToAddressBS s)
+ putWord64be $
+ case i of
+ StoreCoinbase {} -> 0
+ StoreInput {inputAmount = v} -> v
+ put $
+ case i of
+ StoreCoinbase {} -> B.empty
+ StoreInput {inputPkScript = s} -> s
+
-- | Information about input spending output.
data Spender = Spender
{ spenderHash :: !TxHash
@@ -426,7 +511,7 @@ instance ToJSON Spender where
toEncoding = pairs . mconcat . spenderPairs
-- | Output information.
-data Output = Output
+data StoreOutput = StoreOutput
{ outputAmount :: !Word64
-- ^ amount in satoshi
, outputScript :: !ByteString
@@ -435,8 +520,7 @@ data Output = Output
-- ^ input spending this transaction
} deriving (Show, Read, Eq, Ord, Generic, Serialize, Hashable)
--- | JSON serialization for 'Output'.
-outputPairs :: A.KeyValue kv => Network -> Output -> [kv]
+outputPairs :: A.KeyValue kv => Network -> StoreOutput -> [kv]
outputPairs net d =
[ "address" .=
eitherToMaybe (addrToJSON net <$> scriptToAddressBS (outputScript d))
@@ -446,10 +530,10 @@ outputPairs net d =
] ++
["spender" .= outputSpender d | isJust (outputSpender d)]
-outputToJSON :: Network -> Output -> Value
+outputToJSON :: Network -> StoreOutput -> Value
outputToJSON net = object . outputPairs net
-outputToEncoding :: Network -> Output -> Encoding
+outputToEncoding :: Network -> StoreOutput -> Encoding
outputToEncoding net = pairs . mconcat . outputPairs net
data Prev = Prev
@@ -457,16 +541,16 @@ data Prev = Prev
, prevAmount :: !Word64
} deriving (Show, Eq, Ord, Generic, Hashable, Serialize)
-toInput :: TxIn -> Maybe Prev -> Maybe WitnessStack -> Input
+toInput :: TxIn -> Maybe Prev -> Maybe WitnessStack -> StoreInput
toInput i Nothing w =
- Coinbase
+ StoreCoinbase
{ inputPoint = prevOutput i
, inputSequence = txInSequence i
, inputSigScript = scriptInput i
, inputWitness = w
}
toInput i (Just p) w =
- Input
+ StoreInput
{ inputPoint = prevOutput i
, inputSequence = txInSequence i
, inputSigScript = scriptInput i
@@ -475,9 +559,9 @@ toInput i (Just p) w =
, inputWitness = w
}
-toOutput :: TxOut -> Maybe Spender -> Output
+toOutput :: TxOut -> Maybe Spender -> StoreOutput
toOutput o s =
- Output
+ StoreOutput
{ outputAmount = outValue o
, outputScript = scriptOutput o
, outputSpender = s
@@ -525,12 +609,12 @@ fromTransaction t = (d, sm)
, txDataRBF = transactionRBF t
, txDataTime = transactionTime t
}
- f _ Coinbase {} = Nothing
- f n Input {inputPkScript = s, inputAmount = v} =
+ f _ StoreCoinbase {} = Nothing
+ f n StoreInput {inputPkScript = s, inputAmount = v} =
Just (n, Prev {prevScript = s, prevAmount = v})
ps = I.fromList . catMaybes $ zipWith f [0 ..] (transactionInputs t)
- g _ Output {outputSpender = Nothing} = Nothing
- g n Output {outputSpender = Just s} = Just (n, s)
+ g _ StoreOutput {outputSpender = Nothing} = Nothing
+ g n StoreOutput {outputSpender = Just s} = Just (n, s)
sm = I.fromList . catMaybes $ zipWith g [0 ..] (transactionOutputs t)
-- | Detailed transaction information.
@@ -541,9 +625,9 @@ data Transaction = Transaction
-- ^ transaction version
, transactionLockTime :: !Word32
-- ^ lock time
- , transactionInputs :: ![Input]
+ , transactionInputs :: ![StoreInput]
-- ^ transaction inputs
- , transactionOutputs :: ![Output]
+ , transactionOutputs :: ![StoreOutput]
-- ^ transaction outputs
, transactionDeleted :: !Bool
-- ^ this transaction has been deleted and is no longer valid
@@ -563,11 +647,11 @@ transactionData t =
, txLockTime = transactionLockTime t
}
where
- i Coinbase {inputPoint = p, inputSequence = q, inputSigScript = s} =
+ i StoreCoinbase {inputPoint = p, inputSequence = q, inputSigScript = s} =
TxIn {prevOutput = p, scriptInput = s, txInSequence = q}
- i Input {inputPoint = p, inputSequence = q, inputSigScript = s} =
+ i StoreInput {inputPoint = p, inputSequence = q, inputSigScript = s} =
TxIn {prevOutput = p, scriptInput = s, txInSequence = q}
- o Output {outputAmount = v, outputScript = s} =
+ o StoreOutput {outputAmount = v, outputScript = s} =
TxOut {outValue = v, scriptOutput = s}
-- | JSON serialization for 'Transaction'.
@@ -602,12 +686,27 @@ transactionToEncoding :: Network -> Transaction -> Encoding
transactionToEncoding net = pairs . mconcat . transactionPairs net
instance JsonSerial Transaction where
- jsonSerial net = fromEncoding . transactionToEncoding net
+ jsonSerial = transactionToEncoding
jsonValue = transactionToJSON
-instance JsonSerial [Transaction] where
- jsonSerial net = fromEncoding . toEncoding . map (transactionToJSON net)
- jsonValue net = toJSON . map (transactionToJSON net)
+instance BinSerial Transaction where
+ binSerial net Transaction { transactionBlock = b
+ , transactionVersion = v
+ , transactionLockTime = l
+ , transactionInputs = is
+ , transactionOutputs = os
+ , transactionDeleted = d
+ , transactionRBF = r
+ , transactionTime = t
+ } = do
+ binSerial net b
+ putWord32be v
+ putWord32be l
+ put d
+ put r
+ putWord64be t
+ put is
+ put os
-- | Information about a connected peer.
data PeerInformation
@@ -639,12 +738,21 @@ instance ToJSON PeerInformation where
toEncoding = pairs . mconcat . peerInformationPairs
instance JsonSerial PeerInformation where
- jsonSerial _ = fromEncoding . toEncoding
+ jsonSerial _ = toEncoding
jsonValue _ = toJSON
-instance JsonSerial [PeerInformation] where
- jsonSerial _ = fromEncoding . toEncoding
- jsonValue _ = toJSON
+instance BinSerial PeerInformation where
+ binSerial _ PeerInformation { peerUserAgent = u
+ , peerAddress = a
+ , peerVersion = v
+ , peerServices = s
+ , peerRelay = b
+ } = do
+ putWord32be v
+ putWord64be s
+ put b
+ put $ show a
+ put u
-- | Address balances for an extended public key.
data XPubBal = XPubBal
@@ -666,12 +774,13 @@ xPubBalToEncoding :: Network -> XPubBal -> Encoding
xPubBalToEncoding net = pairs . mconcat . xPubBalPairs net
instance JsonSerial XPubBal where
- jsonSerial net = fromEncoding . xPubBalToEncoding net
+ jsonSerial = xPubBalToEncoding
jsonValue = xPubBalToJSON
-instance JsonSerial [XPubBal] where
- jsonSerial net = fromEncoding . toEncoding . map (xPubBalToJSON net)
- jsonValue net = toJSON . map (xPubBalToJSON net)
+instance BinSerial XPubBal where
+ binSerial net XPubBal {xPubBalPath = p, xPubBal = b} = do
+ put p
+ binSerial net b
-- | Unspent transaction for extended public key.
data XPubUnspent = XPubUnspent
@@ -695,9 +804,14 @@ xPubUnspentToEncoding :: Network -> XPubUnspent -> Encoding
xPubUnspentToEncoding net = pairs . mconcat . xPubUnspentPairs net
instance JsonSerial XPubUnspent where
- jsonSerial net = fromEncoding . xPubUnspentToEncoding net
+ jsonSerial = xPubUnspentToEncoding
jsonValue = xPubUnspentToJSON
+instance BinSerial XPubUnspent where
+ binSerial net XPubUnspent {xPubUnspentPath = p, xPubUnspent = u} = do
+ put p
+ binSerial net u
+
data HealthCheck = HealthCheck
{ healthHeaderBest :: !(Maybe BlockHash)
, healthHeaderHeight :: !(Maybe BlockHeight)
@@ -727,9 +841,28 @@ instance ToJSON HealthCheck where
toEncoding = pairs . mconcat . healthCheckPairs
instance JsonSerial HealthCheck where
- jsonSerial _ = fromEncoding . toEncoding
+ jsonSerial _ = toEncoding
jsonValue _ = toJSON
+instance BinSerial HealthCheck where
+ binSerial _ HealthCheck { healthHeaderBest = hbest
+ , healthHeaderHeight = hheight
+ , healthBlockBest = bbest
+ , healthBlockHeight = bheight
+ , healthPeers = peers
+ , healthNetwork = net
+ , healthOK = ok
+ , healthSynced = synced
+ } = do
+ put hbest
+ put hheight
+ put bbest
+ put bheight
+ put peers
+ put net
+ put ok
+ put synced
+
data Event
= EventBlock BlockHash
| EventTx TxHash
@@ -740,20 +873,27 @@ instance ToJSON Event where
toJSON (EventBlock h) = object ["type" .= String "block", "id" .= h]
instance JsonSerial Event where
- jsonSerial _ = fromEncoding . toEncoding
+ jsonSerial _ = toEncoding
jsonValue _ = toJSON
+instance BinSerial Event where
+ binSerial _ (EventBlock bh) = putWord8 0x00 >> put bh
+ binSerial _ (EventTx th) = putWord8 0x01 >> put th
+
newtype TxAfterHeight = TxAfterHeight
{ txAfterHeight :: Maybe Bool
} deriving (Show, Eq, Generic)
instance ToJSON TxAfterHeight where
- toJSON (TxAfterHeight b) = object ["result" .= b]
+ toJSON (TxAfterHeight b) = object ["result" .= b]
instance JsonSerial TxAfterHeight where
- jsonSerial _ = fromEncoding . toEncoding
+ jsonSerial _ = toEncoding
jsonValue _ = toJSON
+instance BinSerial TxAfterHeight where
+ binSerial _ TxAfterHeight {txAfterHeight = a} = put a
+
data Except
= ThingNotFound
| ServerError
@@ -763,30 +903,36 @@ data Except
deriving Eq
instance Show Except where
- show ThingNotFound = "not found"
- show ServerError = "you made me kill a unicorn"
- show BadRequest = "bad request"
- show (UserError s) = s
+ show ThingNotFound = "not found"
+ show ServerError = "you made me kill a unicorn"
+ show BadRequest = "bad request"
+ show (UserError s) = s
show (StringError _) = "you made me kill a unicorn"
instance Exception Except
instance Scotty.ScottyError Except where
stringError = StringError
- showError = T.pack . show
+ showError = T.Lazy.pack . show
instance ToJSON Except where
toJSON e = object ["error" .= T.pack (show e)]
instance JsonSerial Except where
- jsonSerial _ = fromEncoding . toEncoding
+ jsonSerial _ = toEncoding
jsonValue _ = toJSON
+instance BinSerial Except where
+ binSerial _ = put . T.encodeUtf8 . T.pack . show
+
newtype TxId = TxId TxHash deriving (Show, Eq, Generic)
instance ToJSON TxId where
toJSON h = object ["txid" .= h]
instance JsonSerial TxId where
- jsonSerial _ = fromEncoding . toEncoding
+ jsonSerial _ = toEncoding
jsonValue _ = toJSON
+
+instance BinSerial TxId where
+ binSerial _ (TxId th) = put th
diff --git a/src/Network/Haskoin/Store/Data/ImportDB.hs b/src/Network/Haskoin/Store/Data/ImportDB.hs
index 768a326..66d7f64 100644
--- a/src/Network/Haskoin/Store/Data/ImportDB.hs
+++ b/src/Network/Haskoin/Store/Data/ImportDB.hs
@@ -1,12 +1,13 @@
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE LambdaCase #-}
-{-# LANGUAGE MultiParamTypeClasses #-}
module Network.Haskoin.Store.Data.ImportDB where
import Conduit
import Control.Applicative
import Control.Monad.Except
+import Control.Monad.Reader (ReaderT)
+import qualified Control.Monad.Reader as R
import Control.Monad.Trans.Maybe
import qualified Data.ByteString.Short as B.Short
import Data.HashMap.Strict (HashMap)
@@ -19,13 +20,13 @@ import Database.RocksDB as R
import Database.RocksDB.Query as R
import Haskoin
import Network.Haskoin.Store.Data
-import Network.Haskoin.Store.Data.HashMap
import Network.Haskoin.Store.Data.KeyValue
import Network.Haskoin.Store.Data.RocksDB
+import Network.Haskoin.Store.Data.STM
import UnliftIO
data ImportDB = ImportDB
- { importRocksDB :: !(DB, ReadOptions)
+ { importRocksDB :: !(ReadOptions, DB)
, importHashMap :: !(TVar HashMapDB)
, importUnspentMap :: !(TVar UnspentMap)
, importBalanceMap :: !(TVar BalanceMap)
@@ -36,14 +37,15 @@ runImportDB ::
=> DB
-> TVar UnspentMap
-> TVar BalanceMap
- -> (ImportDB -> m a)
+ -> ReaderT ImportDB m a
-> m a
runImportDB db um bm f = do
hm <- newTVarIO emptyHashMapDB
x <-
- f
+ R.runReaderT
+ f
ImportDB
- { importRocksDB = d
+ { importRocksDB = (defaultReadOptions, db)
, importHashMap = hm
, importUnspentMap = um
, importBalanceMap = bm
@@ -51,8 +53,6 @@ runImportDB db um bm f = do
ops <- hashMapOps <$> readTVarIO hm
writeBatch db ops
return x
- where
- d = (db, defaultReadOptions)
hashMapOps :: HashMapDB -> [BatchOp]
hashMapOps db =
@@ -163,98 +163,181 @@ unspentOps = concatMap (uncurry f) . M.toList
g h i Nothing = deleteOp (UnspentKey (OutPoint h (fromIntegral i)))
isInitializedI :: MonadIO m => ImportDB -> m (Either InitException Bool)
-isInitializedI ImportDB {importRocksDB = db}= isInitialized db
+isInitializedI ImportDB {importRocksDB = db} =
+ uncurry withBlockDB db isInitialized
+
+setInitI :: MonadIO m => ImportDB -> m ()
+setInitI ImportDB {importRocksDB = (_, db), importHashMap = hm} = do
+ atomically $ withBlockSTM hm setInit
+ setInitDB db
+
+setBestI :: MonadIO m => BlockHash -> ImportDB -> m ()
+setBestI bh ImportDB {importHashMap = hm} =
+ atomically . withBlockSTM hm $ setBest bh
+
+insertBlockI :: MonadIO m => BlockData -> ImportDB -> m ()
+insertBlockI b ImportDB {importHashMap = hm} =
+ atomically . withBlockSTM hm $ insertBlock b
+
+insertAtHeightI :: MonadIO m => BlockHash -> BlockHeight -> ImportDB -> m ()
+insertAtHeightI b h ImportDB {importHashMap = hm} =
+ atomically . withBlockSTM hm $ insertAtHeight b h
+
+insertTxI :: MonadIO m => TxData -> ImportDB -> m ()
+insertTxI t ImportDB {importHashMap = hm} =
+ atomically . withBlockSTM hm $ insertTx t
+
+insertSpenderI :: MonadIO m => OutPoint -> Spender -> ImportDB -> m ()
+insertSpenderI p s ImportDB {importHashMap = hm} =
+ atomically . withBlockSTM hm $ insertSpender p s
+
+deleteSpenderI :: MonadIO m => OutPoint -> ImportDB -> m ()
+deleteSpenderI p ImportDB {importHashMap = hm} =
+ atomically . withBlockSTM hm $ deleteSpender p
+
+insertAddrTxI :: MonadIO m => Address -> BlockTx -> ImportDB -> m ()
+insertAddrTxI a t ImportDB {importHashMap = hm} =
+ atomically . withBlockSTM hm $ insertAddrTx a t
+
+removeAddrTxI :: MonadIO m => Address -> BlockTx -> ImportDB -> m ()
+removeAddrTxI a t ImportDB {importHashMap = hm} =
+ atomically . withBlockSTM hm $ removeAddrTx a t
+
+insertAddrUnspentI :: MonadIO m => Address -> Unspent -> ImportDB -> m ()
+insertAddrUnspentI a u ImportDB {importHashMap = hm} =
+ atomically . withBlockSTM hm $ insertAddrUnspent a u
+
+removeAddrUnspentI :: MonadIO m => Address -> Unspent -> ImportDB -> m ()
+removeAddrUnspentI a u ImportDB {importHashMap = hm} =
+ atomically . withBlockSTM hm $ removeAddrUnspent a u
+
+insertMempoolTxI :: MonadIO m => TxHash -> PreciseUnixTime -> ImportDB -> m ()
+insertMempoolTxI t p ImportDB {importHashMap = hm} =
+ atomically . withBlockSTM hm $ insertMempoolTx t p
+
+deleteMempoolTxI :: MonadIO m => TxHash -> PreciseUnixTime -> ImportDB -> m ()
+deleteMempoolTxI t p ImportDB {importHashMap = hm} =
+ atomically . withBlockSTM hm $ deleteMempoolTx t p
getBestBlockI :: MonadIO m => ImportDB -> m (Maybe BlockHash)
getBestBlockI ImportDB {importHashMap = hm, importRocksDB = db} =
- runMaybeT $ MaybeT (getBestBlock hm) <|> MaybeT (getBestBlock db)
+ runMaybeT $ MaybeT f <|> MaybeT g
+ where
+ f = atomically $ withBlockSTM hm getBestBlock
+ g = uncurry withBlockDB db getBestBlock
-getBlocksAtHeightI :: MonadIO m => ImportDB -> BlockHeight -> m [BlockHash]
-getBlocksAtHeightI ImportDB {importHashMap = hm, importRocksDB = db} bh = do
- xs <- getBlocksAtHeight hm bh
- ys <- getBlocksAtHeight db bh
+getBlocksAtHeightI :: MonadIO m => BlockHeight -> ImportDB -> m [BlockHash]
+getBlocksAtHeightI bh ImportDB {importHashMap = hm, importRocksDB = db} = do
+ xs <- atomically . withBlockSTM hm $ getBlocksAtHeight bh
+ ys <- uncurry withBlockDB db $ getBlocksAtHeight bh
return . nub $ xs <> ys
-getBlockI :: MonadIO m => ImportDB -> BlockHash -> m (Maybe BlockData)
-getBlockI ImportDB {importRocksDB = db, importHashMap = hm} bh =
- runMaybeT $ MaybeT (getBlock hm bh) <|> MaybeT (getBlock db bh)
+getBlockI :: MonadIO m => BlockHash -> ImportDB -> m (Maybe BlockData)
+getBlockI bh ImportDB {importRocksDB = db, importHashMap = hm} =
+ runMaybeT $ MaybeT f <|> MaybeT g
+ where
+ f = atomically . withBlockSTM hm $ getBlock bh
+ g = uncurry withBlockDB db $ getBlock bh
getTxDataI ::
- MonadIO m => ImportDB -> TxHash -> m (Maybe TxData)
-getTxDataI ImportDB {importRocksDB = db, importHashMap = hm} th =
- runMaybeT $ MaybeT (getTxData hm th) <|> MaybeT (getTxData db th)
+ MonadIO m => TxHash -> ImportDB -> m (Maybe TxData)
+getTxDataI th ImportDB {importRocksDB = db, importHashMap = hm} =
+ runMaybeT $ MaybeT f <|> MaybeT g
+ where
+ f = atomically . withBlockSTM hm $ getTxData th
+ g = uncurry withBlockDB db $ getTxData th
-getSpenderI :: MonadIO m => ImportDB -> OutPoint -> m (Maybe Spender)
-getSpenderI ImportDB {importRocksDB = db, importHashMap = hm} op =
- getSpenderH <$> readTVarIO hm <*> pure op >>= \case
+getSpenderI :: MonadIO m => OutPoint -> ImportDB -> m (Maybe Spender)
+getSpenderI op ImportDB {importRocksDB = db, importHashMap = hm} =
+ getSpenderH op <$> readTVarIO hm >>= \case
Just s -> return s
- Nothing -> getSpender db op
+ Nothing -> uncurry withBlockDB db $ getSpender op
-getSpendersI :: MonadIO m => ImportDB -> TxHash -> m (IntMap Spender)
-getSpendersI ImportDB {importRocksDB = db, importHashMap = hm} t = do
- hsm <- getSpendersH <$> readTVarIO hm <*> pure t
- dsm <- I.map Just <$> getSpenders db t
+getSpendersI :: MonadIO m => TxHash -> ImportDB -> m (IntMap Spender)
+getSpendersI t ImportDB {importRocksDB = db, importHashMap = hm} = do
+ hsm <- getSpendersH t <$> readTVarIO hm
+ dsm <- I.map Just <$> uncurry withBlockDB db (getSpenders t)
return . I.map fromJust . I.filter isJust $ hsm <> dsm
-getBalanceI :: MonadIO m => ImportDB -> Address -> m (Maybe Balance)
-getBalanceI ImportDB { importRocksDB = db
- , importHashMap = hm
- , importBalanceMap = bm
- } a = runMaybeT $ cachemap <|> hashmap <|> database
+getBalanceI :: MonadIO m => Address -> ImportDB -> m (Maybe Balance)
+getBalanceI a ImportDB { importRocksDB = db
+ , importHashMap = hm
+ , importBalanceMap = bm
+ } =
+ runMaybeT $
+ MaybeT (atomically . runMaybeT $ cachemap <|> hashmap) <|> database
where
- cachemap = MaybeT $ getBalance bm a
- hashmap = MaybeT $ getBalance hm a
- database = MaybeT $ getBalance db a
-
-getUnspentI :: MonadIO m => ImportDB -> OutPoint -> m (Maybe Unspent)
-getUnspentI ImportDB { importRocksDB = db
- , importHashMap = hm
- , importUnspentMap = um
- } op =
- getUnspent um op >>= \case
- Just b -> return (Just b)
- Nothing ->
- getUnspentH <$> readTVarIO hm <*> pure op >>= \case
- Just x -> return x
- Nothing -> getUnspent db op
-
-instance MonadIO m => StoreRead ImportDB m where
- isInitialized = isInitializedI
- getBestBlock = getBestBlockI
- getBlocksAtHeight = getBlocksAtHeightI
- getBlock = getBlockI
- getTxData = getTxDataI
- getSpender = getSpenderI
- getSpenders = getSpendersI
-
-instance MonadIO m => StoreWrite ImportDB m where
- setInit ImportDB {importHashMap = hm, importRocksDB = (db, _)} =
- setInit hm >> setInitDB db
- setBest ImportDB {importHashMap = hm} = setBest hm
- insertBlock ImportDB {importHashMap = hm} = insertBlock hm
- insertAtHeight ImportDB {importHashMap = hm} = insertAtHeight hm
- insertTx ImportDB {importHashMap = hm} = insertTx hm
- insertSpender ImportDB {importHashMap = hm} = insertSpender hm
- deleteSpender ImportDB {importHashMap = hm} = deleteSpender hm
- insertAddrTx ImportDB {importHashMap = hm} = insertAddrTx hm
- removeAddrTx ImportDB {importHashMap = hm} = removeAddrTx hm
- insertAddrUnspent ImportDB {importHashMap = hm} = insertAddrUnspent hm
- removeAddrUnspent ImportDB {importHashMap = hm} = removeAddrUnspent hm
- insertMempoolTx ImportDB {importHashMap = hm} = insertMempoolTx hm
- deleteMempoolTx ImportDB {importHashMap = hm} = deleteMempoolTx hm
-
-instance MonadIO m => UnspentRead ImportDB m where
- getUnspent = getUnspentI
-
-instance MonadIO m => UnspentWrite ImportDB m where
- addUnspent ImportDB {importHashMap = hm, importUnspentMap = um} u =
- addUnspent hm u >> addUnspent um u
- delUnspent ImportDB {importHashMap = hm, importUnspentMap = um} op =
- delUnspent um op >> delUnspent hm op
-
-instance MonadIO m => BalanceRead ImportDB m where
- getBalance = getBalanceI
-
-instance MonadIO m => BalanceWrite ImportDB m where
- setBalance ImportDB {importHashMap = hm, importBalanceMap = bm} b =
- setBalance hm b >> setBalance bm b
+ cachemap = MaybeT . withBalanceSTM bm $ getBalance a
+ hashmap = MaybeT . withBlockSTM hm $ getBalance a
+ database = MaybeT . uncurry withBlockDB db $ getBalance a
+
+setBalanceI :: MonadIO m => Balance -> ImportDB -> m ()
+setBalanceI b ImportDB {importHashMap = hm, importBalanceMap = bm} =
+ atomically $ do
+ withBlockSTM hm $ setBalance b
+ withBalanceSTM bm $ setBalance b
+
+getUnspentI :: MonadIO m => OutPoint -> ImportDB -> m (Maybe Unspent)
+getUnspentI op ImportDB { importRocksDB = db
+ , importHashMap = hm
+ , importUnspentMap = um
+ } = do
+ u <-
+ atomically . runMaybeT $ do
+ let x = withUnspentSTM um (getUnspent op)
+ y = getUnspentH op <$> readTVar hm
+ Just <$> MaybeT x <|> MaybeT y
+ case u of
+ Nothing -> uncurry withBlockDB db $ getUnspent op
+ Just x -> return x
+
+addUnspentI :: MonadIO m => Unspent -> ImportDB -> m ()
+addUnspentI u ImportDB {importHashMap = hm, importUnspentMap = um} =
+ atomically $ do
+ withBlockSTM hm $ addUnspent u
+ withUnspentSTM um $ addUnspent u
+
+delUnspentI :: MonadIO m => OutPoint -> ImportDB -> m ()
+delUnspentI p ImportDB {importHashMap = hm, importUnspentMap = um} =
+ atomically $ do
+ withUnspentSTM um $ delUnspent p
+ withBlockSTM hm $ delUnspent p
+
+instance (MonadIO m) => StoreRead (ReaderT ImportDB m) where
+ isInitialized = R.ask >>= isInitializedI
+ getBestBlock = R.ask >>= getBestBlockI
+ getBlocksAtHeight h = R.ask >>= getBlocksAtHeightI h
+ getBlock b = R.ask >>= getBlockI b
+ getTxData t = R.ask >>= getTxDataI t
+ getSpender p = R.ask >>= getSpenderI p
+ getSpenders t = R.ask >>= getSpendersI t
+
+instance (MonadIO m) => StoreWrite (ReaderT ImportDB m) where
+ setInit = R.ask >>= setInitI
+ setBest h = R.ask >>= setBestI h
+ insertBlock b = R.ask >>= insertBlockI b
+ insertAtHeight b h = R.ask >>= insertAtHeightI b h
+ insertTx t = R.ask >>= insertTxI t
+ insertSpender p s = R.ask >>= insertSpenderI p s
+ deleteSpender p = R.ask >>= deleteSpenderI p
+ insertAddrTx a t = R.ask >>= insertAddrTxI a t
+ removeAddrTx a t = R.ask >>= removeAddrTxI a t
+ insertAddrUnspent a u = R.ask >>= insertAddrUnspentI a u
+ removeAddrUnspent a u = R.ask >>= removeAddrUnspentI a u
+ insertMempoolTx t p = R.ask >>= insertMempoolTxI t p
+ deleteMempoolTx t p = R.ask >>= deleteMempoolTxI t p
+
+instance (MonadIO m) => UnspentRead (ReaderT ImportDB m) where
+ getUnspent a = R.ask >>= getUnspentI a
+
+instance (MonadIO m) => UnspentWrite (ReaderT ImportDB m) where
+ addUnspent u = R.ask >>= addUnspentI u
+ delUnspent p = R.ask >>= delUnspentI p
+ pruneUnspent = return ()
+
+instance (MonadIO m) => BalanceRead (ReaderT ImportDB m) where
+ getBalance a = R.ask >>= getBalanceI a
+
+instance (MonadIO m) => BalanceWrite (ReaderT ImportDB m) where
+ setBalance b = R.ask >>= setBalanceI b
+ pruneBalance = return ()
diff --git a/src/Network/Haskoin/Store/Data/KeyValue.hs b/src/Network/Haskoin/Store/Data/KeyValue.hs
index b5f6413..f81a68a 100644
--- a/src/Network/Haskoin/Store/Data/KeyValue.hs
+++ b/src/Network/Haskoin/Store/Data/KeyValue.hs
@@ -1,7 +1,5 @@
-{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
-{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
module Network.Haskoin.Store.Data.KeyValue where
@@ -13,7 +11,7 @@ import Data.Default
import Data.Hashable
import Data.Serialize as S
import Data.Word
-import Database.RocksDB.Query
+import qualified Database.RocksDB.Query as R
import GHC.Generics
import Haskoin
import Network.Haskoin.Store.Data
@@ -67,9 +65,9 @@ instance Serialize AddrTxKey
}
}
-instance Key AddrTxKey
+instance R.Key AddrTxKey
-instance KeyValue AddrTxKey ()
+instance R.KeyValue AddrTxKey ()
-- | Database key for an address output.
data AddrOutKey
@@ -105,14 +103,14 @@ instance Serialize AddrOutKey
guard . (== 0x06) =<< getWord8
AddrOutKey <$> get <*> get <*> get
-instance Key AddrOutKey
+instance R.Key AddrOutKey
data OutVal = OutVal
{ outValAmount :: !Word64
, outValScript :: !ByteString
} deriving (Show, Read, Eq, Ord, Generic, Hashable, Serialize)
-instance KeyValue AddrOutKey OutVal
+instance R.KeyValue AddrOutKey OutVal
-- | Transaction database key.
newtype TxKey = TxKey
@@ -128,9 +126,9 @@ instance Serialize TxKey where
guard . (== 0x02) =<< getWord8
TxKey <$> get
-instance Key TxKey
+instance R.Key TxKey
-instance KeyValue TxKey TxData
+instance R.KeyValue TxKey TxData
data SpenderKey
= SpenderKey { outputPoint :: !OutPoint }
@@ -151,9 +149,9 @@ instance Serialize SpenderKey where
op <- OutPoint <$> get <*> get
return $ SpenderKey op
-instance Key SpenderKey
+instance R.Key SpenderKey
-instance KeyValue SpenderKey Spender
+instance R.KeyValue SpenderKey Spender
-- | Unspent output database key.
data UnspentKey
@@ -182,9 +180,9 @@ data UnspentVal = UnspentVal
, unspentValScript :: !ByteString
} deriving (Show, Read, Eq, Ord, Generic, Hashable, Serialize)
-instance Key UnspentKey
+instance R.Key UnspentKey
-instance KeyValue UnspentKey UnspentVal
+instance R.KeyValue UnspentKey UnspentVal
-- | Mempool transaction database key.
data MemKey
@@ -209,8 +207,8 @@ instance Serialize MemKey where
guard . (== 0x07) =<< getWord8
MemKey <$> get <*> get
-instance Key MemKey
-instance KeyValue MemKey ()
+instance R.Key MemKey
+instance R.KeyValue MemKey ()
-- | Block entry database key.
newtype BlockKey = BlockKey
@@ -226,7 +224,7 @@ instance Serialize BlockKey where
guard . (== 0x01) =<< getWord8
BlockKey <$> get
-instance KeyValue BlockKey BlockData
+instance R.KeyValue BlockKey BlockData
-- | Block height database key.
newtype HeightKey = HeightKey
@@ -242,9 +240,9 @@ instance Serialize HeightKey where
guard . (== 0x03) =<< getWord8
HeightKey <$> get
-instance Key HeightKey
+instance R.Key HeightKey
-instance KeyValue HeightKey [BlockHash]
+instance R.KeyValue HeightKey [BlockHash]
-- | Address balance database key.
newtype BalKey
@@ -260,7 +258,7 @@ instance Serialize BalKey where
guard . (== 0x04) =<< getWord8
BalKey <$> get
-instance Key BalKey
+instance R.Key BalKey
-- | Address balance database value.
data BalVal = BalVal
@@ -287,7 +285,7 @@ instance Default BalVal where
, balValTotalReceived = 0
}
-instance KeyValue BalKey BalVal
+instance R.KeyValue BalKey BalVal
-- | Key for best block in database.
data BestKey =
@@ -301,9 +299,9 @@ instance Serialize BestKey where
guard . (== B.replicate 32 0x00) =<< getBytes 32
return BestKey
-instance Key BestKey
+instance R.Key BestKey
-instance KeyValue BestKey BlockHash
+instance R.KeyValue BestKey BlockHash
-- | Key for database version.
data VersionKey =
@@ -317,6 +315,6 @@ instance Serialize VersionKey where
guard . (== 0x0a) =<< getWord8
return VersionKey
-instance Key VersionKey
+instance R.Key VersionKey
-instance KeyValue VersionKey Word32
+instance R.KeyValue VersionKey Word32
diff --git a/src/Network/Haskoin/Store/Data/RocksDB.hs b/src/Network/Haskoin/Store/Data/RocksDB.hs
index 4240c58..35b435e 100644
--- a/src/Network/Haskoin/Store/Data/RocksDB.hs
+++ b/src/Network/Haskoin/Store/Data/RocksDB.hs
@@ -1,12 +1,12 @@
{-# LANGUAGE DeriveAnyClass #-}
-{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE LambdaCase #-}
-{-# LANGUAGE MultiParamTypeClasses #-}
{-# OPTIONS_GHC -Wno-orphans #-}
module Network.Haskoin.Store.Data.RocksDB where
import Conduit
+import Control.Monad.Reader (ReaderT)
+import qualified Control.Monad.Reader as R
import qualified Data.ByteString.Short as B.Short
import Data.IntMap (IntMap)
import qualified Data.IntMap.Strict as I
@@ -18,51 +18,57 @@ import Network.Haskoin.Store.Data
import Network.Haskoin.Store.Data.KeyValue
import UnliftIO
+type BlockDB = (ReadOptions, DB)
+
dataVersion :: Word32
dataVersion = 14
+withBlockDB :: ReadOptions -> DB -> ReaderT BlockDB m a -> m a
+withBlockDB opts db f = R.runReaderT f (opts, db)
+
data ExceptRocksDB =
MempoolTxNotFound
deriving (Eq, Show, Read, Exception)
-isInitializedDB :: MonadIO m => DB -> ReadOptions -> m (Either InitException Bool)
-isInitializedDB db opts =
+isInitializedDB ::
+ MonadIO m => ReadOptions -> DB -> m (Either InitException Bool)
+isInitializedDB opts db =
retrieve db opts VersionKey >>= \case
Just v
| v == dataVersion -> return (Right True)
| otherwise -> return (Left (IncorrectVersion v))
Nothing -> return (Right False)
-getBestBlockDB :: MonadIO m => DB -> ReadOptions -> m (Maybe BlockHash)
-getBestBlockDB db opts = retrieve db opts BestKey
+getBestBlockDB :: MonadIO m => ReadOptions -> DB -> m (Maybe BlockHash)
+getBestBlockDB opts db = retrieve db opts BestKey
getBlocksAtHeightDB ::
- MonadIO m => DB -> ReadOptions -> BlockHeight -> m [BlockHash]
-getBlocksAtHeightDB db opts h =
+ MonadIO m => BlockHeight -> ReadOptions -> DB -> m [BlockHash]
+getBlocksAtHeightDB h opts db =
retrieve db opts (HeightKey h) >>= \case
Nothing -> return []
Just ls -> return ls
-getBlockDB :: MonadIO m => DB -> ReadOptions -> BlockHash -> m (Maybe BlockData)
-getBlockDB db opts h = retrieve db opts (BlockKey h)
+getBlockDB :: MonadIO m => BlockHash -> ReadOptions -> DB -> m (Maybe BlockData)
+getBlockDB h opts db = retrieve db opts (BlockKey h)
getTxDataDB ::
- MonadIO m => DB -> ReadOptions -> TxHash -> m (Maybe TxData)
-getTxDataDB db opts th = retrieve db opts (TxKey th)
+ MonadIO m => TxHash -> ReadOptions -> DB -> m (Maybe TxData)
+getTxDataDB th opts db = retrieve db opts (TxKey th)
-getSpenderDB :: MonadIO m => DB -> ReadOptions -> OutPoint -> m (Maybe Spender)
-getSpenderDB db opts = retrieve db opts . SpenderKey
+getSpenderDB :: MonadIO m => OutPoint -> ReadOptions -> DB -> m (Maybe Spender)
+getSpenderDB op opts db = retrieve db opts $ SpenderKey op
-getSpendersDB :: MonadIO m => DB -> ReadOptions -> TxHash -> m (IntMap Spender)
-getSpendersDB db opts th =
+getSpendersDB :: MonadIO m => TxHash -> ReadOptions -> DB -> m (IntMap Spender)
+getSpendersDB th opts db =
I.fromList . map (uncurry f) <$>
liftIO (matchingAsList db opts (SpenderKeyS th))
where
f (SpenderKey op) s = (fromIntegral (outPointIndex op), s)
- f _ _ = undefined
+ f _ _ = undefined
-getBalanceDB :: MonadIO m => DB -> ReadOptions -> Address -> m (Maybe Balance)
-getBalanceDB db opts a = fmap f <$> retrieve db opts (BalKey a)
+getBalanceDB :: MonadIO m => Address -> ReadOptions -> DB -> m (Maybe Balance)
+getBalanceDB a opts db = fmap f <$> retrieve db opts (BalKey a)
where
f BalVal { balValAmount = v
, balValZero = z
@@ -81,43 +87,43 @@ getBalanceDB db opts a = fmap f <$> retrieve db opts (BalKey a)
getMempoolDB ::
(MonadIO m, MonadResource m)
- => DB
+ => Maybe PreciseUnixTime
-> ReadOptions
- -> Maybe PreciseUnixTime
+ -> DB
-> ConduitT () (PreciseUnixTime, TxHash) m ()
-getMempoolDB db opts mpu = x .| mapC (uncurry f)
+getMempoolDB mpu opts db = x .| mapC (uncurry f)
where
x =
case mpu of
Nothing -> matching db opts MemKeyS
Just pu -> matchingSkip db opts MemKeyS (MemKeyT pu)
f (MemKey u t) () = (u, t)
- f _ _ = undefined
+ f _ _ = undefined
getAddressTxsDB ::
(MonadIO m, MonadResource m)
- => DB
- -> ReadOptions
- -> Address
+ => Address
-> Maybe BlockRef
+ -> ReadOptions
+ -> DB
-> ConduitT () BlockTx m ()
-getAddressTxsDB db opts a mbr = x .| mapC (uncurry f)
+getAddressTxsDB a mbr opts db = x .| mapC (uncurry f)
where
x =
case mbr of
Nothing -> matching db opts (AddrTxKeyA a)
Just br -> matchingSkip db opts (AddrTxKeyA a) (AddrTxKeyB a br)
f AddrTxKey {addrTxKeyT = t} () = t
- f _ _ = undefined
+ f _ _ = undefined
getAddressUnspentsDB ::
(MonadIO m, MonadResource m)
- => DB
- -> ReadOptions
- -> Address
+ => Address
-> Maybe BlockRef
+ -> ReadOptions
+ -> DB
-> ConduitT () Unspent m ()
-getAddressUnspentsDB db opts a mbr = x .| mapC (uncurry f)
+getAddressUnspentsDB a mbr opts db = x .| mapC (uncurry f)
where
x =
case mbr of
@@ -134,8 +140,8 @@ getAddressUnspentsDB db opts a mbr = x .| mapC (uncurry f)
}
f _ _ = undefined
-getUnspentDB :: MonadIO m => DB -> ReadOptions -> OutPoint -> m (Maybe Unspent)
-getUnspentDB db opts op = fmap f <$> retrieve db opts (UnspentKey op)
+getUnspentDB :: MonadIO m => OutPoint -> ReadOptions -> DB -> m (Maybe Unspent)
+getUnspentDB op opts db = fmap f <$> retrieve db opts (UnspentKey op)
where
f u =
Unspent
@@ -145,25 +151,26 @@ getUnspentDB db opts op = fmap f <$> retrieve db opts (UnspentKey op)
, unspentScript = B.Short.toShort (unspentValScript u)
}
-instance MonadIO m => StoreRead (DB, ReadOptions) m where
- isInitialized (db, opts) = isInitializedDB db opts
- getBestBlock (db, opts) = getBestBlockDB db opts
- getBlocksAtHeight (db, opts) = getBlocksAtHeightDB db opts
- getBlock (db, opts) = getBlockDB db opts
- getTxData (db, opts) = getTxDataDB db opts
- getSpenders (db, opts) = getSpendersDB db opts
- getSpender (db, opts) = getSpenderDB db opts
-
-instance (MonadIO m, MonadResource m) => StoreStream (DB, ReadOptions) m where
- getMempool (db, opts) = getMempoolDB db opts
- getAddressTxs (db, opts) = getAddressTxsDB db opts
- getAddressUnspents (db, opts) = getAddressUnspentsDB db opts
-
-instance MonadIO m => BalanceRead (DB, ReadOptions) m where
- getBalance (db, opts) = getBalanceDB db opts
-
-instance MonadIO m => UnspentRead (DB, ReadOptions) m where
- getUnspent (db, opts) = getUnspentDB db opts
-
setInitDB :: MonadIO m => DB -> m ()
setInitDB db = insert db VersionKey dataVersion
+
+instance MonadIO m => StoreRead (ReaderT BlockDB m) where
+ isInitialized = R.ask >>= uncurry isInitializedDB
+ getBestBlock = R.ask >>= uncurry getBestBlockDB
+ getBlocksAtHeight h = R.ask >>= uncurry (getBlocksAtHeightDB h)
+ getBlock h = R.ask >>= uncurry (getBlockDB h)
+ getTxData t = R.ask >>= uncurry (getTxDataDB t)
+ getSpenders p = R.ask >>= uncurry (getSpendersDB p)
+ getSpender p = R.ask >>= uncurry (getSpenderDB p)
+
+instance (MonadIO m, MonadResource m) =>
+ StoreStream (ReaderT BlockDB m) where
+ getMempool p = lift R.ask >>= uncurry (getMempoolDB p)
+ getAddressTxs a b = R.ask >>= uncurry (getAddressTxsDB a b)
+ getAddressUnspents a b = R.ask >>= uncurry (getAddressUnspentsDB a b)
+
+instance (MonadIO m) => BalanceRead (ReaderT BlockDB m) where
+ getBalance a = R.ask >>= uncurry (getBalanceDB a)
+
+instance (MonadIO m) => UnspentRead (ReaderT BlockDB m) where
+ getUnspent p = R.ask >>= uncurry (getUnspentDB p)
diff --git a/src/Network/Haskoin/Store/Data/HashMap.hs b/src/Network/Haskoin/Store/Data/STM.hs
index d100999..e1aedc7 100644
--- a/src/Network/Haskoin/Store/Data/HashMap.hs
+++ b/src/Network/Haskoin/Store/Data/STM.hs
@@ -1,13 +1,12 @@
-{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
-{-# LANGUAGE MultiParamTypeClasses #-}
-{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}
{-# OPTIONS_GHC -Wno-orphans #-}
-module Network.Haskoin.Store.Data.HashMap where
+module Network.Haskoin.Store.Data.STM where
import Conduit
import Control.Monad
+import Control.Monad.Reader (ReaderT)
+import qualified Control.Monad.Reader as R
import qualified Data.ByteString.Short as B.Short
import Data.Function
import Data.HashMap.Strict (HashMap)
@@ -21,9 +20,21 @@ import Network.Haskoin.Store.Data
import Network.Haskoin.Store.Data.KeyValue
import UnliftIO
+type BlockSTM = ReaderT (TVar HashMapDB) STM
+type UnspentSTM = ReaderT (TVar UnspentMap) STM
+type BalanceSTM = ReaderT (TVar BalanceMap) STM
type UnspentMap = HashMap TxHash (IntMap Unspent)
type BalanceMap = (HashMap Address Balance, [Address])
+withBlockSTM :: TVar HashMapDB -> ReaderT (TVar HashMapDB) STM a -> STM a
+withBlockSTM = flip R.runReaderT
+
+withUnspentSTM :: TVar UnspentMap -> ReaderT (TVar UnspentMap) STM a -> STM a
+withUnspentSTM = flip R.runReaderT
+
+withBalanceSTM :: TVar BalanceMap -> ReaderT (TVar BalanceMap) STM a -> STM a
+withBalanceSTM = flip R.runReaderT
+
data HashMapDB = HashMapDB
{ hBest :: !(Maybe BlockHash)
, hBlock :: !(HashMap BlockHash BlockData)
@@ -61,25 +72,25 @@ getBestBlockH :: HashMapDB -> Maybe BlockHash
getBestBlockH = hBest
getBlocksAtHeightH ::
- HashMapDB -> BlockHeight -> [BlockHash]
-getBlocksAtHeightH db h = M.lookupDefault [] h (hHeight db)
+ BlockHeight -> HashMapDB -> [BlockHash]
+getBlocksAtHeightH h = M.lookupDefault [] h . hHeight
-getBlockH :: HashMapDB -> BlockHash -> Maybe BlockData
-getBlockH db h = M.lookup h (hBlock db)
+getBlockH :: BlockHash -> HashMapDB -> Maybe BlockData
+getBlockH h = M.lookup h . hBlock
-getTxDataH :: HashMapDB -> TxHash -> Maybe TxData
-getTxDataH db t = M.lookup t (hTx db)
+getTxDataH :: TxHash -> HashMapDB -> Maybe TxData
+getTxDataH t = M.lookup t . hTx
-getSpenderH :: HashMapDB -> OutPoint -> Maybe (Maybe Spender)
-getSpenderH db op = do
+getSpenderH :: OutPoint -> HashMapDB -> Maybe (Maybe Spender)
+getSpenderH op db = do
m <- M.lookup (outPointHash op) (hSpender db)
I.lookup (fromIntegral (outPointIndex op)) m
-getSpendersH :: HashMapDB -> TxHash -> IntMap (Maybe Spender)
-getSpendersH db t = M.lookupDefault I.empty t (hSpender db)
+getSpendersH :: TxHash -> HashMapDB -> IntMap (Maybe Spender)
+getSpendersH t = M.lookupDefault I.empty t . hSpender
-getBalanceH :: HashMapDB -> Address -> Maybe Balance
-getBalanceH db a = f <$> M.lookup a (hBalance db)
+getBalanceH :: Address -> HashMapDB -> Maybe Balance
+getBalanceH a = fmap f . M.lookup a . hBalance
where
f b =
Balance
@@ -93,10 +104,10 @@ getBalanceH db a = f <$> M.lookup a (hBalance db)
getMempoolH ::
Monad m
- => HashMapDB
- -> Maybe PreciseUnixTime
+ => Maybe PreciseUnixTime
+ -> HashMapDB
-> ConduitT () (PreciseUnixTime, TxHash) m ()
-getMempoolH db mpu =
+getMempoolH mpu db =
let f ts =
case mpu of
Nothing -> False
@@ -107,8 +118,8 @@ getMempoolH db mpu =
hMempool db
in yieldMany [(u, h) | (u, hs) <- ls, h <- hs]
-getAddressTxsH :: HashMapDB -> Address -> Maybe BlockRef -> [BlockTx]
-getAddressTxsH db a mbr =
+getAddressTxsH :: Address -> Maybe BlockRef -> HashMapDB -> [BlockTx]
+getAddressTxsH a mbr db =
dropWhile h .
sortBy (flip compare) . catMaybes . concatMap (uncurry f) . M.toList $
M.lookupDefault M.empty a (hAddrTx db)
@@ -125,8 +136,8 @@ getAddressTxsH db a mbr =
Just br -> b > br
getAddressUnspentsH ::
- HashMapDB -> Address -> Maybe BlockRef -> [Unspent]
-getAddressUnspentsH db a mbr =
+ Address -> Maybe BlockRef -> HashMapDB -> [Unspent]
+getAddressUnspentsH a mbr db =
dropWhile h .
sortBy (flip compare) . catMaybes . concatMap (uncurry f) . M.toList $
M.lookupDefault M.empty a (hAddrOut db)
@@ -253,8 +264,8 @@ deleteMempoolTxH h u db =
let s = M.singleton u (M.singleton h False)
in db {hMempool = M.unionWith M.union s (hMempool db)}
-getUnspentH :: HashMapDB -> OutPoint -> Maybe (Maybe Unspent)
-getUnspentH db op = do
+getUnspentH :: OutPoint -> HashMapDB -> Maybe (Maybe Unspent)
+getUnspentH op db = do
m <- M.lookup (outPointHash op) (hUnspent db)
I.lookup (fromIntegral (outPointIndex op)) m
@@ -282,150 +293,112 @@ delUnspentH op db =
(hUnspent db)
}
-instance Applicative m => StoreRead HashMapDB m where
- isInitialized = pure . isInitializedH
- getBestBlock = pure . getBestBlockH
- getBlocksAtHeight db = pure . getBlocksAtHeightH db
- getBlock db = pure . getBlockH db
- getTxData db = pure . getTxDataH db
- getSpenders db = pure . I.map fromJust . I.filter isJust . getSpendersH db
- getSpender db = pure . join . getSpenderH db
-
-instance Applicative m => BalanceRead HashMapDB m where
- getBalance db = pure . getBalanceH db
-
-instance Applicative m => UnspentRead HashMapDB m where
- getUnspent db = pure . join . getUnspentH db
-
-instance Monad m => StoreStream HashMapDB m where
- getMempool = getMempoolH
- getAddressUnspents db a = yieldMany . getAddressUnspentsH db a
- getAddressTxs db a = yieldMany . getAddressTxsH db a
-
-instance MonadIO m => StoreRead (TVar HashMapDB) m where
- isInitialized v = readTVarIO v >>= isInitialized
- getBestBlock v = readTVarIO v >>= getBestBlock
- getBlocksAtHeight v h = readTVarIO v >>= \db -> getBlocksAtHeight db h
- getBlock v b = readTVarIO v >>= \db -> getBlock db b
- getTxData v t = readTVarIO v >>= \db -> getTxData db t
- getSpender v t = readTVarIO v >>= \db -> getSpender db t
- getSpenders v t = readTVarIO v >>= \db -> getSpenders db t
-
-instance MonadIO m => BalanceRead (TVar HashMapDB) m where
- getBalance v a =
- readTVarIO v >>= \db -> getBalance db a
-
-instance MonadIO m => UnspentRead (TVar HashMapDB) m where
- getUnspent v op = readTVarIO v >>= \db -> getUnspent db op
-
-instance MonadIO m => BalanceWrite (TVar HashMapDB) m where
- setBalance v b = atomically $ modifyTVar v (setBalanceH b)
-
-instance MonadIO m => StoreStream (TVar HashMapDB) m where
- getMempool v m = readTVarIO v >>= \db -> getMempool db m
- getAddressTxs v a m = readTVarIO v >>= \db -> getAddressTxs db a m
- getAddressUnspents v a m = readTVarIO v >>= \db -> getAddressUnspents db a m
-
-instance StoreWrite ((HashMapDB -> HashMapDB) -> m ()) m where
- setInit f = f setInitH
- setBest f = f . setBestH
- insertBlock f = f . insertBlockH
- insertAtHeight f h = f . insertAtHeightH h
- insertTx f = f . insertTxH
- insertSpender f p = f . insertSpenderH p
- deleteSpender f = f . deleteSpenderH
- insertAddrTx f a = f . insertAddrTxH a
- removeAddrTx f a = f . removeAddrTxH a
- insertAddrUnspent f a = f . insertAddrUnspentH a
- removeAddrUnspent f a = f . removeAddrUnspentH a
- insertMempoolTx f h = f . insertMempoolTxH h
- deleteMempoolTx f h = f . deleteMempoolTxH h
-
-instance Applicative m => UnspentWrite ((HashMapDB -> HashMapDB) -> m ()) m where
- addUnspent f = f . addUnspentH
- delUnspent f = f . delUnspentH
-
-instance MonadIO m => StoreWrite (TVar HashMapDB) m where
- setInit v = atomically $ setInit (modifyTVar v)
- setBest v = atomically . setBest (modifyTVar v)
- insertBlock v = atomically . insertBlock (modifyTVar v)
- insertAtHeight v h = atomically . insertAtHeight (modifyTVar v) h
- insertTx v = atomically . insertTx (modifyTVar v)
- insertSpender v p = atomically . insertSpender (modifyTVar v) p
- deleteSpender v = atomically . deleteSpender (modifyTVar v)
- insertAddrTx v a = atomically . insertAddrTx (modifyTVar v) a
- removeAddrTx v a = atomically . removeAddrTx (modifyTVar v) a
- insertAddrUnspent v a = atomically . insertAddrUnspent (modifyTVar v) a
- removeAddrUnspent v a = atomically . removeAddrUnspent (modifyTVar v) a
- insertMempoolTx v h = atomically . insertMempoolTx (modifyTVar v) h
- deleteMempoolTx v h = atomically . deleteMempoolTx (modifyTVar v) h
-
-instance MonadIO m => UnspentWrite (TVar HashMapDB) m where
- addUnspent v = atomically . addUnspent (modifyTVar v)
- delUnspent v = atomically . delUnspent (modifyTVar v)
-
-instance Applicative m => UnspentRead UnspentMap m where
- getUnspent um op = pure $ do
- m <- M.lookup (outPointHash op) um
- I.lookup (fromIntegral (outPointIndex op)) m
-
-instance MonadIO m => UnspentRead (TVar UnspentMap) m where
- getUnspent v op = readTVarIO v >>= \um -> getUnspent um op
-
-instance Applicative m =>
- UnspentWrite ((UnspentMap -> UnspentMap) -> m ()) m where
- addUnspent f u =
- f $
- M.insertWith
- (<>)
- (outPointHash (unspentPoint u))
- (I.singleton (fromIntegral (outPointIndex (unspentPoint u))) u)
- delUnspent f op = f $ M.update g (outPointHash op)
+instance StoreRead BlockSTM where
+ isInitialized = fmap isInitializedH . lift . readTVar =<< R.ask
+ getBestBlock = fmap getBestBlockH . lift . readTVar =<< R.ask
+ getBlocksAtHeight h =
+ fmap (getBlocksAtHeightH h) . lift . readTVar =<< R.ask
+ getBlock b = fmap (getBlockH b) . lift . readTVar =<< R.ask
+ getTxData t = fmap (getTxDataH t) . lift . readTVar =<< R.ask
+ getSpender t = fmap (join . getSpenderH t) . lift . readTVar =<< R.ask
+ getSpenders t =
+ fmap (I.map fromJust . I.filter isJust . getSpendersH t) .
+ lift . readTVar =<<
+ R.ask
+
+instance BalanceRead BlockSTM where
+ getBalance a = fmap (getBalanceH a) . lift . readTVar =<< R.ask
+
+instance UnspentRead BlockSTM where
+ getUnspent op = fmap (join . getUnspentH op) . lift . readTVar =<< R.ask
+
+instance BalanceWrite BlockSTM where
+ setBalance b = lift . (`modifyTVar` setBalanceH b) =<< R.ask
+ pruneBalance = return ()
+
+instance StoreStream BlockSTM where
+ getMempool m = getMempoolH m =<< lift . lift . readTVar =<< lift R.ask
+ getAddressTxs a m =
+ yieldMany . getAddressTxsH a m =<< lift . lift . readTVar =<< lift R.ask
+ getAddressUnspents a m =
+ yieldMany . getAddressUnspentsH a m =<<
+ lift . lift . readTVar =<< lift R.ask
+
+instance StoreWrite BlockSTM where
+ setInit = lift . (`modifyTVar` setInitH) =<< R.ask
+ setBest h = lift . (`modifyTVar` setBestH h) =<< R.ask
+ insertBlock b = lift . (`modifyTVar` insertBlockH b) =<< R.ask
+ insertAtHeight h g = lift . (`modifyTVar` insertAtHeightH h g) =<< R.ask
+ insertTx t = lift . (`modifyTVar` insertTxH t) =<< R.ask
+ insertSpender p s = lift . (`modifyTVar` insertSpenderH p s) =<< R.ask
+ deleteSpender p = lift . (`modifyTVar` deleteSpenderH p) =<< R.ask
+ insertAddrTx a t = lift . (`modifyTVar` insertAddrTxH a t) =<< R.ask
+ removeAddrTx a t = lift . (`modifyTVar` removeAddrTxH a t) =<< R.ask
+ insertAddrUnspent a u =
+ lift . (`modifyTVar` insertAddrUnspentH a u) =<< R.ask
+ removeAddrUnspent a u =
+ lift . (`modifyTVar` removeAddrUnspentH a u) =<< R.ask
+ insertMempoolTx h t = lift . (`modifyTVar` insertMempoolTxH h t) =<< R.ask
+ deleteMempoolTx h t = lift . (`modifyTVar` deleteMempoolTxH h t) =<< R.ask
+
+instance UnspentWrite BlockSTM where
+ addUnspent h = lift . (`modifyTVar` addUnspentH h) =<< R.ask
+ delUnspent p = lift . (`modifyTVar` delUnspentH p) =<< R.ask
+ pruneUnspent = return ()
+
+instance UnspentRead UnspentSTM where
+ getUnspent op = do
+ um <- lift . readTVar =<< R.ask
+ return $ do
+ m <- M.lookup (outPointHash op) um
+ I.lookup (fromIntegral (outPointIndex op)) m
+
+instance UnspentWrite UnspentSTM where
+ addUnspent u = do
+ v <- R.ask
+ lift . modifyTVar v $
+ M.insertWith
+ (<>)
+ (outPointHash (unspentPoint u))
+ (I.singleton (fromIntegral (outPointIndex (unspentPoint u))) u)
+ delUnspent op = lift . (`modifyTVar` M.update g (outPointHash op)) =<< R.ask
where
g m =
let n = I.delete (fromIntegral (outPointIndex op)) m
in if I.null n
then Nothing
else Just n
- pruneUnspent f =
- f $ \um ->
- if M.size um > 2000 * 1000
+ pruneUnspent = do
+ v <- R.ask
+ lift . modifyTVar v $ \um ->
+ if M.size um > 2 ^ (21 :: Int)
then let g is = unspentBlock (head (I.elems is))
ls =
sortBy
(compare `on` (g . snd))
(filter (not . I.null . snd) (M.toList um))
- in M.fromList (drop (1000 * 1000) ls)
+ in M.fromList (drop (2 ^ (20 :: Int)) ls)
else um
-instance MonadIO m => UnspentWrite (TVar UnspentMap) m where
- addUnspent v = atomically . addUnspent (modifyTVar v)
- delUnspent v = atomically . delUnspent (modifyTVar v)
- pruneUnspent = atomically . pruneUnspent . modifyTVar
+instance BalanceRead BalanceSTM where
+ getBalance a = do
+ b <- fmap fst $ lift . readTVar =<< R.ask
+ return $ M.lookup a b
-instance Applicative m => BalanceRead BalanceMap m where
- getBalance m a = pure $ M.lookup a (fst m)
-
-instance Applicative m =>
- BalanceWrite ((BalanceMap -> BalanceMap) -> m ()) m where
- setBalance f b =
- f $ \(m, s) ->
+instance BalanceWrite BalanceSTM where
+ setBalance b = do
+ v <- R.ask
+ lift . modifyTVar v $ \(m, s) ->
let m' = M.insert (balanceAddress b) b m
s' = balanceAddress b : s
in (m', s')
- pruneBalance f =
- f $ \(m, s) ->
- if length s > 2000 * 1000
- then let s' = take (1000 * 1000) s
+ pruneBalance = do
+ v <- R.ask
+ lift . modifyTVar v $ \(m, s) ->
+ if length s > 2 ^ (21 :: Int)
+ then let s' = take (2 ^ (20 :: Int)) s
m' = M.fromList (mapMaybe (g m) s')
in (m', s')
else (m, s)
where
g m a = (a, ) <$> M.lookup a m
-
-instance MonadIO m => BalanceWrite (TVar BalanceMap) m where
- setBalance v = atomically . setBalance (modifyTVar v)
- pruneBalance = atomically . pruneBalance . modifyTVar
-
-instance MonadIO m => BalanceRead (TVar BalanceMap) m where
- getBalance v a = readTVarIO v >>= \m -> getBalance m a
diff --git a/src/Network/Haskoin/Store/Logic.hs b/src/Network/Haskoin/Store/Logic.hs
index 5102a7c..d9935e8 100644
--- a/src/Network/Haskoin/Store/Logic.hs
+++ b/src/Network/Haskoin/Store/Logic.hs
@@ -18,13 +18,14 @@ import Data.List
import Data.Maybe
import Data.Serialize
import Data.String
+import Data.Text (Text)
import Data.Word
import Database.RocksDB
import Haskoin
import Network.Haskoin.Block.Headers (computeSubsidy)
import Network.Haskoin.Store.Data
-import Network.Haskoin.Store.Data.HashMap
import Network.Haskoin.Store.Data.ImportDB
+import Network.Haskoin.Store.Data.STM
import UnliftIO
data ImportException
@@ -59,8 +60,8 @@ initDB ::
-> TVar BalanceMap
-> m ()
initDB net db um bm =
- runImportDB db um bm $ \i ->
- isInitialized i >>= \case
+ runImportDB db um bm $
+ isInitialized >>= \case
Left e -> do
$(logErrorS) "BlockLogic" $
"Initialization exception: " <> fromString (show e)
@@ -72,28 +73,27 @@ initDB net db um bm =
$(logDebugS)
"BlockLogic"
"Initializing database by importing genesis block"
- importBlock net i (genesisBlock net) (genesisNode net)
- setInit i
+ importBlock net (genesisBlock net) (genesisNode net)
+ setInit
newMempoolTx ::
( MonadError ImportException m
- , StoreRead i m
- , StoreWrite i m
- , UnspentRead i m
- , UnspentWrite i m
- , BalanceRead i m
- , BalanceWrite i m
+ , StoreRead m
+ , StoreWrite m
+ , UnspentRead m
+ , UnspentWrite m
+ , BalanceRead m
+ , BalanceWrite m
, MonadLogger m
)
=> Network
- -> i
-> Tx
-> PreciseUnixTime
-> m Bool
-newMempoolTx net i tx now@(PreciseUnixTime w) = do
+newMempoolTx net tx now@(PreciseUnixTime w) = do
$(logInfoS) "BlockLogic" $
"Adding transaction to mempool: " <> txHashToHex (txHash tx)
- getTxData i (txHash tx) >>= \case
+ getTxData (txHash tx) >>= \case
Just x
| not (txDataDeleted x) -> do
$(logWarnS) "BlockLogic" $
@@ -104,7 +104,7 @@ newMempoolTx net i tx now@(PreciseUnixTime w) = do
go = do
orp <-
any isNothing <$>
- mapM (getTxData i . outPointHash . prevOutput) (txIn tx)
+ mapM (getTxData . outPointHash . prevOutput) (txIn tx)
if orp
then do
$(logErrorS) "BlockLogic" $
@@ -114,12 +114,12 @@ newMempoolTx net i tx now@(PreciseUnixTime w) = do
f = do
us <-
forM (txIn tx) $ \TxIn {prevOutput = op} -> do
- t <- getImportTx i (outPointHash op)
+ t <- getImportTx (outPointHash op)
getTxOutput (outPointIndex op) t
let ds = map spenderHash (mapMaybe outputSpender us)
if null ds
then do
- importTx net i (MemRef now) (w `div` 1000) tx
+ importTx net (MemRef now) (w `div` 1000) tx
return True
else g ds
g ds = do
@@ -135,16 +135,16 @@ newMempoolTx net i tx now@(PreciseUnixTime w) = do
r ds = do
$(logWarnS) "BlockLogic" $
"Replacting RBF transaction with: " <> txHashToHex (txHash tx)
- forM_ ds (deleteTx net i True)
- importTx net i (MemRef now) (w `div` 1000) tx
+ forM_ ds (deleteTx net True)
+ importTx net (MemRef now) (w `div` 1000) tx
return True
n = do
$(logWarnS) "BlockLogic" $
"Inserting transaction with deleted flag: " <>
txHashToHex (txHash tx)
- insertDeletedMempoolTx i tx now
+ insertDeletedMempoolTx tx now
return False
- isrbf th = transactionRBF <$> getImportTx i th
+ isrbf th = transactionRBF <$> getImportTx th
newBlock ::
(MonadError ImportException m, MonadIO m, MonadLogger m)
@@ -155,30 +155,29 @@ newBlock ::
-> Block
-> BlockNode
-> m ()
-newBlock net db um bm b n = runImportDB db um bm $ \i -> importBlock net i b n
+newBlock net db um bm b n = runImportDB db um bm $ importBlock net b n
revertBlock ::
( MonadError ImportException m
- , StoreRead i m
- , StoreWrite i m
- , UnspentRead i m
- , UnspentWrite i m
- , BalanceRead i m
- , BalanceWrite i m
+ , StoreRead m
+ , StoreWrite m
+ , UnspentRead m
+ , UnspentWrite m
+ , BalanceRead m
+ , BalanceWrite m
, MonadLogger m
)
=> Network
- -> i
-> BlockHash
-> m ()
-revertBlock net i bh = do
+revertBlock net bh = do
bd <-
- getBestBlock i >>= \case
+ getBestBlock >>= \case
Nothing -> do
$(logErrorS) "BlockLogic" "Best block unknown"
throwError BestBlockUnknown
Just h ->
- getBlock i h >>= \case
+ getBlock h >>= \case
Nothing -> do
$(logErrorS) "BlockLogic" "Best block not found"
throwError (BestBlockNotFound h)
@@ -189,28 +188,27 @@ revertBlock net i bh = do
"Attempted to delete block that isn't best: " <>
blockHashToHex h
throwError (BlockNotBest bh)
- txs <- mapM (fmap transactionData . getImportTx i) (blockDataTxs bd)
- mapM_ (deleteTx net i False . txHash) (reverse (sortTxs txs))
- setBest i (prevBlock (blockDataHeader bd))
- insertBlock i bd {blockDataMainChain = False}
+ txs <- mapM (fmap transactionData . getImportTx) (blockDataTxs bd)
+ mapM_ (deleteTx net False . txHash) (reverse (sortTxs txs))
+ setBest (prevBlock (blockDataHeader bd))
+ insertBlock bd {blockDataMainChain = False}
importBlock ::
( MonadError ImportException m
- , StoreRead i m
- , StoreWrite i m
- , UnspentRead i m
- , UnspentWrite i m
- , BalanceRead i m
- , BalanceWrite i m
+ , StoreRead m
+ , StoreWrite m
+ , UnspentRead m
+ , UnspentWrite m
+ , BalanceRead m
+ , BalanceWrite m
, MonadLogger m
)
=> Network
- -> i
-> Block
-> BlockNode
-> m ()
-importBlock net i b n = do
- getBestBlock i >>= \case
+importBlock net b n = do
+ getBestBlock >>= \case
Nothing
| isGenesis n -> do
$(logInfoS) "BlockLogic" $
@@ -231,7 +229,6 @@ importBlock net i b n = do
blockHashToHex h
throwError (PrevBlockNotBest (prevBlock (nodeHeader n)))
insertBlock
- i
BlockData
{ blockDataHeight = nodeHeight n
, blockDataMainChain = True
@@ -244,13 +241,12 @@ importBlock net i b n = do
, blockDataFees = cb_out_val - subsidy (nodeHeight n)
, blockDataOutputs = ts_out_val
}
- insertAtHeight i (headerHash (nodeHeader n)) (nodeHeight n)
- setBest i (headerHash (nodeHeader n))
+ insertAtHeight (headerHash (nodeHeader n)) (nodeHeight n)
+ setBest (headerHash (nodeHeader n))
zipWithM_
(\x t ->
importTx
net
- i
(br x)
(fromIntegral (blockTimestamp (nodeHeader n)))
t)
@@ -259,7 +255,7 @@ importBlock net i b n = do
where
subsidy = computeSubsidy net
cb_out_val = sum (map outValue (txOut (head (blockTxns b))))
- ts_out_val = sum (map (\tx -> sum (map outValue (txOut tx))) (tail (blockTxns b)))
+ ts_out_val = sum (map (sum . map outValue . txOut) (tail (blockTxns b)))
br pos = BlockRef {blockRefHeight = nodeHeight n, blockRefPos = pos}
w = let s = B.length (encode b {blockTxns = map (\t -> t {txWitness = []}) (blockTxns b)})
x = B.length (encode b)
@@ -276,21 +272,20 @@ sortTxs txs = is <> sortTxs ds
importTx ::
( MonadError ImportException m
- , StoreRead i m
- , StoreWrite i m
- , UnspentRead i m
- , UnspentWrite i m
- , BalanceRead i m
- , BalanceWrite i m
+ , StoreRead m
+ , StoreWrite m
+ , UnspentRead m
+ , UnspentWrite m
+ , BalanceRead m
+ , BalanceWrite m
, MonadLogger m
)
=> Network
- -> i
-> BlockRef
-> Word64 -- ^ unix time
-> Tx
-> m ()
-importTx net i br tt tx = do
+importTx net br tt tx = do
when (length (nub (map prevOutput (txIn tx))) < length (txIn tx)) $ do
$(logErrorS) "BlockLogic" $
"Transaction spends same output twice: " <> txHashToHex (txHash tx)
@@ -300,7 +295,6 @@ importTx net i br tt tx = do
"Attempting to import coinbase to the mempool: " <>
txHashToHex (txHash tx)
throwError (UnconfirmedCoinbase (txHash tx))
- -- If unspent is nothing this transaction exists already
us <-
fromMaybe [] . sequence <$>
if iscb
@@ -312,10 +306,10 @@ importTx net i br tt tx = do
$(logErrorS) "BlockLogic" $
"Insufficient funds: " <> txHashToHex (txHash tx)
throwError (InsufficientFunds th)
- zipWithM_ (spendOutput net i br (txHash tx)) [0 ..] us
+ zipWithM_ (spendOutput net br (txHash tx)) [0 ..] us
if | iscb || not (null us) ->
do zipWithM_
- (newOutput i br . OutPoint (txHash tx))
+ (newOutput br . OutPoint (txHash tx))
[0 ..]
(txOut tx)
rbf <- getrbf
@@ -334,11 +328,11 @@ importTx net i br tt tx = do
, transactionTime = tt
}
let (d, _) = fromTransaction t
- insertTx i d
- updateAddressCounts i (txAddresses t) (+1)
+ insertTx d
+ updateAddressCounts (txAddresses t) (+1)
unless (confirmed br) $
- insertMempoolTx i (txHash tx) (memRefTime br)
- | null us && confirmed br -> confirmTx net i br tx
+ insertMempoolTx (txHash tx) (memRefTime br)
+ | null us && confirmed br -> confirmTx net br tx
| otherwise ->
do $(logErrorS) "BlockLogic" $
"Invalid operation required for transaction: " <>
@@ -346,7 +340,7 @@ importTx net i br tt tx = do
throwError (TxInvalidOp (txHash tx))
where
uns op =
- getUnspent i op >>= \case
+ getUnspent op >>= \case
Nothing
| confirmed br -> do
$(logWarnS) "BlockLogic" $
@@ -354,7 +348,7 @@ importTx net i br tt tx = do
txHashToHex (outPointHash op) <>
" " <>
fromString (show (outPointIndex op))
- getSpender i op >>= \case
+ getSpender op >>= \case
Nothing -> do
$(logErrorS) "BlockLogic" $
"Could not find output: " <>
@@ -368,8 +362,8 @@ importTx net i br tt tx = do
$(logWarnS) "BlockLogic" $
"Deleting conflicting transaction: " <>
txHashToHex (spenderHash s)
- deleteTx net i True (spenderHash s)
- getUnspent i op >>= \case
+ deleteTx net True (spenderHash s)
+ getUnspent op >>= \case
Nothing -> do
$(logErrorS) "BlockLogic" $
"Transaction double-spend detected: " <>
@@ -393,21 +387,21 @@ importTx net i br tt tx = do
| otherwise =
let hs = nub $ map (outPointHash . prevOutput) (txIn tx)
in fmap or . forM hs $ \h ->
- getTxData i h >>= \case
+ getTxData h >>= \case
Nothing -> throwError (TxNotFound h)
Just t
| confirmed (txDataBlock t) -> return False
| txDataRBF t -> return True
| otherwise -> return False
mkcb ip w =
- Coinbase
+ StoreCoinbase
{ inputPoint = prevOutput ip
, inputSequence = txInSequence ip
, inputSigScript = scriptInput ip
, inputWitness = w
}
mkin u ip w =
- Input
+ StoreInput
{ inputPoint = prevOutput ip
, inputSequence = txInSequence ip
, inputSigScript = scriptInput ip
@@ -416,7 +410,7 @@ importTx net i br tt tx = do
, inputWitness = w
}
mkout o =
- Output
+ StoreOutput
{ outputAmount = outValue o
, outputScript = scriptOutput o
, outputSpender = Nothing
@@ -424,21 +418,20 @@ importTx net i br tt tx = do
confirmTx ::
( MonadError ImportException m
- , StoreRead i m
- , StoreWrite i m
- , BalanceRead i m
- , BalanceWrite i m
- , UnspentRead i m
- , UnspentWrite i m
+ , StoreRead m
+ , StoreWrite m
+ , BalanceRead m
+ , BalanceWrite m
+ , UnspentRead m
+ , UnspentWrite m
, MonadLogger m
)
=> Network
- -> i
-> BlockRef
-> Tx
-> m ()
-confirmTx net i br tx =
- getTxData i (txHash tx) >>= \case
+confirmTx net br tx =
+ getTxData (txHash tx) >>= \case
Nothing -> do
$(logErrorS) "BlockLogic" $
"Transaction not found: " <> txHashToHex (txHash tx)
@@ -449,14 +442,12 @@ confirmTx net i br tx =
Left _ -> return ()
Right a -> do
removeAddrTx
- i
a
BlockTx
{ blockTxBlock = txDataBlock t
, blockTxHash = txHash tx
}
insertAddrTx
- i
a
BlockTx
{ blockTxBlock = br
@@ -464,11 +455,10 @@ confirmTx net i br tx =
}
forM_ (zip [0 ..] (txOut tx)) $ \(n, o) -> do
let op = OutPoint (txHash tx) n
- s <- getSpender i (OutPoint (txHash tx) n)
+ s <- getSpender (OutPoint (txHash tx) n)
when (isNothing s) $ do
- delUnspent i op
+ delUnspent op
addUnspent
- i
Unspent
{ unspentBlock = br
, unspentPoint = op
@@ -479,14 +469,12 @@ confirmTx net i br tx =
Left _ -> return ()
Right a -> do
removeAddrTx
- i
a
BlockTx
{ blockTxBlock = txDataBlock t
, blockTxHash = txHash tx
}
insertAddrTx
- i
a
BlockTx
{ blockTxBlock = br
@@ -494,7 +482,6 @@ confirmTx net i br tx =
}
when (isNothing s) $ do
removeAddrUnspent
- i
a
Unspent
{ unspentBlock = txDataBlock t
@@ -504,7 +491,6 @@ confirmTx net i br tx =
B.Short.toShort (scriptOutput o)
}
insertAddrUnspent
- i
a
Unspent
{ unspentBlock = br
@@ -513,41 +499,40 @@ confirmTx net i br tx =
, unspentScript =
B.Short.toShort (scriptOutput o)
}
- reduceBalance net i False False a (outValue o)
- increaseBalance i True False a (outValue o)
- insertTx i t {txDataBlock = br}
- deleteMempoolTx i (txHash tx) (memRefTime (txDataBlock t))
+ reduceBalance net False False a (outValue o)
+ increaseBalance True False a (outValue o)
+ insertTx t {txDataBlock = br}
+ deleteMempoolTx (txHash tx) (memRefTime (txDataBlock t))
getRecursiveTx ::
- (Monad m, StoreRead i m, MonadLogger m) => i -> TxHash -> m [Transaction]
-getRecursiveTx i th =
- getTxData i th >>= \case
+ (Monad m, StoreRead m, MonadLogger m) => TxHash -> m [Transaction]
+getRecursiveTx th =
+ getTxData th >>= \case
Nothing -> return []
Just d -> do
- sm <- getSpenders i th
+ sm <- getSpenders th
let t = toTransaction d sm
fmap (t :) $ do
let ss = nub . map spenderHash $ I.elems sm
- concat <$> mapM (getRecursiveTx i) ss
+ concat <$> mapM getRecursiveTx ss
deleteTx ::
( MonadError ImportException m
- , StoreRead i m
- , StoreWrite i m
- , UnspentRead i m
- , UnspentWrite i m
- , BalanceRead i m
- , BalanceWrite i m
+ , StoreRead m
+ , StoreWrite m
+ , UnspentRead m
+ , UnspentWrite m
+ , BalanceRead m
+ , BalanceWrite m
, MonadLogger m
)
=> Network
- -> i
-> Bool -- ^ only delete transaction if unconfirmed
-> TxHash
-> m ()
-deleteTx net i mo h = do
+deleteTx net mo h = do
$(logDebugS) "BlockLogic" $ "Deleting transaction: " <> txHashToHex h
- getTxData i h >>= \case
+ getTxData h >>= \case
Nothing -> do
$(logErrorS) "BlockLogic" $
"Transaciton not found: " <> txHashToHex h
@@ -564,31 +549,30 @@ deleteTx net i mo h = do
| otherwise -> go t
where
go t = do
- ss <- nub . map spenderHash . I.elems <$> getSpenders i h
- mapM_ (deleteTx net i True) ss
+ ss <- nub . map spenderHash . I.elems <$> getSpenders h
+ mapM_ (deleteTx net True) ss
forM_ (take (length (txOut (txData t))) [0 ..]) $ \n ->
- delOutput net i (OutPoint h n)
+ delOutput net (OutPoint h n)
let ps = filter (/= nullOutPoint) (map prevOutput (txIn (txData t)))
- mapM_ (unspendOutput i) ps
+ mapM_ unspendOutput ps
unless (confirmed (txDataBlock t)) $
- deleteMempoolTx i h (memRefTime (txDataBlock t))
- insertTx i t {txDataDeleted = True}
- updateAddressCounts i (txDataAddresses t) (subtract 1)
+ deleteMempoolTx h (memRefTime (txDataBlock t))
+ insertTx t {txDataDeleted = True}
+ updateAddressCounts (txDataAddresses t) (subtract 1)
insertDeletedMempoolTx ::
( MonadError ImportException m
- , StoreRead i m
- , StoreWrite i m
+ , StoreRead m
+ , StoreWrite m
, MonadLogger m
)
- => i
- -> Tx
+ => Tx
-> PreciseUnixTime
-> m ()
-insertDeletedMempoolTx i tx now@(PreciseUnixTime w) = do
+insertDeletedMempoolTx tx now@(PreciseUnixTime w) = do
us <-
forM (txIn tx) $ \TxIn {prevOutput = op} ->
- getImportTx i (outPointHash op) >>= getTxOutput (outPointIndex op)
+ getImportTx (outPointHash op) >>= getTxOutput (outPointIndex op)
rbf <- getrbf
let (d, _) =
fromTransaction
@@ -604,7 +588,7 @@ insertDeletedMempoolTx i tx now@(PreciseUnixTime w) = do
}
$(logWarnS) "BlockLogic" $
"Inserting deleted mempool transaction: " <> txHashToHex (txHash tx)
- insertTx i d
+ insertTx d
where
ws = map Just (txWitness tx) <> repeat Nothing
getrbf
@@ -612,7 +596,7 @@ insertDeletedMempoolTx i tx now@(PreciseUnixTime w) = do
| otherwise =
let hs = nub $ map (outPointHash . prevOutput) (txIn tx)
in fmap or . forM hs $ \h ->
- getTxData i h >>= \case
+ getTxData h >>= \case
Nothing -> do
$(logErrorS) "BlockLogic" $
"Transaction not found: " <> txHashToHex h
@@ -622,7 +606,7 @@ insertDeletedMempoolTx i tx now@(PreciseUnixTime w) = do
| txDataRBF t -> return True
| otherwise -> return False
mkin u ip wit =
- Input
+ StoreInput
{ inputPoint = prevOutput ip
, inputSequence = txInSequence ip
, inputSigScript = scriptInput ip
@@ -631,7 +615,7 @@ insertDeletedMempoolTx i tx now@(PreciseUnixTime w) = do
, inputWitness = wit
}
mkout o =
- Output
+ StoreOutput
{ outputAmount = outValue o
, outputScript = scriptOutput o
, outputSpender = Nothing
@@ -639,33 +623,31 @@ insertDeletedMempoolTx i tx now@(PreciseUnixTime w) = do
newOutput ::
( MonadError ImportException m
- , StoreRead i m
- , StoreWrite i m
- , UnspentRead i m
- , UnspentWrite i m
- , BalanceRead i m
- , BalanceWrite i m
+ , StoreRead m
+ , StoreWrite m
+ , UnspentRead m
+ , UnspentWrite m
+ , BalanceRead m
+ , BalanceWrite m
, MonadLogger m
)
- => i
- -> BlockRef
+ => BlockRef
-> OutPoint
-> TxOut
-> m ()
-newOutput i br op to = do
- addUnspent i u
+newOutput br op to = do
+ addUnspent u
case scriptToAddressBS (scriptOutput to) of
Left _ -> return ()
Right a -> do
- insertAddrUnspent i a u
+ insertAddrUnspent a u
insertAddrTx
- i
a
BlockTx
{ blockTxHash = outPointHash op
, blockTxBlock = br
}
- increaseBalance i (confirmed br) True a (outValue to)
+ increaseBalance (confirmed br) True a (outValue to)
where
u =
Unspent
@@ -677,27 +659,25 @@ newOutput i br op to = do
delOutput ::
( MonadError ImportException m
- , StoreRead i m
- , StoreWrite i m
- , UnspentRead i m
- , UnspentWrite i m
- , BalanceRead i m
- , BalanceWrite i m
+ , StoreRead m
+ , StoreWrite m
+ , UnspentRead m
+ , UnspentWrite m
+ , BalanceRead m
+ , BalanceWrite m
, MonadLogger m
)
=> Network
- -> i
-> OutPoint
-> m ()
-delOutput net i op = do
- t <- getImportTx i (outPointHash op)
+delOutput net op = do
+ t <- getImportTx (outPointHash op)
u <- getTxOutput (outPointIndex op) t
- delUnspent i op
+ delUnspent op
case scriptToAddressBS (outputScript u) of
Left _ -> return ()
Right a -> do
removeAddrUnspent
- i
a
Unspent
{ unspentScript = B.Short.toShort (outputScript u)
@@ -706,7 +686,6 @@ delOutput net i op = do
, unspentAmount = outputAmount u
}
removeAddrTx
- i
a
BlockTx
{ blockTxHash = outPointHash op
@@ -714,19 +693,17 @@ delOutput net i op = do
}
reduceBalance
net
- i
(confirmed (transactionBlock t))
True
a
(outputAmount u)
getImportTx ::
- (MonadError ImportException m, StoreRead i m, MonadLogger m)
- => i
- -> TxHash
+ (MonadError ImportException m, StoreRead m, MonadLogger m)
+ => TxHash
-> m Transaction
-getImportTx i th =
- getTxData i th >>= \case
+getImportTx th =
+ getTxData th >>= \case
Nothing -> do
$(logErrorS) "BlockLogic" $
"Tranasction not found: " <> txHashToHex th
@@ -737,14 +714,14 @@ getImportTx i th =
"Transaction deleted: " <> txHashToHex th
throwError $ TxDeleted th
| otherwise -> do
- sm <- getSpenders i th
+ sm <- getSpenders th
return $ toTransaction d sm
getTxOutput ::
(MonadError ImportException m, MonadLogger m)
=> Word32
-> Transaction
- -> m Output
+ -> m StoreOutput
getTxOutput i tx = do
unless (fromIntegral i < length (transactionOutputs tx)) $ do
$(logErrorS) "BlockLogic" $
@@ -761,24 +738,22 @@ getTxOutput i tx = do
spendOutput ::
( MonadError ImportException m
- , StoreRead i m
- , StoreWrite i m
- , UnspentRead i m
- , UnspentWrite i m
- , BalanceRead i m
- , BalanceWrite i m
+ , StoreRead m
+ , StoreWrite m
+ , UnspentRead m
+ , UnspentWrite m
+ , BalanceRead m
+ , BalanceWrite m
, MonadLogger m
)
=> Network
- -> i
-> BlockRef
-> TxHash
-> Word32
-> Unspent
-> m ()
-spendOutput net i br th ix u = do
+spendOutput net br th ix u = do
insertSpender
- i
(unspentPoint u)
Spender {spenderHash = th, spenderIndex = ix}
case scriptToAddressBS (B.Short.fromShort (unspentScript u)) of
@@ -786,36 +761,33 @@ spendOutput net i br th ix u = do
Right a -> do
reduceBalance
net
- i
(confirmed (unspentBlock u))
False
a
(unspentAmount u)
- removeAddrUnspent i a u
+ removeAddrUnspent a u
insertAddrTx
- i
a
BlockTx
{ blockTxHash = th
, blockTxBlock = br
}
- delUnspent i (unspentPoint u)
+ delUnspent (unspentPoint u)
unspendOutput ::
( MonadError ImportException m
- , StoreRead i m
- , StoreWrite i m
- , UnspentRead i m
- , UnspentWrite i m
- , BalanceRead i m
- , BalanceWrite i m
+ , StoreRead m
+ , StoreWrite m
+ , UnspentRead m
+ , UnspentWrite m
+ , BalanceRead m
+ , BalanceWrite m
, MonadLogger m
)
- => i
- -> OutPoint
+ => OutPoint
-> m ()
-unspendOutput i op = do
- t <- getImportTx i (outPointHash op)
+unspendOutput op = do
+ t <- getImportTx (outPointHash op)
o <- getTxOutput (outPointIndex op) t
s <-
case outputSpender o of
@@ -826,8 +798,8 @@ unspendOutput i op = do
fromString (show (outPointIndex op))
throwError (AlreadyUnspent op)
Just s -> return s
- x <- getImportTx i (spenderHash s)
- deleteSpender i op
+ x <- getImportTx (spenderHash s)
+ deleteSpender op
let u =
Unspent
{ unspentAmount = outputAmount o
@@ -835,20 +807,18 @@ unspendOutput i op = do
, unspentScript = B.Short.toShort (outputScript o)
, unspentPoint = op
}
- addUnspent i u
+ addUnspent u
case scriptToAddressBS (outputScript o) of
Left _ -> return ()
Right a -> do
- insertAddrUnspent i a u
+ insertAddrUnspent a u
removeAddrTx
- i
a
BlockTx
{ blockTxHash = spenderHash s
, blockTxBlock = transactionBlock x
}
increaseBalance
- i
(confirmed (unspentBlock u))
False
a
@@ -856,24 +826,22 @@ unspendOutput i op = do
reduceBalance ::
( MonadError ImportException m
- , StoreRead i m
- , StoreWrite i m
- , BalanceRead i m
- , BalanceWrite i m
+ , StoreRead m
+ , StoreWrite m
+ , BalanceRead m
+ , BalanceWrite m
, MonadLogger m
)
=> Network
- -> i
-> Bool -- ^ spend or delete confirmed output
-> Bool -- ^ reduce total received
-> Address
-> Word64
-> m ()
-reduceBalance net i c t a v =
- getBalance i a >>= \case
+reduceBalance net c t a v =
+ getBalance a >>= \case
Nothing -> do
- $(logErrorS) "BlockLogic" $
- "Balance not found: " <> addrToString net a
+ $(logErrorS) "BlockLogic" $ "Balance not found: " <> addrText net a
throwError (BalanceNotFound a)
Just b -> do
when
@@ -887,12 +855,12 @@ reduceBalance net i c t a v =
then "confirmed "
else "unconfirmed ") <>
"balance: " <>
- addrToString net a
+ addrText net a
throwError $
if c
then InsufficientBalance a
else InsufficientZeroBalance a
- setBalance i $
+ setBalance
b
{ balanceAmount =
balanceAmount b -
@@ -914,21 +882,20 @@ reduceBalance net i c t a v =
increaseBalance ::
( MonadError ImportException m
- , StoreRead i m
- , StoreWrite i m
- , BalanceRead i m
- , BalanceWrite i m
+ , StoreRead m
+ , StoreWrite m
+ , BalanceRead m
+ , BalanceWrite m
, MonadLogger m
)
- => i
- -> Bool -- ^ add confirmed output
+ => Bool -- ^ add confirmed output
-> Bool -- ^ increase total received
-> Address
-> Word64
-> m ()
-increaseBalance i c t a v = do
+increaseBalance c t a v = do
b <-
- getBalance i a >>= \case
+ getBalance a >>= \case
Nothing ->
return
Balance
@@ -940,7 +907,7 @@ increaseBalance i c t a v = do
, balanceTotalReceived = 0
}
Just b -> return b
- setBalance i $
+ setBalance
b
{ balanceAmount =
balanceAmount b +
@@ -961,18 +928,17 @@ increaseBalance i c t a v = do
}
updateAddressCounts ::
- (MonadError ImportException m, BalanceWrite i m, BalanceRead i m)
- => i
- -> [Address]
+ (MonadError ImportException m, BalanceWrite m, BalanceRead m)
+ => [Address]
-> (Word64 -> Word64)
-> m ()
-updateAddressCounts i as f =
+updateAddressCounts as f =
forM_ as $ \a -> do
b <-
- getBalance i a >>= \case
+ getBalance a >>= \case
Nothing -> throwError (BalanceNotFound a)
Just b -> return b
- setBalance i b {balanceTxCount = f (balanceTxCount b)}
+ setBalance b {balanceTxCount = f (balanceTxCount b)}
txAddresses :: Transaction -> [Address]
txAddresses t =
@@ -986,3 +952,6 @@ txDataAddresses t =
nub . rights $
map (scriptToAddressBS . prevScript) (I.elems (txDataPrevs t)) <>
map (scriptToAddressBS . scriptOutput) (txOut (txData t))
+
+addrText :: Network -> Address -> Text
+addrText net a = fromMaybe "[unreprestable]" $ addrToString net a
diff --git a/src/Network/Haskoin/Store/Proto.hs b/src/Network/Haskoin/Store/Proto.hs
deleted file mode 100644
index c5003bc..0000000
--- a/src/Network/Haskoin/Store/Proto.hs
+++ /dev/null
@@ -1,437 +0,0 @@
-{-# LANGUAGE FlexibleInstances #-}
-{-# LANGUAGE MultiParamTypeClasses #-}
-module Network.Haskoin.Store.Proto where
-
-import Data.ByteString (ByteString)
-import qualified Data.ByteString as B
-import qualified Data.ByteString.Lazy as L
-import qualified Data.ByteString.Lazy.Char8 as L8
-import qualified Data.ByteString.Short as S
-import qualified Data.Sequence as Seq
-import Data.Serialize
-import qualified Data.Text as T
-import qualified Data.Text.Encoding as E
-import Data.Version
-import Haskoin
-import Network.Haskoin.Store.Data
-import qualified Network.Haskoin.Store.ProtocolBuffers.Balance as P.Balance
-import qualified Network.Haskoin.Store.ProtocolBuffers.BalanceList as P.BalanceList
-import qualified Network.Haskoin.Store.ProtocolBuffers.BlockData as P.BlockData
-import qualified Network.Haskoin.Store.ProtocolBuffers.BlockDataList as P.BlockDataList
-import qualified Network.Haskoin.Store.ProtocolBuffers.BlockRef as P.BlockRef
-import qualified Network.Haskoin.Store.ProtocolBuffers.BlockRef.Block as P.BlockRef.Block
-import qualified Network.Haskoin.Store.ProtocolBuffers.BlockRef.Block_ref as P.BlockRef.Block_ref
-import qualified Network.Haskoin.Store.ProtocolBuffers.BlockRef.Mempool as P.BlockRef.Mempool
-import qualified Network.Haskoin.Store.ProtocolBuffers.BlockTx as P.BlockTx
-import qualified Network.Haskoin.Store.ProtocolBuffers.BlockTxList as P.BlockTxList
-import qualified Network.Haskoin.Store.ProtocolBuffers.Error as P.Error
-import qualified Network.Haskoin.Store.ProtocolBuffers.Event as P.Event
-import qualified Network.Haskoin.Store.ProtocolBuffers.Event.Type as P.Event.Type
-import qualified Network.Haskoin.Store.ProtocolBuffers.EventList as P.EventList
-import qualified Network.Haskoin.Store.ProtocolBuffers.HealthCheck as P.HealthCheck
-import qualified Network.Haskoin.Store.ProtocolBuffers.Input as P.Input
-import qualified Network.Haskoin.Store.ProtocolBuffers.Output as P.Output
-import qualified Network.Haskoin.Store.ProtocolBuffers.Peer as P.Peer
-import qualified Network.Haskoin.Store.ProtocolBuffers.PeerList as P.PeerList
-import qualified Network.Haskoin.Store.ProtocolBuffers.Spender as P.Spender
-import qualified Network.Haskoin.Store.ProtocolBuffers.Transaction as P.Transaction
-import qualified Network.Haskoin.Store.ProtocolBuffers.TransactionList as P.TransactionList
-import qualified Network.Haskoin.Store.ProtocolBuffers.TxAfterHeight as P.TxAfterHeight
-import qualified Network.Haskoin.Store.ProtocolBuffers.TxId as P.TxId
-import qualified Network.Haskoin.Store.ProtocolBuffers.TxIdList as P.TxIdList
-import qualified Network.Haskoin.Store.ProtocolBuffers.Unspent as P.Unspent
-import qualified Network.Haskoin.Store.ProtocolBuffers.UnspentList as P.UnspentList
-import qualified Network.Haskoin.Store.ProtocolBuffers.XPubBalance as P.XPubBalance
-import qualified Network.Haskoin.Store.ProtocolBuffers.XPubBalanceList as P.XPubBalanceList
-import qualified Network.Haskoin.Store.ProtocolBuffers.XPubUnspent as P.XPubUnspent
-import qualified Network.Haskoin.Store.ProtocolBuffers.XPubUnspentList as P.XPubUnspentList
-import Paths_haskoin_store as Paths
-import Text.ProtocolBuffers
-
-class ProtoSerial a where
- protoSerial :: Network -> a -> L.ByteString
-
-protoAddress :: Network -> Address -> Utf8
-protoAddress net = Utf8 . L.fromStrict . E.encodeUtf8 . addrToString net
-
-protoPkScriptAddr :: Network -> ByteString -> Maybe Utf8
-protoPkScriptAddr net pks =
- Utf8 . L.fromStrict . E.encodeUtf8 . addrToString net <$>
- eitherToMaybe (scriptToAddressBS pks)
-
-protoBalance :: Network -> Balance -> P.Balance.Balance
-protoBalance net Balance { balanceAddress = a
- , balanceAmount = v
- , balanceZero = z
- , balanceUnspentCount = u
- , balanceTxCount = c
- , balanceTotalReceived = t
- } =
- P.Balance.Balance
- { P.Balance.address = protoAddress net a
- , P.Balance.confirmed = v
- , P.Balance.unconfirmed = z
- , P.Balance.utxo = u
- , P.Balance.received = t
- , P.Balance.txs = c
- }
-
-instance ProtoSerial Balance where
- protoSerial net = messagePut . protoBalance net
-
-protoBalanceList :: Network -> [Balance] -> P.BalanceList.BalanceList
-protoBalanceList net bs =
- P.BalanceList.BalanceList
- {P.BalanceList.balance = Seq.fromList (map (protoBalance net) bs)}
-
-instance ProtoSerial [Balance] where
- protoSerial net = messagePut . protoBalanceList net
-
-protoBlockRef :: BlockRef -> P.BlockRef.BlockRef
-protoBlockRef BlockRef {blockRefHeight = h, blockRefPos = p} =
- P.BlockRef.BlockRef
- { P.BlockRef.block_ref =
- Just
- (P.BlockRef.Block_ref.Block
- { P.BlockRef.Block_ref.block =
- P.BlockRef.Block.Block
- { P.BlockRef.Block.height = h
- , P.BlockRef.Block.position = p
- }
- })
- }
-protoBlockRef MemRef {memRefTime = PreciseUnixTime t} =
- P.BlockRef.BlockRef
- { P.BlockRef.block_ref =
- Just
- (P.BlockRef.Block_ref.Mempool
- { P.BlockRef.Block_ref.mempool =
- P.BlockRef.Mempool.Mempool
- {P.BlockRef.Mempool.mempool = t}
- })
- }
-
-instance ProtoSerial BlockRef where
- protoSerial _ = messagePut . protoBlockRef
-
-protoBlockTx :: BlockTx -> P.BlockTx.BlockTx
-protoBlockTx BlockTx {blockTxBlock = b, blockTxHash = t} =
- P.BlockTx.BlockTx
- { P.BlockTx.block = protoBlockRef b
- , P.BlockTx.txid = protoTxId t
- }
-
-instance ProtoSerial BlockTx where
- protoSerial _ = messagePut . protoBlockTx
-
-protoBlockTxList :: [BlockTx] -> P.BlockTxList.BlockTxList
-protoBlockTxList bs =
- P.BlockTxList.BlockTxList
- {P.BlockTxList.blocktx = Seq.fromList (map protoBlockTx bs)}
-
-instance ProtoSerial [BlockTx] where
- protoSerial _ = messagePut . protoBlockTxList
-
-protoUnspent :: Network -> Unspent -> P.Unspent.Unspent
-protoUnspent net Unspent { unspentBlock = b
- , unspentPoint = OutPoint { outPointHash = t
- , outPointIndex = i
- }
- , unspentAmount = v
- , unspentScript = s
- } =
- P.Unspent.Unspent
- { P.Unspent.txid = protoTxId t
- , P.Unspent.index = i
- , P.Unspent.pkscript = L.fromStrict (S.fromShort s)
- , P.Unspent.value = v
- , P.Unspent.block = protoBlockRef b
- , P.Unspent.address = protoPkScriptAddr net (S.fromShort s)
- }
-
-instance ProtoSerial Unspent where
- protoSerial net = messagePut . protoUnspent net
-
-protoUnspentList :: Network -> [Unspent] -> P.UnspentList.UnspentList
-protoUnspentList net us =
- P.UnspentList.UnspentList
- {P.UnspentList.unspent = Seq.fromList (map (protoUnspent net) us)}
-
-instance ProtoSerial [Unspent] where
- protoSerial net = messagePut . protoUnspentList net
-
-protoBlockData :: BlockData -> P.BlockData.BlockData
-protoBlockData BlockData { blockDataHeight = g
- , blockDataMainChain = m
- , blockDataHeader = h
- , blockDataSize = s
- , blockDataWeight = e
- , blockDataTxs = t
- , blockDataOutputs = o
- , blockDataFees = f
- , blockDataSubsidy = y
- } =
- P.BlockData.BlockData
- { P.BlockData.hash = encodeLazy (headerHash h)
- , P.BlockData.size = s
- , P.BlockData.height = g
- , P.BlockData.mainchain = m
- , P.BlockData.previous = encodeLazy (prevBlock h)
- , P.BlockData.time = blockTimestamp h
- , P.BlockData.version = blockVersion h
- , P.BlockData.bits = blockBits h
- , P.BlockData.nonce = bhNonce h
- , P.BlockData.tx = encodeLazy <$> Seq.fromList t
- , P.BlockData.merkle = encodeLazy (merkleRoot h)
- , P.BlockData.fees = f
- , P.BlockData.outputs = o
- , P.BlockData.subsidy = y
- , P.BlockData.weight = e
- }
-
-instance ProtoSerial BlockData where
- protoSerial _ = messagePut . protoBlockData
-
-protoBlockDataList :: [BlockData] -> P.BlockDataList.BlockDataList
-protoBlockDataList bs =
- P.BlockDataList.BlockDataList
- {P.BlockDataList.blockdata = Seq.fromList (map protoBlockData bs)}
-
-instance ProtoSerial [BlockData] where
- protoSerial _ = messagePut . protoBlockDataList
-
-protoInput :: Network -> Input -> P.Input.Input
-protoInput _ Coinbase { inputPoint = OutPoint { outPointHash = h
- , outPointIndex = i
- }
- , inputSequence = q
- , inputSigScript = s
- , inputWitness = w
- } =
- P.Input.Input
- { P.Input.coinbase = True
- , P.Input.txid = protoTxId h
- , P.Input.output = i
- , P.Input.sigscript = L.fromStrict s
- , P.Input.sequence = q
- , P.Input.witness = Seq.fromList (maybe [] (map L.fromStrict) w)
- , P.Input.value = Nothing
- , P.Input.pkscript = Nothing
- , P.Input.address = Nothing
- }
-protoInput net Input { inputPoint = OutPoint { outPointHash = h
- , outPointIndex = i
- }
- , inputSequence = q
- , inputSigScript = s
- , inputPkScript = k
- , inputAmount = v
- , inputWitness = w
- } =
- P.Input.Input
- { P.Input.coinbase = False
- , P.Input.txid = protoTxId h
- , P.Input.output = i
- , P.Input.sigscript = L.fromStrict s
- , P.Input.sequence = q
- , P.Input.witness = Seq.fromList (maybe [] (map L.fromStrict) w)
- , P.Input.value = Just v
- , P.Input.pkscript = Just (L.fromStrict k)
- , P.Input.address = protoPkScriptAddr net k
- }
-
-protoSpender :: Spender -> P.Spender.Spender
-protoSpender Spender {spenderHash = h, spenderIndex = i} =
- P.Spender.Spender {P.Spender.txid = protoTxId h, P.Spender.input = i}
-
-protoOutput :: Network -> Output -> P.Output.Output
-protoOutput net Output {outputAmount = v, outputScript = k, outputSpender = s} =
- P.Output.Output
- { P.Output.pkscript = L.fromStrict k
- , P.Output.value = v
- , P.Output.address = protoPkScriptAddr net k
- , P.Output.spender = protoSpender <$> s
- }
-
-protoTransaction :: Network -> Transaction -> P.Transaction.Transaction
-protoTransaction net tx@Transaction { transactionBlock = b
- , transactionVersion = v
- , transactionLockTime = l
- , transactionInputs = i
- , transactionOutputs = o
- , transactionDeleted = d
- , transactionRBF = r
- , transactionTime = t
- } =
- P.Transaction.Transaction
- { P.Transaction.txid = protoTxId (txHash (transactionData tx))
- , P.Transaction.size =
- fromIntegral (B.length (encode (transactionData tx)))
- , P.Transaction.version = v
- , P.Transaction.locktime = l
- , P.Transaction.block = protoBlockRef b
- , P.Transaction.deleted = d
- , P.Transaction.fee =
- if all isCoinbase i
- then 0
- else sum (map inputAmount i) - sum (map outputAmount o)
- , P.Transaction.rbf = r
- , P.Transaction.time = t
- , P.Transaction.inputs = Seq.fromList (map (protoInput net) i)
- , P.Transaction.outputs = Seq.fromList (map (protoOutput net) o)
- , P.Transaction.weight =
- if getSegWit net
- then Just w
- else Nothing
- }
- where
- w =
- let base = B.length $ encode (transactionData tx) {txWitness = []}
- wit = B.length $ encode (transactionData tx)
- in fromIntegral $ base * 3 + wit
-
-instance ProtoSerial Transaction where
- protoSerial net = messagePut . protoTransaction net
-
-protoTransactionList :: Network -> [Transaction] -> P.TransactionList.TransactionList
-protoTransactionList net ts =
- P.TransactionList.TransactionList
- { P.TransactionList.transaction =
- Seq.fromList (map (protoTransaction net) ts)
- }
-
-instance ProtoSerial [Transaction] where
- protoSerial net = messagePut . protoTransactionList net
-
-protoTxId :: TxHash -> P.TxId.TxId
-protoTxId t = P.TxId.TxId {P.TxId.txid = encodeLazy t}
-
-protoTxIdList :: [TxHash] -> P.TxIdList.TxIdList
-protoTxIdList ts =
- P.TxIdList.TxIdList {P.TxIdList.txid = Seq.fromList (map protoTxId ts)}
-
-instance ProtoSerial [TxHash] where
- protoSerial _ = messagePut . protoTxIdList
-
-protoPeer :: PeerInformation -> P.Peer.Peer
-protoPeer PeerInformation { peerUserAgent = u
- , peerAddress = a
- , peerVersion = v
- , peerServices = s
- , peerRelay = r
- } =
- P.Peer.Peer
- { P.Peer.useragent =
- either (const (Utf8 L.empty)) id (toUtf8 (L.fromStrict u))
- , P.Peer.address = Utf8 (L8.pack (show a))
- , P.Peer.version = v
- , P.Peer.services = s
- , P.Peer.relay = r
- }
-
-instance ProtoSerial PeerInformation where
- protoSerial _ = messagePut . protoPeer
-
-protoPeerList :: [PeerInformation] -> P.PeerList.PeerList
-protoPeerList ps =
- P.PeerList.PeerList {P.PeerList.peer = Seq.fromList (map protoPeer ps)}
-
-instance ProtoSerial [PeerInformation] where
- protoSerial _ = messagePut . protoPeerList
-
-protoXPubBalance :: Network -> XPubBal -> P.XPubBalance.XPubBalance
-protoXPubBalance net XPubBal {xPubBalPath = p, xPubBal = b} =
- P.XPubBalance.XPubBalance
- { P.XPubBalance.path = Seq.fromList p
- , P.XPubBalance.balance = protoBalance net b
- }
-
-instance ProtoSerial XPubBal where
- protoSerial net = messagePut . protoXPubBalance net
-
-protoXPubBalanceList :: Network -> [XPubBal] -> P.XPubBalanceList.XPubBalanceList
-protoXPubBalanceList net bs =
- P.XPubBalanceList.XPubBalanceList
- { P.XPubBalanceList.xpubbalance =
- Seq.fromList (map (protoXPubBalance net) bs)
- }
-
-instance ProtoSerial [XPubBal] where
- protoSerial net = messagePut . protoXPubBalanceList net
-
-protoXPubUnspent :: Network -> XPubUnspent -> P.XPubUnspent.XPubUnspent
-protoXPubUnspent net XPubUnspent {xPubUnspentPath = p, xPubUnspent = u} =
- P.XPubUnspent.XPubUnspent
- { P.XPubUnspent.path = Seq.fromList p
- , P.XPubUnspent.unspent = protoUnspent net u
- }
-
-instance ProtoSerial XPubUnspent where
- protoSerial net = messagePut . protoXPubUnspent net
-
-protoXPubUnspentList :: Network -> [XPubUnspent] -> P.XPubUnspentList.XPubUnspentList
-protoXPubUnspentList net us =
- P.XPubUnspentList.XPubUnspentList
- { P.XPubUnspentList.xpubunspent =
- Seq.fromList (map (protoXPubUnspent net) us)
- }
-
-instance ProtoSerial [XPubUnspent] where
- protoSerial net = messagePut . protoXPubUnspentList net
-
-protoEvent :: Event -> P.Event.Event
-protoEvent (EventTx h) =
- P.Event.Event {P.Event.type' = P.Event.Type.TX, P.Event.id = encodeLazy h}
-protoEvent (EventBlock h) =
- P.Event.Event
- {P.Event.type' = P.Event.Type.BLOCK, P.Event.id = encodeLazy h}
-
-instance ProtoSerial Event where
- protoSerial _ = messagePut . protoEvent
-
-protoEventList :: [Event] -> P.EventList.EventList
-protoEventList es =
- P.EventList.EventList {P.EventList.event = Seq.fromList (map protoEvent es)}
-
-instance ProtoSerial [Event] where
- protoSerial _ = messagePut . protoEventList
-
-protoHealthCheck :: HealthCheck -> P.HealthCheck.HealthCheck
-protoHealthCheck HealthCheck { healthHeaderBest = maybe_header_hash
- , healthHeaderHeight = maybe_header_height
- , healthBlockBest = maybe_block_hash
- , healthBlockHeight = maybe_block_height
- , healthPeers = maybe_peer_count
- , healthNetwork = network_name
- , healthOK = ok
- , healthSynced = synced
- } =
- P.HealthCheck.HealthCheck
- { P.HealthCheck.ok = ok
- , P.HealthCheck.synced = synced
- , P.HealthCheck.version = Utf8 (L8.pack (showVersion Paths.version))
- , P.HealthCheck.net = Utf8 (L8.pack network_name)
- , P.HealthCheck.peers = fromIntegral <$> maybe_peer_count
- , P.HealthCheck.headers_hash = encodeLazy <$> maybe_header_hash
- , P.HealthCheck.headers_height = maybe_header_height
- , P.HealthCheck.blocks_hash = encodeLazy <$> maybe_block_hash
- , P.HealthCheck.blocks_height = maybe_block_height
- }
-
-instance ProtoSerial HealthCheck where
- protoSerial _ = messagePut . protoHealthCheck
-
-protoTxAfterHeight :: TxAfterHeight -> P.TxAfterHeight.TxAfterHeight
-protoTxAfterHeight (TxAfterHeight b) = P.TxAfterHeight.TxAfterHeight b
-
-instance ProtoSerial TxAfterHeight where
- protoSerial _ = messagePut . protoTxAfterHeight
-
-protoExcept :: Except -> P.Error.Error
-protoExcept = P.Error.Error . Utf8 . L.fromStrict . E.encodeUtf8 . T.pack . show
-
-instance ProtoSerial Except where
- protoSerial _ = messagePut . protoExcept
-
-instance ProtoSerial TxId where
- protoSerial _ (TxId h) = messagePut (protoTxId h)
diff --git a/src/Network/Haskoin/Store/ProtocolBuffers.hs b/src/Network/Haskoin/Store/ProtocolBuffers.hs
deleted file mode 100644
index fad9285..0000000
--- a/src/Network/Haskoin/Store/ProtocolBuffers.hs
+++ /dev/null
@@ -1,23 +0,0 @@
-{-# LANGUAGE BangPatterns, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings #-}
-{-# OPTIONS_GHC -w #-}
-module Network.Haskoin.Store.ProtocolBuffers (protoInfo, fileDescriptorProto) where
-import Prelude ((+), (/), (++), (.))
-import qualified Prelude as Prelude'
-import qualified Data.Typeable as Prelude'
-import qualified GHC.Generics as Prelude'
-import qualified Data.Data as Prelude'
-import qualified Text.ProtocolBuffers.Header as P'
-import Text.DescriptorProtos.FileDescriptorProto (FileDescriptorProto)
-import Text.ProtocolBuffers.Reflections (ProtoInfo)
-import qualified Text.ProtocolBuffers.WireMessage as P' (wireGet,getFromBS)
-
-protoInfo :: ProtoInfo
-protoInfo
- = Prelude'.read
- "ProtoInfo {protoMod = ProtoName {protobufName = FIName \".ProtocolBuffers\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [], baseName = MName \"ProtocolBuffers\"}, protoFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers.hs\"], protoSource = \"protocol-buffers.proto\", extensionKeys = fromList [], messages = [DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.BlockRef\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"BlockRef\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"BlockRef.hs\"], isGroup = False, fields = fromList [], descOneofs = fromList [OneofInfo {oneofName = ProtoName {protobufName = FIName \".ProtocolBuffers.BlockRef.block_ref\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\",MName \"BlockRef\"], baseName = MName \"Block_ref\"}, oneofFName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockRef.block_ref\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockRef\"], baseName' = FName \"block_ref\", baseNamePrefix' = \"\"}, oneofFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"BlockRef\",\"Block_ref.hs\"], oneofFields = fromList [(ProtoName {protobufName = FIName \".ProtocolBuffers.BlockRef.block_ref.block\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\",MName \"BlockRef\",MName \"Block_ref\"], baseName = MName \"Block\"},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockRef.block_ref.block\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockRef\",MName \"Block_ref\"], baseName' = FName \"block\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 2}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.BlockRef.Block\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\",MName \"BlockRef\"], baseName = MName \"Block\"}), hsRawDefault = Nothing, hsDefault = Nothing}),(ProtoName {protobufName = FIName \".ProtocolBuffers.BlockRef.block_ref.mempool\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\",MName \"BlockRef\",MName \"Block_ref\"], baseName = MName \"Mempool\"},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockRef.block_ref.mempool\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockRef\",MName \"Block_ref\"], baseName' = FName \"mempool\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 10}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.BlockRef.Mempool\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\",MName \"BlockRef\"], baseName = MName \"Mempool\"}), hsRawDefault = Nothing, hsDefault = Nothing})], oneofMakeLenses = False}], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.BlockRef.Mempool\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\",MName \"BlockRef\"], baseName = MName \"Mempool\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"BlockRef\",\"Mempool.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockRef.Mempool.mempool\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockRef\",MName \"Mempool\"], baseName' = FName \"mempool\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 0}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 4}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.BlockRef.Block\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\",MName \"BlockRef\"], baseName = MName \"Block\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"BlockRef\",\"Block.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockRef.Block.height\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockRef\",MName \"Block\"], baseName' = FName \"height\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 0}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockRef.Block.position\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockRef\",MName \"Block\"], baseName' = FName \"position\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 8}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.Balance\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"Balance\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"Balance.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Balance.address\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Balance\"], baseName' = FName \"address\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 2}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Balance.confirmed\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Balance\"], baseName' = FName \"confirmed\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 8}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 4}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Balance.unconfirmed\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Balance\"], baseName' = FName \"unconfirmed\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 16}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 4}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Balance.utxo\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Balance\"], baseName' = FName \"utxo\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 24}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 4}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Balance.received\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Balance\"], baseName' = FName \"received\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 32}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 4}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Balance.txs\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Balance\"], baseName' = FName \"txs\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 5}, wireTag = WireTag {getWireTag = 40}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 4}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.BalanceList\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"BalanceList\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"BalanceList.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BalanceList.balance\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BalanceList\"], baseName' = FName \"balance\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 2}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.Balance\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"Balance\"}), hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.Unspent\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"Unspent\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"Unspent.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Unspent.txid\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Unspent\"], baseName' = FName \"txid\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 2}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.TxId\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"TxId\"}), hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Unspent.index\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Unspent\"], baseName' = FName \"index\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 8}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Unspent.pkscript\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Unspent\"], baseName' = FName \"pkscript\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 18}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 12}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Unspent.value\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Unspent\"], baseName' = FName \"value\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 24}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 4}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Unspent.block\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Unspent\"], baseName' = FName \"block\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 34}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.BlockRef\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"BlockRef\"}), hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Unspent.address\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Unspent\"], baseName' = FName \"address\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 5}, wireTag = WireTag {getWireTag = 42}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.UnspentList\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"UnspentList\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"UnspentList.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.UnspentList.unspent\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"UnspentList\"], baseName' = FName \"unspent\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 2}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.Unspent\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"Unspent\"}), hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.XPubBalance\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"XPubBalance\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"XPubBalance.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.XPubBalance.path\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"XPubBalance\"], baseName' = FName \"path\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 2}, packedTag = Just (WireTag {getWireTag = 0},WireTag {getWireTag = 2}), wireTagLength = 1, isPacked = True, isRequired = False, canRepeat = True, mightPack = True, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.XPubBalance.balance\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"XPubBalance\"], baseName' = FName \"balance\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 10}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.Balance\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"Balance\"}), hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.XPubBalanceList\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"XPubBalanceList\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"XPubBalanceList.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.XPubBalanceList.xpubbalance\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"XPubBalanceList\"], baseName' = FName \"xpubbalance\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 2}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.XPubBalance\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"XPubBalance\"}), hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.XPubUnspent\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"XPubUnspent\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"XPubUnspent.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.XPubUnspent.path\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"XPubUnspent\"], baseName' = FName \"path\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 2}, packedTag = Just (WireTag {getWireTag = 0},WireTag {getWireTag = 2}), wireTagLength = 1, isPacked = True, isRequired = False, canRepeat = True, mightPack = True, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.XPubUnspent.unspent\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"XPubUnspent\"], baseName' = FName \"unspent\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 10}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.Unspent\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"Unspent\"}), hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.XPubUnspentList\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"XPubUnspentList\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"XPubUnspentList.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.XPubUnspentList.xpubunspent\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"XPubUnspentList\"], baseName' = FName \"xpubunspent\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 2}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.XPubUnspent\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"XPubUnspent\"}), hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.BlockTx\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"BlockTx\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"BlockTx.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockTx.block\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockTx\"], baseName' = FName \"block\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 2}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.BlockRef\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"BlockRef\"}), hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockTx.txid\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockTx\"], baseName' = FName \"txid\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 10}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.TxId\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"TxId\"}), hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.BlockTxList\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"BlockTxList\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"BlockTxList.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockTxList.blocktx\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockTxList\"], baseName' = FName \"blocktx\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 2}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.BlockTx\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"BlockTx\"}), hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.BlockData\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"BlockData\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"BlockData.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockData.hash\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockData\"], baseName' = FName \"hash\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 2}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 12}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockData.size\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockData\"], baseName' = FName \"size\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 8}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockData.height\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockData\"], baseName' = FName \"height\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 16}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockData.mainchain\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockData\"], baseName' = FName \"mainchain\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 24}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 8}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockData.previous\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockData\"], baseName' = FName \"previous\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 34}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 12}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockData.time\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockData\"], baseName' = FName \"time\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 5}, wireTag = WireTag {getWireTag = 40}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockData.version\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockData\"], baseName' = FName \"version\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 6}, wireTag = WireTag {getWireTag = 48}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockData.bits\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockData\"], baseName' = FName \"bits\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 7}, wireTag = WireTag {getWireTag = 56}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockData.nonce\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockData\"], baseName' = FName \"nonce\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 8}, wireTag = WireTag {getWireTag = 64}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockData.tx\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockData\"], baseName' = FName \"tx\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 9}, wireTag = WireTag {getWireTag = 74}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 12}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockData.merkle\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockData\"], baseName' = FName \"merkle\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 10}, wireTag = WireTag {getWireTag = 82}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 12}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockData.fees\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockData\"], baseName' = FName \"fees\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 11}, wireTag = WireTag {getWireTag = 88}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 4}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockData.outputs\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockData\"], baseName' = FName \"outputs\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 12}, wireTag = WireTag {getWireTag = 96}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 4}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockData.subsidy\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockData\"], baseName' = FName \"subsidy\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 13}, wireTag = WireTag {getWireTag = 104}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 4}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockData.weight\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockData\"], baseName' = FName \"weight\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 14}, wireTag = WireTag {getWireTag = 112}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.BlockDataList\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"BlockDataList\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"BlockDataList.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockDataList.blockdata\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockDataList\"], baseName' = FName \"blockdata\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 2}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.BlockData\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"BlockData\"}), hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.Input\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"Input\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"Input.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Input.coinbase\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Input\"], baseName' = FName \"coinbase\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 0}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 8}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Input.txid\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Input\"], baseName' = FName \"txid\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 10}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.TxId\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"TxId\"}), hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Input.output\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Input\"], baseName' = FName \"output\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 16}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Input.sigscript\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Input\"], baseName' = FName \"sigscript\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 26}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 12}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Input.sequence\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Input\"], baseName' = FName \"sequence\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 32}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Input.witness\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Input\"], baseName' = FName \"witness\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 5}, wireTag = WireTag {getWireTag = 42}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 12}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Input.value\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Input\"], baseName' = FName \"value\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 6}, wireTag = WireTag {getWireTag = 48}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 4}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Input.pkscript\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Input\"], baseName' = FName \"pkscript\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 7}, wireTag = WireTag {getWireTag = 58}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 12}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Input.address\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Input\"], baseName' = FName \"address\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 8}, wireTag = WireTag {getWireTag = 66}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.Spender\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"Spender\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"Spender.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Spender.txid\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Spender\"], baseName' = FName \"txid\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 2}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.TxId\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"TxId\"}), hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Spender.input\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Spender\"], baseName' = FName \"input\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 8}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.Output\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"Output\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"Output.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Output.pkscript\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Output\"], baseName' = FName \"pkscript\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 2}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 12}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Output.value\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Output\"], baseName' = FName \"value\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 8}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 4}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Output.address\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Output\"], baseName' = FName \"address\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 18}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Output.spender\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Output\"], baseName' = FName \"spender\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 26}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.Spender\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"Spender\"}), hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.Transaction\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"Transaction\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"Transaction.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Transaction.txid\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Transaction\"], baseName' = FName \"txid\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 2}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.TxId\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"TxId\"}), hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Transaction.size\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Transaction\"], baseName' = FName \"size\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 8}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Transaction.version\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Transaction\"], baseName' = FName \"version\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 16}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Transaction.locktime\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Transaction\"], baseName' = FName \"locktime\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 24}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Transaction.block\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Transaction\"], baseName' = FName \"block\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 34}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.BlockRef\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"BlockRef\"}), hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Transaction.deleted\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Transaction\"], baseName' = FName \"deleted\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 5}, wireTag = WireTag {getWireTag = 40}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 8}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Transaction.fee\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Transaction\"], baseName' = FName \"fee\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 6}, wireTag = WireTag {getWireTag = 48}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 4}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Transaction.time\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Transaction\"], baseName' = FName \"time\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 7}, wireTag = WireTag {getWireTag = 56}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 4}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Transaction.rbf\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Transaction\"], baseName' = FName \"rbf\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 8}, wireTag = WireTag {getWireTag = 64}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 8}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Transaction.inputs\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Transaction\"], baseName' = FName \"inputs\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 9}, wireTag = WireTag {getWireTag = 74}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.Input\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"Input\"}), hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Transaction.outputs\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Transaction\"], baseName' = FName \"outputs\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 10}, wireTag = WireTag {getWireTag = 82}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.Output\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"Output\"}), hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Transaction.weight\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Transaction\"], baseName' = FName \"weight\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 11}, wireTag = WireTag {getWireTag = 88}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.TransactionList\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"TransactionList\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"TransactionList.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.TransactionList.transaction\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"TransactionList\"], baseName' = FName \"transaction\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 2}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.Transaction\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"Transaction\"}), hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.TxId\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"TxId\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"TxId.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.TxId.txid\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"TxId\"], baseName' = FName \"txid\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 2}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 12}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.TxIdList\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"TxIdList\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"TxIdList.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.TxIdList.txid\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"TxIdList\"], baseName' = FName \"txid\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 2}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.TxId\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"TxId\"}), hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.Event\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"Event\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"Event.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Event.type\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Event\"], baseName' = FName \"type'\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 0}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 14}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.Event.Type\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\",MName \"Event\"], baseName = MName \"Type\"}), hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Event.id\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Event\"], baseName' = FName \"id\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 10}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 12}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.EventList\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"EventList\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"EventList.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.EventList.event\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"EventList\"], baseName' = FName \"event\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 2}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.Event\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"Event\"}), hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.Peer\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"Peer\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"Peer.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Peer.useragent\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Peer\"], baseName' = FName \"useragent\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 2}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Peer.address\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Peer\"], baseName' = FName \"address\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 10}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Peer.version\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Peer\"], baseName' = FName \"version\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 16}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Peer.services\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Peer\"], baseName' = FName \"services\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 24}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 4}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Peer.relay\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Peer\"], baseName' = FName \"relay\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 32}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 8}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.PeerList\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"PeerList\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"PeerList.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.PeerList.peer\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"PeerList\"], baseName' = FName \"peer\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 2}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.Peer\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"Peer\"}), hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.HealthCheck\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"HealthCheck\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"HealthCheck.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.HealthCheck.ok\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"HealthCheck\"], baseName' = FName \"ok\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 0}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 8}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.HealthCheck.synced\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"HealthCheck\"], baseName' = FName \"synced\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 8}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 8}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.HealthCheck.version\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"HealthCheck\"], baseName' = FName \"version\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 18}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.HealthCheck.net\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"HealthCheck\"], baseName' = FName \"net\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 26}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.HealthCheck.peers\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"HealthCheck\"], baseName' = FName \"peers\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 32}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.HealthCheck.headers_hash\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"HealthCheck\"], baseName' = FName \"headers_hash\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 5}, wireTag = WireTag {getWireTag = 42}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 12}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.HealthCheck.headers_height\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"HealthCheck\"], baseName' = FName \"headers_height\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 6}, wireTag = WireTag {getWireTag = 48}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.HealthCheck.blocks_hash\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"HealthCheck\"], baseName' = FName \"blocks_hash\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 7}, wireTag = WireTag {getWireTag = 58}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 12}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.HealthCheck.blocks_height\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"HealthCheck\"], baseName' = FName \"blocks_height\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 8}, wireTag = WireTag {getWireTag = 64}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.TxAfterHeight\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"TxAfterHeight\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"TxAfterHeight.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.TxAfterHeight.result\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"TxAfterHeight\"], baseName' = FName \"result\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 0}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 8}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.Error\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"Error\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"Error.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Error.error\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Error\"], baseName' = FName \"error\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 2}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False}], enums = [EnumInfo {enumName = ProtoName {protobufName = FIName \".ProtocolBuffers.Event.Type\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\",MName \"Event\"], baseName = MName \"Type\"}, enumFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"Event\",\"Type.hs\"], enumValues = [(EnumCode {getEnumCode = 0},\"TX\"),(EnumCode {getEnumCode = 1},\"BLOCK\")], enumJsonInstances = False}], oneofs = [OneofInfo {oneofName = ProtoName {protobufName = FIName \".ProtocolBuffers.BlockRef.block_ref\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\",MName \"BlockRef\"], baseName = MName \"Block_ref\"}, oneofFName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockRef.block_ref\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockRef\"], baseName' = FName \"block_ref\", baseNamePrefix' = \"\"}, oneofFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"BlockRef\",\"Block_ref.hs\"], oneofFields = fromList [(ProtoName {protobufName = FIName \".ProtocolBuffers.BlockRef.block_ref.block\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\",MName \"BlockRef\",MName \"Block_ref\"], baseName = MName \"Block\"},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockRef.block_ref.block\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockRef\",MName \"Block_ref\"], baseName' = FName \"block\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 2}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.BlockRef.Block\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\",MName \"BlockRef\"], baseName = MName \"Block\"}), hsRawDefault = Nothing, hsDefault = Nothing}),(ProtoName {protobufName = FIName \".ProtocolBuffers.BlockRef.block_ref.mempool\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\",MName \"BlockRef\",MName \"Block_ref\"], baseName = MName \"Mempool\"},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockRef.block_ref.mempool\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockRef\",MName \"Block_ref\"], baseName' = FName \"mempool\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 10}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.BlockRef.Mempool\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\",MName \"BlockRef\"], baseName = MName \"Mempool\"}), hsRawDefault = Nothing, hsDefault = Nothing})], oneofMakeLenses = False}], knownKeyMap = fromList []}"
-
-fileDescriptorProto :: FileDescriptorProto
-fileDescriptorProto
- = P'.getFromBS (P'.wireGet 11)
- (P'.pack
- "\134\NAK\n\SYNprotocol-buffers.proto\"\198\SOH\n\bBlockRef\DC20\n\ENQblock\CAN\NUL \SOH(\v2\US.ProtocolBuffers.BlockRef.BlockH\NUL\DC24\n\amempool\CAN\SOH \SOH(\v2!.ProtocolBuffers.BlockRef.MempoolH\NUL\SUB\SUB\n\aMempool\DC2\SI\n\amempool\CAN\NUL \STX(\EOT\SUB)\n\ENQBlock\DC2\SO\n\ACKheight\CAN\NUL \STX(\r\DC2\DLE\n\bposition\CAN\SOH \STX(\rB\v\n\tblock_ref\"o\n\aBalance\DC2\SI\n\aaddress\CAN\NUL \STX(\t\DC2\DC1\n\tconfirmed\CAN\SOH \STX(\EOT\DC2\DC3\n\vunconfirmed\CAN\STX \STX(\EOT\DC2\f\n\EOTutxo\CAN\ETX \STX(\EOT\DC2\DLE\n\breceived\CAN\EOT \STX(\EOT\DC2\v\n\ETXtxs\CAN\ENQ \STX(\EOT\"8\n\vBalanceList\DC2)\n\abalance\CAN\NUL \ETX(\v2\CAN.ProtocolBuffers.Balance\"\153\SOH\n\aUnspent\DC2#\n\EOTtxid\CAN\NUL \STX(\v2\NAK.ProtocolBuffers.TxId\DC2\r\n\ENQindex\CAN\SOH \STX(\r\DC2\DLE\n\bpkscript\CAN\STX \STX(\f\DC2\r\n\ENQvalue\CAN\ETX \STX(\EOT\DC2(\n\ENQblock\CAN\EOT \STX(\v2\EM.ProtocolBuffers.BlockRef\DC2\SI\n\aaddress\CAN\ENQ \SOH(\t\"8\n\vUnspentList\DC2)\n\aunspent\CAN\NUL \ETX(\v2\CAN.ProtocolBuffers.Unspent\"T\n\vXPubBalance\DC2\SUB\n\EOTpath\CAN\NUL \ETX(\rB\f\b\NUL\DLE\SOH\CAN\NUL(\NUL0\NULP\NUL\DC2)\n\abalance\CAN\SOH \STX(\v2\CAN.ProtocolBuffers.Balance\"D\n\SIXPubBalanceList\DC21\n\vxpubbalance\CAN\NUL \ETX(\v2\FS.ProtocolBuffers.XPubBalance\"T\n\vXPubUnspent\DC2\SUB\n\EOTpath\CAN\NUL \ETX(\rB\f\b\NUL\DLE\SOH\CAN\NUL(\NUL0\NULP\NUL\DC2)\n\aunspent\CAN\SOH \STX(\v2\CAN.ProtocolBuffers.Unspent\"D\n\SIXPubUnspentList\DC21\n\vxpubunspent\CAN\NUL \ETX(\v2\FS.ProtocolBuffers.XPubUnspent\"X\n\aBlockTx\DC2(\n\ENQblock\CAN\NUL \STX(\v2\EM.ProtocolBuffers.BlockRef\DC2#\n\EOTtxid\CAN\SOH \STX(\v2\NAK.ProtocolBuffers.TxId\"8\n\vBlockTxList\DC2)\n\ablocktx\CAN\NUL \ETX(\v2\CAN.ProtocolBuffers.BlockTx\"\244\SOH\n\tBlockData\DC2\f\n\EOThash\CAN\NUL \STX(\f\DC2\f\n\EOTsize\CAN\SOH \STX(\r\DC2\SO\n\ACKheight\CAN\STX \STX(\r\DC2\DC1\n\tmainchain\CAN\ETX \STX(\b\DC2\DLE\n\bprevious\CAN\EOT \STX(\f\DC2\f\n\EOTtime\CAN\ENQ \STX(\r\DC2\SI\n\aversion\CAN\ACK \STX(\r\DC2\f\n\EOTbits\CAN\a \STX(\r\DC2\r\n\ENQnonce\CAN\b \STX(\r\DC2\n\n\STXtx\CAN\t \ETX(\f\DC2\SO\n\ACKmerkle\CAN\n \STX(\f\DC2\f\n\EOTfees\CAN\v \STX(\EOT\DC2\SI\n\aoutputs\CAN\f \STX(\EOT\DC2\SI\n\asubsidy\CAN\r \STX(\EOT\DC2\SO\n\ACKweight\CAN\SO \STX(\r\">\n\rBlockDataList\DC2-\n\tblockdata\CAN\NUL \ETX(\v2\SUB.ProtocolBuffers.BlockData\"\182\SOH\n\ENQInput\DC2\DLE\n\bcoinbase\CAN\NUL \STX(\b\DC2#\n\EOTtxid\CAN\SOH \STX(\v2\NAK.ProtocolBuffers.TxId\DC2\SO\n\ACKoutput\CAN\STX \STX(\r\DC2\DC1\n\tsigscript\CAN\ETX \STX(\f\DC2\DLE\n\bsequence\CAN\EOT \STX(\r\DC2\SI\n\awitness\CAN\ENQ \ETX(\f\DC2\r\n\ENQvalue\CAN\ACK \SOH(\EOT\DC2\DLE\n\bpkscript\CAN\a \SOH(\f\DC2\SI\n\aaddress\CAN\b \SOH(\t\"=\n\aSpender\DC2#\n\EOTtxid\CAN\NUL \STX(\v2\NAK.ProtocolBuffers.TxId\DC2\r\n\ENQinput\CAN\SOH \STX(\r\"e\n\ACKOutput\DC2\DLE\n\bpkscript\CAN\NUL \STX(\f\DC2\r\n\ENQvalue\CAN\SOH \STX(\EOT\DC2\SI\n\aaddress\CAN\STX \SOH(\t\DC2)\n\aspender\CAN\ETX \SOH(\v2\CAN.ProtocolBuffers.Spender\"\168\STX\n\vTransaction\DC2#\n\EOTtxid\CAN\NUL \STX(\v2\NAK.ProtocolBuffers.TxId\DC2\f\n\EOTsize\CAN\SOH \STX(\r\DC2\SI\n\aversion\CAN\STX \STX(\r\DC2\DLE\n\blocktime\CAN\ETX \STX(\r\DC2(\n\ENQblock\CAN\EOT \STX(\v2\EM.ProtocolBuffers.BlockRef\DC2\SI\n\adeleted\CAN\ENQ \STX(\b\DC2\v\n\ETXfee\CAN\ACK \STX(\EOT\DC2\f\n\EOTtime\CAN\a \STX(\EOT\DC2\v\n\ETXrbf\CAN\b \STX(\b\DC2&\n\ACKinputs\CAN\t \ETX(\v2\SYN.ProtocolBuffers.Input\DC2(\n\aoutputs\CAN\n \ETX(\v2\ETB.ProtocolBuffers.Output\DC2\SO\n\ACKweight\CAN\v \SOH(\r\"D\n\SITransactionList\DC21\n\vtransaction\CAN\NUL \ETX(\v2\FS.ProtocolBuffers.Transaction\"\DC4\n\EOTTxId\DC2\f\n\EOTtxid\CAN\NUL \STX(\f\"/\n\bTxIdList\DC2#\n\EOTtxid\CAN\NUL \ETX(\v2\NAK.ProtocolBuffers.TxId\"Y\n\ENQEvent\DC2)\n\EOTtype\CAN\NUL \STX(\SO2\ESC.ProtocolBuffers.Event.Type\DC2\n\n\STXid\CAN\SOH \STX(\f\"\EM\n\EOTType\DC2\ACK\n\STXTX\DLE\NUL\DC2\t\n\ENQBLOCK\DLE\SOH\"2\n\tEventList\DC2%\n\ENQevent\CAN\NUL \ETX(\v2\SYN.ProtocolBuffers.Event\"\\\n\EOTPeer\DC2\DC1\n\tuseragent\CAN\NUL \STX(\t\DC2\SI\n\aaddress\CAN\SOH \STX(\t\DC2\SI\n\aversion\CAN\STX \STX(\r\DC2\DLE\n\bservices\CAN\ETX \STX(\EOT\DC2\r\n\ENQrelay\CAN\EOT \STX(\b\"/\n\bPeerList\DC2#\n\EOTpeer\CAN\NUL \ETX(\v2\NAK.ProtocolBuffers.Peer\"\176\SOH\n\vHealthCheck\DC2\n\n\STXok\CAN\NUL \STX(\b\DC2\SO\n\ACKsynced\CAN\SOH \STX(\b\DC2\SI\n\aversion\CAN\STX \STX(\t\DC2\v\n\ETXnet\CAN\ETX \STX(\t\DC2\r\n\ENQpeers\CAN\EOT \SOH(\r\DC2\DC4\n\fheaders_hash\CAN\ENQ \SOH(\f\DC2\SYN\n\SOheaders_height\CAN\ACK \SOH(\r\DC2\DC3\n\vblocks_hash\CAN\a \SOH(\f\DC2\NAK\n\rblocks_height\CAN\b \SOH(\r\"\US\n\rTxAfterHeight\DC2\SO\n\ACKresult\CAN\NUL \SOH(\b\"\SYN\n\ENQError\DC2\r\n\ENQerror\CAN\NUL \STX(\t") \ No newline at end of file
diff --git a/src/Network/Haskoin/Store/ProtocolBuffers/Balance.hs b/src/Network/Haskoin/Store/ProtocolBuffers/Balance.hs
deleted file mode 100644
index 9f9ecca..0000000
--- a/src/Network/Haskoin/Store/ProtocolBuffers/Balance.hs
+++ /dev/null
@@ -1,128 +0,0 @@
-{-# LANGUAGE BangPatterns, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings #-}
-{-# OPTIONS_GHC -w #-}
-module Network.Haskoin.Store.ProtocolBuffers.Balance (Balance(..)) where
-import Prelude ((+), (/), (++), (.))
-import qualified Prelude as Prelude'
-import qualified Data.Typeable as Prelude'
-import qualified GHC.Generics as Prelude'
-import qualified Data.Data as Prelude'
-import qualified Text.ProtocolBuffers.Header as P'
-
-data Balance = Balance{address :: !(P'.Utf8), confirmed :: !(P'.Word64), unconfirmed :: !(P'.Word64), utxo :: !(P'.Word64),
- received :: !(P'.Word64), txs :: !(P'.Word64)}
- deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic)
-
-instance P'.Mergeable Balance where
- mergeAppend (Balance x'1 x'2 x'3 x'4 x'5 x'6) (Balance y'1 y'2 y'3 y'4 y'5 y'6)
- = Balance (P'.mergeAppend x'1 y'1) (P'.mergeAppend x'2 y'2) (P'.mergeAppend x'3 y'3) (P'.mergeAppend x'4 y'4)
- (P'.mergeAppend x'5 y'5)
- (P'.mergeAppend x'6 y'6)
-
-instance P'.Default Balance where
- defaultValue = Balance P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue
-
-instance P'.Wire Balance where
- wireSize ft' self'@(Balance x'1 x'2 x'3 x'4 x'5 x'6)
- = case ft' of
- 10 -> calc'Size
- 11 -> P'.prependMessageSize calc'Size
- _ -> P'.wireSizeErr ft' self'
- where
- calc'Size
- = (P'.wireSizeReq 1 9 x'1 + P'.wireSizeReq 1 4 x'2 + P'.wireSizeReq 1 4 x'3 + P'.wireSizeReq 1 4 x'4 +
- P'.wireSizeReq 1 4 x'5
- + P'.wireSizeReq 1 4 x'6)
- wirePutWithSize ft' self'@(Balance x'1 x'2 x'3 x'4 x'5 x'6)
- = case ft' of
- 10 -> put'Fields
- 11 -> put'FieldsSized
- _ -> P'.wirePutErr ft' self'
- where
- put'Fields
- = P'.sequencePutWithSize
- [P'.wirePutReqWithSize 2 9 x'1, P'.wirePutReqWithSize 8 4 x'2, P'.wirePutReqWithSize 16 4 x'3,
- P'.wirePutReqWithSize 24 4 x'4, P'.wirePutReqWithSize 32 4 x'5, P'.wirePutReqWithSize 40 4 x'6]
- put'FieldsSized
- = let size' = Prelude'.fst (P'.runPutM put'Fields)
- put'Size
- = do
- P'.putSize size'
- Prelude'.return (P'.size'WireSize size')
- in P'.sequencePutWithSize [put'Size, put'Fields]
- wireGet ft'
- = case ft' of
- 10 -> P'.getBareMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- 11 -> P'.getMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- _ -> P'.wireGetErr ft'
- where
- update'Self wire'Tag old'Self
- = case wire'Tag of
- 2 -> Prelude'.fmap (\ !new'Field -> old'Self{address = new'Field}) (P'.wireGet 9)
- 8 -> Prelude'.fmap (\ !new'Field -> old'Self{confirmed = new'Field}) (P'.wireGet 4)
- 16 -> Prelude'.fmap (\ !new'Field -> old'Self{unconfirmed = new'Field}) (P'.wireGet 4)
- 24 -> Prelude'.fmap (\ !new'Field -> old'Self{utxo = new'Field}) (P'.wireGet 4)
- 32 -> Prelude'.fmap (\ !new'Field -> old'Self{received = new'Field}) (P'.wireGet 4)
- 40 -> Prelude'.fmap (\ !new'Field -> old'Self{txs = new'Field}) (P'.wireGet 4)
- _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in P'.unknown field'Number wire'Type old'Self
-
-instance P'.MessageAPI msg' (msg' -> Balance) Balance where
- getVal m' f' = f' m'
-
-instance P'.GPB Balance
-
-instance P'.ReflectDescriptor Balance where
- getMessageInfo _
- = P'.GetMessageInfo (P'.fromDistinctAscList [2, 8, 16, 24, 32, 40]) (P'.fromDistinctAscList [2, 8, 16, 24, 32, 40])
- reflectDescriptorInfo _
- = Prelude'.read
- "DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.Balance\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"Balance\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"Balance.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Balance.address\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Balance\"], baseName' = FName \"address\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 2}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Balance.confirmed\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Balance\"], baseName' = FName \"confirmed\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 8}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 4}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Balance.unconfirmed\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Balance\"], baseName' = FName \"unconfirmed\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 16}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 4}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Balance.utxo\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Balance\"], baseName' = FName \"utxo\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 24}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 4}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Balance.received\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Balance\"], baseName' = FName \"received\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 32}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 4}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Balance.txs\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Balance\"], baseName' = FName \"txs\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 5}, wireTag = WireTag {getWireTag = 40}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 4}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False}"
-
-instance P'.TextType Balance where
- tellT = P'.tellSubMessage
- getT = P'.getSubMessage
-
-instance P'.TextMsg Balance where
- textPut msg
- = do
- P'.tellT "address" (address msg)
- P'.tellT "confirmed" (confirmed msg)
- P'.tellT "unconfirmed" (unconfirmed msg)
- P'.tellT "utxo" (utxo msg)
- P'.tellT "received" (received msg)
- P'.tellT "txs" (txs msg)
- textGet
- = do
- mods <- P'.sepEndBy (P'.choice [parse'address, parse'confirmed, parse'unconfirmed, parse'utxo, parse'received, parse'txs])
- P'.spaces
- Prelude'.return (Prelude'.foldl (\ v f -> f v) P'.defaultValue mods)
- where
- parse'address
- = P'.try
- (do
- v <- P'.getT "address"
- Prelude'.return (\ o -> o{address = v}))
- parse'confirmed
- = P'.try
- (do
- v <- P'.getT "confirmed"
- Prelude'.return (\ o -> o{confirmed = v}))
- parse'unconfirmed
- = P'.try
- (do
- v <- P'.getT "unconfirmed"
- Prelude'.return (\ o -> o{unconfirmed = v}))
- parse'utxo
- = P'.try
- (do
- v <- P'.getT "utxo"
- Prelude'.return (\ o -> o{utxo = v}))
- parse'received
- = P'.try
- (do
- v <- P'.getT "received"
- Prelude'.return (\ o -> o{received = v}))
- parse'txs
- = P'.try
- (do
- v <- P'.getT "txs"
- Prelude'.return (\ o -> o{txs = v})) \ No newline at end of file
diff --git a/src/Network/Haskoin/Store/ProtocolBuffers/BalanceList.hs b/src/Network/Haskoin/Store/ProtocolBuffers/BalanceList.hs
deleted file mode 100644
index 8a4532a..0000000
--- a/src/Network/Haskoin/Store/ProtocolBuffers/BalanceList.hs
+++ /dev/null
@@ -1,82 +0,0 @@
-{-# LANGUAGE BangPatterns, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings #-}
-{-# OPTIONS_GHC -w #-}
-module Network.Haskoin.Store.ProtocolBuffers.BalanceList (BalanceList(..)) where
-import Prelude ((+), (/), (++), (.))
-import qualified Prelude as Prelude'
-import qualified Data.Typeable as Prelude'
-import qualified GHC.Generics as Prelude'
-import qualified Data.Data as Prelude'
-import qualified Text.ProtocolBuffers.Header as P'
-import qualified Network.Haskoin.Store.ProtocolBuffers.Balance as ProtocolBuffers (Balance)
-
-data BalanceList = BalanceList{balance :: !(P'.Seq ProtocolBuffers.Balance)}
- deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic)
-
-instance P'.Mergeable BalanceList where
- mergeAppend (BalanceList x'1) (BalanceList y'1) = BalanceList (P'.mergeAppend x'1 y'1)
-
-instance P'.Default BalanceList where
- defaultValue = BalanceList P'.defaultValue
-
-instance P'.Wire BalanceList where
- wireSize ft' self'@(BalanceList x'1)
- = case ft' of
- 10 -> calc'Size
- 11 -> P'.prependMessageSize calc'Size
- _ -> P'.wireSizeErr ft' self'
- where
- calc'Size = (P'.wireSizeRep 1 11 x'1)
- wirePutWithSize ft' self'@(BalanceList x'1)
- = case ft' of
- 10 -> put'Fields
- 11 -> put'FieldsSized
- _ -> P'.wirePutErr ft' self'
- where
- put'Fields = P'.sequencePutWithSize [P'.wirePutRepWithSize 2 11 x'1]
- put'FieldsSized
- = let size' = Prelude'.fst (P'.runPutM put'Fields)
- put'Size
- = do
- P'.putSize size'
- Prelude'.return (P'.size'WireSize size')
- in P'.sequencePutWithSize [put'Size, put'Fields]
- wireGet ft'
- = case ft' of
- 10 -> P'.getBareMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- 11 -> P'.getMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- _ -> P'.wireGetErr ft'
- where
- update'Self wire'Tag old'Self
- = case wire'Tag of
- 2 -> Prelude'.fmap (\ !new'Field -> old'Self{balance = P'.append (balance old'Self) new'Field}) (P'.wireGet 11)
- _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in P'.unknown field'Number wire'Type old'Self
-
-instance P'.MessageAPI msg' (msg' -> BalanceList) BalanceList where
- getVal m' f' = f' m'
-
-instance P'.GPB BalanceList
-
-instance P'.ReflectDescriptor BalanceList where
- getMessageInfo _ = P'.GetMessageInfo (P'.fromDistinctAscList []) (P'.fromDistinctAscList [2])
- reflectDescriptorInfo _
- = Prelude'.read
- "DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.BalanceList\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"BalanceList\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"BalanceList.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BalanceList.balance\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BalanceList\"], baseName' = FName \"balance\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 2}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.Balance\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"Balance\"}), hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False}"
-
-instance P'.TextType BalanceList where
- tellT = P'.tellSubMessage
- getT = P'.getSubMessage
-
-instance P'.TextMsg BalanceList where
- textPut msg
- = do
- P'.tellT "balance" (balance msg)
- textGet
- = do
- mods <- P'.sepEndBy (P'.choice [parse'balance]) P'.spaces
- Prelude'.return (Prelude'.foldl (\ v f -> f v) P'.defaultValue mods)
- where
- parse'balance
- = P'.try
- (do
- v <- P'.getT "balance"
- Prelude'.return (\ o -> o{balance = P'.append (balance o) v})) \ No newline at end of file
diff --git a/src/Network/Haskoin/Store/ProtocolBuffers/BlockData.hs b/src/Network/Haskoin/Store/ProtocolBuffers/BlockData.hs
deleted file mode 100644
index f9074b6..0000000
--- a/src/Network/Haskoin/Store/ProtocolBuffers/BlockData.hs
+++ /dev/null
@@ -1,228 +0,0 @@
-{-# LANGUAGE BangPatterns, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings #-}
-{-# OPTIONS_GHC -w #-}
-module Network.Haskoin.Store.ProtocolBuffers.BlockData (BlockData(..)) where
-import Prelude ((+), (/), (++), (.))
-import qualified Prelude as Prelude'
-import qualified Data.Typeable as Prelude'
-import qualified GHC.Generics as Prelude'
-import qualified Data.Data as Prelude'
-import qualified Text.ProtocolBuffers.Header as P'
-
-data BlockData = BlockData{hash :: !(P'.ByteString), size :: !(P'.Word32), height :: !(P'.Word32), mainchain :: !(P'.Bool),
- previous :: !(P'.ByteString), time :: !(P'.Word32), version :: !(P'.Word32), bits :: !(P'.Word32),
- nonce :: !(P'.Word32), tx :: !(P'.Seq P'.ByteString), merkle :: !(P'.ByteString), fees :: !(P'.Word64),
- outputs :: !(P'.Word64), subsidy :: !(P'.Word64), weight :: !(P'.Word32)}
- deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic)
-
-instance P'.Mergeable BlockData where
- mergeAppend (BlockData x'1 x'2 x'3 x'4 x'5 x'6 x'7 x'8 x'9 x'10 x'11 x'12 x'13 x'14 x'15)
- (BlockData y'1 y'2 y'3 y'4 y'5 y'6 y'7 y'8 y'9 y'10 y'11 y'12 y'13 y'14 y'15)
- = BlockData (P'.mergeAppend x'1 y'1) (P'.mergeAppend x'2 y'2) (P'.mergeAppend x'3 y'3) (P'.mergeAppend x'4 y'4)
- (P'.mergeAppend x'5 y'5)
- (P'.mergeAppend x'6 y'6)
- (P'.mergeAppend x'7 y'7)
- (P'.mergeAppend x'8 y'8)
- (P'.mergeAppend x'9 y'9)
- (P'.mergeAppend x'10 y'10)
- (P'.mergeAppend x'11 y'11)
- (P'.mergeAppend x'12 y'12)
- (P'.mergeAppend x'13 y'13)
- (P'.mergeAppend x'14 y'14)
- (P'.mergeAppend x'15 y'15)
-
-instance P'.Default BlockData where
- defaultValue
- = BlockData P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue
- P'.defaultValue
- P'.defaultValue
- P'.defaultValue
- P'.defaultValue
- P'.defaultValue
- P'.defaultValue
- P'.defaultValue
- P'.defaultValue
-
-instance P'.Wire BlockData where
- wireSize ft' self'@(BlockData x'1 x'2 x'3 x'4 x'5 x'6 x'7 x'8 x'9 x'10 x'11 x'12 x'13 x'14 x'15)
- = case ft' of
- 10 -> calc'Size
- 11 -> P'.prependMessageSize calc'Size
- _ -> P'.wireSizeErr ft' self'
- where
- calc'Size
- = (P'.wireSizeReq 1 12 x'1 + P'.wireSizeReq 1 13 x'2 + P'.wireSizeReq 1 13 x'3 + P'.wireSizeReq 1 8 x'4 +
- P'.wireSizeReq 1 12 x'5
- + P'.wireSizeReq 1 13 x'6
- + P'.wireSizeReq 1 13 x'7
- + P'.wireSizeReq 1 13 x'8
- + P'.wireSizeReq 1 13 x'9
- + P'.wireSizeRep 1 12 x'10
- + P'.wireSizeReq 1 12 x'11
- + P'.wireSizeReq 1 4 x'12
- + P'.wireSizeReq 1 4 x'13
- + P'.wireSizeReq 1 4 x'14
- + P'.wireSizeReq 1 13 x'15)
- wirePutWithSize ft' self'@(BlockData x'1 x'2 x'3 x'4 x'5 x'6 x'7 x'8 x'9 x'10 x'11 x'12 x'13 x'14 x'15)
- = case ft' of
- 10 -> put'Fields
- 11 -> put'FieldsSized
- _ -> P'.wirePutErr ft' self'
- where
- put'Fields
- = P'.sequencePutWithSize
- [P'.wirePutReqWithSize 2 12 x'1, P'.wirePutReqWithSize 8 13 x'2, P'.wirePutReqWithSize 16 13 x'3,
- P'.wirePutReqWithSize 24 8 x'4, P'.wirePutReqWithSize 34 12 x'5, P'.wirePutReqWithSize 40 13 x'6,
- P'.wirePutReqWithSize 48 13 x'7, P'.wirePutReqWithSize 56 13 x'8, P'.wirePutReqWithSize 64 13 x'9,
- P'.wirePutRepWithSize 74 12 x'10, P'.wirePutReqWithSize 82 12 x'11, P'.wirePutReqWithSize 88 4 x'12,
- P'.wirePutReqWithSize 96 4 x'13, P'.wirePutReqWithSize 104 4 x'14, P'.wirePutReqWithSize 112 13 x'15]
- put'FieldsSized
- = let size' = Prelude'.fst (P'.runPutM put'Fields)
- put'Size
- = do
- P'.putSize size'
- Prelude'.return (P'.size'WireSize size')
- in P'.sequencePutWithSize [put'Size, put'Fields]
- wireGet ft'
- = case ft' of
- 10 -> P'.getBareMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- 11 -> P'.getMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- _ -> P'.wireGetErr ft'
- where
- update'Self wire'Tag old'Self
- = case wire'Tag of
- 2 -> Prelude'.fmap (\ !new'Field -> old'Self{hash = new'Field}) (P'.wireGet 12)
- 8 -> Prelude'.fmap (\ !new'Field -> old'Self{size = new'Field}) (P'.wireGet 13)
- 16 -> Prelude'.fmap (\ !new'Field -> old'Self{height = new'Field}) (P'.wireGet 13)
- 24 -> Prelude'.fmap (\ !new'Field -> old'Self{mainchain = new'Field}) (P'.wireGet 8)
- 34 -> Prelude'.fmap (\ !new'Field -> old'Self{previous = new'Field}) (P'.wireGet 12)
- 40 -> Prelude'.fmap (\ !new'Field -> old'Self{time = new'Field}) (P'.wireGet 13)
- 48 -> Prelude'.fmap (\ !new'Field -> old'Self{version = new'Field}) (P'.wireGet 13)
- 56 -> Prelude'.fmap (\ !new'Field -> old'Self{bits = new'Field}) (P'.wireGet 13)
- 64 -> Prelude'.fmap (\ !new'Field -> old'Self{nonce = new'Field}) (P'.wireGet 13)
- 74 -> Prelude'.fmap (\ !new'Field -> old'Self{tx = P'.append (tx old'Self) new'Field}) (P'.wireGet 12)
- 82 -> Prelude'.fmap (\ !new'Field -> old'Self{merkle = new'Field}) (P'.wireGet 12)
- 88 -> Prelude'.fmap (\ !new'Field -> old'Self{fees = new'Field}) (P'.wireGet 4)
- 96 -> Prelude'.fmap (\ !new'Field -> old'Self{outputs = new'Field}) (P'.wireGet 4)
- 104 -> Prelude'.fmap (\ !new'Field -> old'Self{subsidy = new'Field}) (P'.wireGet 4)
- 112 -> Prelude'.fmap (\ !new'Field -> old'Self{weight = new'Field}) (P'.wireGet 13)
- _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in P'.unknown field'Number wire'Type old'Self
-
-instance P'.MessageAPI msg' (msg' -> BlockData) BlockData where
- getVal m' f' = f' m'
-
-instance P'.GPB BlockData
-
-instance P'.ReflectDescriptor BlockData where
- getMessageInfo _
- = P'.GetMessageInfo (P'.fromDistinctAscList [2, 8, 16, 24, 34, 40, 48, 56, 64, 82, 88, 96, 104, 112])
- (P'.fromDistinctAscList [2, 8, 16, 24, 34, 40, 48, 56, 64, 74, 82, 88, 96, 104, 112])
- reflectDescriptorInfo _
- = Prelude'.read
- "DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.BlockData\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"BlockData\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"BlockData.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockData.hash\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockData\"], baseName' = FName \"hash\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 2}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 12}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockData.size\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockData\"], baseName' = FName \"size\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 8}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockData.height\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockData\"], baseName' = FName \"height\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 16}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockData.mainchain\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockData\"], baseName' = FName \"mainchain\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 24}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 8}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockData.previous\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockData\"], baseName' = FName \"previous\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 34}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 12}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockData.time\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockData\"], baseName' = FName \"time\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 5}, wireTag = WireTag {getWireTag = 40}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockData.version\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockData\"], baseName' = FName \"version\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 6}, wireTag = WireTag {getWireTag = 48}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockData.bits\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockData\"], baseName' = FName \"bits\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 7}, wireTag = WireTag {getWireTag = 56}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockData.nonce\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockData\"], baseName' = FName \"nonce\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 8}, wireTag = WireTag {getWireTag = 64}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockData.tx\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockData\"], baseName' = FName \"tx\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 9}, wireTag = WireTag {getWireTag = 74}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 12}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockData.merkle\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockData\"], baseName' = FName \"merkle\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 10}, wireTag = WireTag {getWireTag = 82}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 12}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockData.fees\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockData\"], baseName' = FName \"fees\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 11}, wireTag = WireTag {getWireTag = 88}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 4}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockData.outputs\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockData\"], baseName' = FName \"outputs\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 12}, wireTag = WireTag {getWireTag = 96}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 4}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockData.subsidy\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockData\"], baseName' = FName \"subsidy\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 13}, wireTag = WireTag {getWireTag = 104}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 4}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockData.weight\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockData\"], baseName' = FName \"weight\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 14}, wireTag = WireTag {getWireTag = 112}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False}"
-
-instance P'.TextType BlockData where
- tellT = P'.tellSubMessage
- getT = P'.getSubMessage
-
-instance P'.TextMsg BlockData where
- textPut msg
- = do
- P'.tellT "hash" (hash msg)
- P'.tellT "size" (size msg)
- P'.tellT "height" (height msg)
- P'.tellT "mainchain" (mainchain msg)
- P'.tellT "previous" (previous msg)
- P'.tellT "time" (time msg)
- P'.tellT "version" (version msg)
- P'.tellT "bits" (bits msg)
- P'.tellT "nonce" (nonce msg)
- P'.tellT "tx" (tx msg)
- P'.tellT "merkle" (merkle msg)
- P'.tellT "fees" (fees msg)
- P'.tellT "outputs" (outputs msg)
- P'.tellT "subsidy" (subsidy msg)
- P'.tellT "weight" (weight msg)
- textGet
- = do
- mods <- P'.sepEndBy
- (P'.choice
- [parse'hash, parse'size, parse'height, parse'mainchain, parse'previous, parse'time, parse'version, parse'bits,
- parse'nonce, parse'tx, parse'merkle, parse'fees, parse'outputs, parse'subsidy, parse'weight])
- P'.spaces
- Prelude'.return (Prelude'.foldl (\ v f -> f v) P'.defaultValue mods)
- where
- parse'hash
- = P'.try
- (do
- v <- P'.getT "hash"
- Prelude'.return (\ o -> o{hash = v}))
- parse'size
- = P'.try
- (do
- v <- P'.getT "size"
- Prelude'.return (\ o -> o{size = v}))
- parse'height
- = P'.try
- (do
- v <- P'.getT "height"
- Prelude'.return (\ o -> o{height = v}))
- parse'mainchain
- = P'.try
- (do
- v <- P'.getT "mainchain"
- Prelude'.return (\ o -> o{mainchain = v}))
- parse'previous
- = P'.try
- (do
- v <- P'.getT "previous"
- Prelude'.return (\ o -> o{previous = v}))
- parse'time
- = P'.try
- (do
- v <- P'.getT "time"
- Prelude'.return (\ o -> o{time = v}))
- parse'version
- = P'.try
- (do
- v <- P'.getT "version"
- Prelude'.return (\ o -> o{version = v}))
- parse'bits
- = P'.try
- (do
- v <- P'.getT "bits"
- Prelude'.return (\ o -> o{bits = v}))
- parse'nonce
- = P'.try
- (do
- v <- P'.getT "nonce"
- Prelude'.return (\ o -> o{nonce = v}))
- parse'tx
- = P'.try
- (do
- v <- P'.getT "tx"
- Prelude'.return (\ o -> o{tx = P'.append (tx o) v}))
- parse'merkle
- = P'.try
- (do
- v <- P'.getT "merkle"
- Prelude'.return (\ o -> o{merkle = v}))
- parse'fees
- = P'.try
- (do
- v <- P'.getT "fees"
- Prelude'.return (\ o -> o{fees = v}))
- parse'outputs
- = P'.try
- (do
- v <- P'.getT "outputs"
- Prelude'.return (\ o -> o{outputs = v}))
- parse'subsidy
- = P'.try
- (do
- v <- P'.getT "subsidy"
- Prelude'.return (\ o -> o{subsidy = v}))
- parse'weight
- = P'.try
- (do
- v <- P'.getT "weight"
- Prelude'.return (\ o -> o{weight = v})) \ No newline at end of file
diff --git a/src/Network/Haskoin/Store/ProtocolBuffers/BlockDataList.hs b/src/Network/Haskoin/Store/ProtocolBuffers/BlockDataList.hs
deleted file mode 100644
index c128c57..0000000
--- a/src/Network/Haskoin/Store/ProtocolBuffers/BlockDataList.hs
+++ /dev/null
@@ -1,82 +0,0 @@
-{-# LANGUAGE BangPatterns, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings #-}
-{-# OPTIONS_GHC -w #-}
-module Network.Haskoin.Store.ProtocolBuffers.BlockDataList (BlockDataList(..)) where
-import Prelude ((+), (/), (++), (.))
-import qualified Prelude as Prelude'
-import qualified Data.Typeable as Prelude'
-import qualified GHC.Generics as Prelude'
-import qualified Data.Data as Prelude'
-import qualified Text.ProtocolBuffers.Header as P'
-import qualified Network.Haskoin.Store.ProtocolBuffers.BlockData as ProtocolBuffers (BlockData)
-
-data BlockDataList = BlockDataList{blockdata :: !(P'.Seq ProtocolBuffers.BlockData)}
- deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic)
-
-instance P'.Mergeable BlockDataList where
- mergeAppend (BlockDataList x'1) (BlockDataList y'1) = BlockDataList (P'.mergeAppend x'1 y'1)
-
-instance P'.Default BlockDataList where
- defaultValue = BlockDataList P'.defaultValue
-
-instance P'.Wire BlockDataList where
- wireSize ft' self'@(BlockDataList x'1)
- = case ft' of
- 10 -> calc'Size
- 11 -> P'.prependMessageSize calc'Size
- _ -> P'.wireSizeErr ft' self'
- where
- calc'Size = (P'.wireSizeRep 1 11 x'1)
- wirePutWithSize ft' self'@(BlockDataList x'1)
- = case ft' of
- 10 -> put'Fields
- 11 -> put'FieldsSized
- _ -> P'.wirePutErr ft' self'
- where
- put'Fields = P'.sequencePutWithSize [P'.wirePutRepWithSize 2 11 x'1]
- put'FieldsSized
- = let size' = Prelude'.fst (P'.runPutM put'Fields)
- put'Size
- = do
- P'.putSize size'
- Prelude'.return (P'.size'WireSize size')
- in P'.sequencePutWithSize [put'Size, put'Fields]
- wireGet ft'
- = case ft' of
- 10 -> P'.getBareMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- 11 -> P'.getMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- _ -> P'.wireGetErr ft'
- where
- update'Self wire'Tag old'Self
- = case wire'Tag of
- 2 -> Prelude'.fmap (\ !new'Field -> old'Self{blockdata = P'.append (blockdata old'Self) new'Field}) (P'.wireGet 11)
- _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in P'.unknown field'Number wire'Type old'Self
-
-instance P'.MessageAPI msg' (msg' -> BlockDataList) BlockDataList where
- getVal m' f' = f' m'
-
-instance P'.GPB BlockDataList
-
-instance P'.ReflectDescriptor BlockDataList where
- getMessageInfo _ = P'.GetMessageInfo (P'.fromDistinctAscList []) (P'.fromDistinctAscList [2])
- reflectDescriptorInfo _
- = Prelude'.read
- "DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.BlockDataList\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"BlockDataList\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"BlockDataList.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockDataList.blockdata\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockDataList\"], baseName' = FName \"blockdata\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 2}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.BlockData\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"BlockData\"}), hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False}"
-
-instance P'.TextType BlockDataList where
- tellT = P'.tellSubMessage
- getT = P'.getSubMessage
-
-instance P'.TextMsg BlockDataList where
- textPut msg
- = do
- P'.tellT "blockdata" (blockdata msg)
- textGet
- = do
- mods <- P'.sepEndBy (P'.choice [parse'blockdata]) P'.spaces
- Prelude'.return (Prelude'.foldl (\ v f -> f v) P'.defaultValue mods)
- where
- parse'blockdata
- = P'.try
- (do
- v <- P'.getT "blockdata"
- Prelude'.return (\ o -> o{blockdata = P'.append (blockdata o) v})) \ No newline at end of file
diff --git a/src/Network/Haskoin/Store/ProtocolBuffers/BlockRef.hs b/src/Network/Haskoin/Store/ProtocolBuffers/BlockRef.hs
deleted file mode 100644
index 40e18db..0000000
--- a/src/Network/Haskoin/Store/ProtocolBuffers/BlockRef.hs
+++ /dev/null
@@ -1,110 +0,0 @@
-{-# LANGUAGE BangPatterns, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings #-}
-{-# OPTIONS_GHC -w #-}
-module Network.Haskoin.Store.ProtocolBuffers.BlockRef (BlockRef(..)) where
-import Prelude ((+), (/), (++), (.))
-import qualified Prelude as Prelude'
-import qualified Data.Typeable as Prelude'
-import qualified GHC.Generics as Prelude'
-import qualified Data.Data as Prelude'
-import qualified Text.ProtocolBuffers.Header as P'
-import qualified Network.Haskoin.Store.ProtocolBuffers.BlockRef.Block_ref as ProtocolBuffers.BlockRef (Block_ref)
-import qualified Network.Haskoin.Store.ProtocolBuffers.BlockRef.Block_ref as ProtocolBuffers.BlockRef.Block_ref
- (Block_ref(..), get'block, get'mempool)
-
-data BlockRef = BlockRef{block_ref :: P'.Maybe (ProtocolBuffers.BlockRef.Block_ref)}
- deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic)
-
-instance P'.Mergeable BlockRef where
- mergeAppend (BlockRef x'1) (BlockRef y'1) = BlockRef (P'.mergeAppend x'1 y'1)
-
-instance P'.Default BlockRef where
- defaultValue = BlockRef P'.defaultValue
-
-instance P'.Wire BlockRef where
- wireSize ft' self'@(BlockRef x'1)
- = case ft' of
- 10 -> calc'Size
- 11 -> P'.prependMessageSize calc'Size
- _ -> P'.wireSizeErr ft' self'
- where
- calc'Size
- = (P'.wireSizeOpt 1 11 (ProtocolBuffers.BlockRef.Block_ref.get'block Prelude'.=<< x'1) +
- P'.wireSizeOpt 1 11 (ProtocolBuffers.BlockRef.Block_ref.get'mempool Prelude'.=<< x'1))
- wirePutWithSize ft' self'@(BlockRef x'1)
- = case ft' of
- 10 -> put'Fields
- 11 -> put'FieldsSized
- _ -> P'.wirePutErr ft' self'
- where
- put'Fields
- = P'.sequencePutWithSize
- [P'.wirePutOptWithSize 2 11 (ProtocolBuffers.BlockRef.Block_ref.get'block Prelude'.=<< x'1),
- P'.wirePutOptWithSize 10 11 (ProtocolBuffers.BlockRef.Block_ref.get'mempool Prelude'.=<< x'1)]
- put'FieldsSized
- = let size' = Prelude'.fst (P'.runPutM put'Fields)
- put'Size
- = do
- P'.putSize size'
- Prelude'.return (P'.size'WireSize size')
- in P'.sequencePutWithSize [put'Size, put'Fields]
- wireGet ft'
- = case ft' of
- 10 -> P'.getBareMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- 11 -> P'.getMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- _ -> P'.wireGetErr ft'
- where
- update'Self wire'Tag old'Self
- = case wire'Tag of
- 2 -> Prelude'.fmap
- (\ !new'Field ->
- old'Self{block_ref =
- P'.mergeAppend (block_ref old'Self)
- (Prelude'.Just (ProtocolBuffers.BlockRef.Block_ref.Block new'Field))})
- (P'.wireGet 11)
- 10 -> Prelude'.fmap
- (\ !new'Field ->
- old'Self{block_ref =
- P'.mergeAppend (block_ref old'Self)
- (Prelude'.Just (ProtocolBuffers.BlockRef.Block_ref.Mempool new'Field))})
- (P'.wireGet 11)
- _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in P'.unknown field'Number wire'Type old'Self
-
-instance P'.MessageAPI msg' (msg' -> BlockRef) BlockRef where
- getVal m' f' = f' m'
-
-instance P'.GPB BlockRef
-
-instance P'.ReflectDescriptor BlockRef where
- getMessageInfo _ = P'.GetMessageInfo (P'.fromDistinctAscList []) (P'.fromDistinctAscList [])
- reflectDescriptorInfo _
- = Prelude'.read
- "DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.BlockRef\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"BlockRef\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"BlockRef.hs\"], isGroup = False, fields = fromList [], descOneofs = fromList [OneofInfo {oneofName = ProtoName {protobufName = FIName \".ProtocolBuffers.BlockRef.block_ref\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\",MName \"BlockRef\"], baseName = MName \"Block_ref\"}, oneofFName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockRef.block_ref\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockRef\"], baseName' = FName \"block_ref\", baseNamePrefix' = \"\"}, oneofFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"BlockRef\",\"Block_ref.hs\"], oneofFields = fromList [(ProtoName {protobufName = FIName \".ProtocolBuffers.BlockRef.block_ref.block\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\",MName \"BlockRef\",MName \"Block_ref\"], baseName = MName \"Block\"},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockRef.block_ref.block\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockRef\",MName \"Block_ref\"], baseName' = FName \"block\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 2}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.BlockRef.Block\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\",MName \"BlockRef\"], baseName = MName \"Block\"}), hsRawDefault = Nothing, hsDefault = Nothing}),(ProtoName {protobufName = FIName \".ProtocolBuffers.BlockRef.block_ref.mempool\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\",MName \"BlockRef\",MName \"Block_ref\"], baseName = MName \"Mempool\"},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockRef.block_ref.mempool\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockRef\",MName \"Block_ref\"], baseName' = FName \"mempool\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 10}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.BlockRef.Mempool\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\",MName \"BlockRef\"], baseName = MName \"Mempool\"}), hsRawDefault = Nothing, hsDefault = Nothing})], oneofMakeLenses = False}], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False}"
-
-instance P'.TextType BlockRef where
- tellT = P'.tellSubMessage
- getT = P'.getSubMessage
-
-instance P'.TextMsg BlockRef where
- textPut msg
- = do
- case (block_ref msg) of
- Prelude'.Just (ProtocolBuffers.BlockRef.Block_ref.Block block) -> P'.tellT "block" block
- Prelude'.Just (ProtocolBuffers.BlockRef.Block_ref.Mempool mempool) -> P'.tellT "mempool" mempool
- Prelude'.Nothing -> Prelude'.return ()
- textGet
- = do
- mods <- P'.sepEndBy (P'.choice [parse'block_ref]) P'.spaces
- Prelude'.return (Prelude'.foldl (\ v f -> f v) P'.defaultValue mods)
- where
- parse'block_ref = P'.try (P'.choice [parse'block, parse'mempool])
- where
- parse'block
- = P'.try
- (do
- v <- P'.getT "block"
- Prelude'.return (\ s -> s{block_ref = Prelude'.Just (ProtocolBuffers.BlockRef.Block_ref.Block v)}))
- parse'mempool
- = P'.try
- (do
- v <- P'.getT "mempool"
- Prelude'.return (\ s -> s{block_ref = Prelude'.Just (ProtocolBuffers.BlockRef.Block_ref.Mempool v)})) \ No newline at end of file
diff --git a/src/Network/Haskoin/Store/ProtocolBuffers/BlockRef/Block.hs b/src/Network/Haskoin/Store/ProtocolBuffers/BlockRef/Block.hs
deleted file mode 100644
index 1684a27..0000000
--- a/src/Network/Haskoin/Store/ProtocolBuffers/BlockRef/Block.hs
+++ /dev/null
@@ -1,88 +0,0 @@
-{-# LANGUAGE BangPatterns, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings #-}
-{-# OPTIONS_GHC -w #-}
-module Network.Haskoin.Store.ProtocolBuffers.BlockRef.Block (Block(..)) where
-import Prelude ((+), (/), (++), (.))
-import qualified Prelude as Prelude'
-import qualified Data.Typeable as Prelude'
-import qualified GHC.Generics as Prelude'
-import qualified Data.Data as Prelude'
-import qualified Text.ProtocolBuffers.Header as P'
-
-data Block = Block{height :: !(P'.Word32), position :: !(P'.Word32)}
- deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic)
-
-instance P'.Mergeable Block where
- mergeAppend (Block x'1 x'2) (Block y'1 y'2) = Block (P'.mergeAppend x'1 y'1) (P'.mergeAppend x'2 y'2)
-
-instance P'.Default Block where
- defaultValue = Block P'.defaultValue P'.defaultValue
-
-instance P'.Wire Block where
- wireSize ft' self'@(Block x'1 x'2)
- = case ft' of
- 10 -> calc'Size
- 11 -> P'.prependMessageSize calc'Size
- _ -> P'.wireSizeErr ft' self'
- where
- calc'Size = (P'.wireSizeReq 1 13 x'1 + P'.wireSizeReq 1 13 x'2)
- wirePutWithSize ft' self'@(Block x'1 x'2)
- = case ft' of
- 10 -> put'Fields
- 11 -> put'FieldsSized
- _ -> P'.wirePutErr ft' self'
- where
- put'Fields = P'.sequencePutWithSize [P'.wirePutReqWithSize 0 13 x'1, P'.wirePutReqWithSize 8 13 x'2]
- put'FieldsSized
- = let size' = Prelude'.fst (P'.runPutM put'Fields)
- put'Size
- = do
- P'.putSize size'
- Prelude'.return (P'.size'WireSize size')
- in P'.sequencePutWithSize [put'Size, put'Fields]
- wireGet ft'
- = case ft' of
- 10 -> P'.getBareMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- 11 -> P'.getMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- _ -> P'.wireGetErr ft'
- where
- update'Self wire'Tag old'Self
- = case wire'Tag of
- 0 -> Prelude'.fmap (\ !new'Field -> old'Self{height = new'Field}) (P'.wireGet 13)
- 8 -> Prelude'.fmap (\ !new'Field -> old'Self{position = new'Field}) (P'.wireGet 13)
- _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in P'.unknown field'Number wire'Type old'Self
-
-instance P'.MessageAPI msg' (msg' -> Block) Block where
- getVal m' f' = f' m'
-
-instance P'.GPB Block
-
-instance P'.ReflectDescriptor Block where
- getMessageInfo _ = P'.GetMessageInfo (P'.fromDistinctAscList [0, 8]) (P'.fromDistinctAscList [0, 8])
- reflectDescriptorInfo _
- = Prelude'.read
- "DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.BlockRef.Block\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\",MName \"BlockRef\"], baseName = MName \"Block\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"BlockRef\",\"Block.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockRef.Block.height\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockRef\",MName \"Block\"], baseName' = FName \"height\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 0}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockRef.Block.position\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockRef\",MName \"Block\"], baseName' = FName \"position\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 8}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False}"
-
-instance P'.TextType Block where
- tellT = P'.tellSubMessage
- getT = P'.getSubMessage
-
-instance P'.TextMsg Block where
- textPut msg
- = do
- P'.tellT "height" (height msg)
- P'.tellT "position" (position msg)
- textGet
- = do
- mods <- P'.sepEndBy (P'.choice [parse'height, parse'position]) P'.spaces
- Prelude'.return (Prelude'.foldl (\ v f -> f v) P'.defaultValue mods)
- where
- parse'height
- = P'.try
- (do
- v <- P'.getT "height"
- Prelude'.return (\ o -> o{height = v}))
- parse'position
- = P'.try
- (do
- v <- P'.getT "position"
- Prelude'.return (\ o -> o{position = v})) \ No newline at end of file
diff --git a/src/Network/Haskoin/Store/ProtocolBuffers/BlockRef/Block_ref.hs b/src/Network/Haskoin/Store/ProtocolBuffers/BlockRef/Block_ref.hs
deleted file mode 100644
index a595d98..0000000
--- a/src/Network/Haskoin/Store/ProtocolBuffers/BlockRef/Block_ref.hs
+++ /dev/null
@@ -1,28 +0,0 @@
-{-# LANGUAGE BangPatterns, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings #-}
-{-# OPTIONS_GHC -w #-}
-module Network.Haskoin.Store.ProtocolBuffers.BlockRef.Block_ref where
-import Prelude ((+), (/), (++), (.))
-import qualified Prelude as Prelude'
-import qualified Data.Typeable as Prelude'
-import qualified GHC.Generics as Prelude'
-import qualified Data.Data as Prelude'
-import qualified Text.ProtocolBuffers.Header as P'
-import qualified Network.Haskoin.Store.ProtocolBuffers.BlockRef.Block as ProtocolBuffers.BlockRef (Block)
-import qualified Network.Haskoin.Store.ProtocolBuffers.BlockRef.Mempool as ProtocolBuffers.BlockRef (Mempool)
-
-data Block_ref = Block{block :: (ProtocolBuffers.BlockRef.Block)}
- | Mempool{mempool :: (ProtocolBuffers.BlockRef.Mempool)}
- deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic)
-get'block x
- = case x of
- Block block -> Prelude'.Just block
- _ -> Prelude'.Nothing
-get'mempool x
- = case x of
- Mempool mempool -> Prelude'.Just mempool
- _ -> Prelude'.Nothing
-
-instance P'.Default Block_ref where
- defaultValue = Block P'.defaultValue
-
-instance P'.Mergeable Block_ref \ No newline at end of file
diff --git a/src/Network/Haskoin/Store/ProtocolBuffers/BlockRef/Mempool.hs b/src/Network/Haskoin/Store/ProtocolBuffers/BlockRef/Mempool.hs
deleted file mode 100644
index 0a5c7c5..0000000
--- a/src/Network/Haskoin/Store/ProtocolBuffers/BlockRef/Mempool.hs
+++ /dev/null
@@ -1,81 +0,0 @@
-{-# LANGUAGE BangPatterns, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings #-}
-{-# OPTIONS_GHC -w #-}
-module Network.Haskoin.Store.ProtocolBuffers.BlockRef.Mempool (Mempool(..)) where
-import Prelude ((+), (/), (++), (.))
-import qualified Prelude as Prelude'
-import qualified Data.Typeable as Prelude'
-import qualified GHC.Generics as Prelude'
-import qualified Data.Data as Prelude'
-import qualified Text.ProtocolBuffers.Header as P'
-
-data Mempool = Mempool{mempool :: !(P'.Word64)}
- deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic)
-
-instance P'.Mergeable Mempool where
- mergeAppend (Mempool x'1) (Mempool y'1) = Mempool (P'.mergeAppend x'1 y'1)
-
-instance P'.Default Mempool where
- defaultValue = Mempool P'.defaultValue
-
-instance P'.Wire Mempool where
- wireSize ft' self'@(Mempool x'1)
- = case ft' of
- 10 -> calc'Size
- 11 -> P'.prependMessageSize calc'Size
- _ -> P'.wireSizeErr ft' self'
- where
- calc'Size = (P'.wireSizeReq 1 4 x'1)
- wirePutWithSize ft' self'@(Mempool x'1)
- = case ft' of
- 10 -> put'Fields
- 11 -> put'FieldsSized
- _ -> P'.wirePutErr ft' self'
- where
- put'Fields = P'.sequencePutWithSize [P'.wirePutReqWithSize 0 4 x'1]
- put'FieldsSized
- = let size' = Prelude'.fst (P'.runPutM put'Fields)
- put'Size
- = do
- P'.putSize size'
- Prelude'.return (P'.size'WireSize size')
- in P'.sequencePutWithSize [put'Size, put'Fields]
- wireGet ft'
- = case ft' of
- 10 -> P'.getBareMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- 11 -> P'.getMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- _ -> P'.wireGetErr ft'
- where
- update'Self wire'Tag old'Self
- = case wire'Tag of
- 0 -> Prelude'.fmap (\ !new'Field -> old'Self{mempool = new'Field}) (P'.wireGet 4)
- _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in P'.unknown field'Number wire'Type old'Self
-
-instance P'.MessageAPI msg' (msg' -> Mempool) Mempool where
- getVal m' f' = f' m'
-
-instance P'.GPB Mempool
-
-instance P'.ReflectDescriptor Mempool where
- getMessageInfo _ = P'.GetMessageInfo (P'.fromDistinctAscList [0]) (P'.fromDistinctAscList [0])
- reflectDescriptorInfo _
- = Prelude'.read
- "DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.BlockRef.Mempool\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\",MName \"BlockRef\"], baseName = MName \"Mempool\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"BlockRef\",\"Mempool.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockRef.Mempool.mempool\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockRef\",MName \"Mempool\"], baseName' = FName \"mempool\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 0}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 4}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False}"
-
-instance P'.TextType Mempool where
- tellT = P'.tellSubMessage
- getT = P'.getSubMessage
-
-instance P'.TextMsg Mempool where
- textPut msg
- = do
- P'.tellT "mempool" (mempool msg)
- textGet
- = do
- mods <- P'.sepEndBy (P'.choice [parse'mempool]) P'.spaces
- Prelude'.return (Prelude'.foldl (\ v f -> f v) P'.defaultValue mods)
- where
- parse'mempool
- = P'.try
- (do
- v <- P'.getT "mempool"
- Prelude'.return (\ o -> o{mempool = v})) \ No newline at end of file
diff --git a/src/Network/Haskoin/Store/ProtocolBuffers/BlockTx.hs b/src/Network/Haskoin/Store/ProtocolBuffers/BlockTx.hs
deleted file mode 100644
index 6d6794e..0000000
--- a/src/Network/Haskoin/Store/ProtocolBuffers/BlockTx.hs
+++ /dev/null
@@ -1,90 +0,0 @@
-{-# LANGUAGE BangPatterns, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings #-}
-{-# OPTIONS_GHC -w #-}
-module Network.Haskoin.Store.ProtocolBuffers.BlockTx (BlockTx(..)) where
-import Prelude ((+), (/), (++), (.))
-import qualified Prelude as Prelude'
-import qualified Data.Typeable as Prelude'
-import qualified GHC.Generics as Prelude'
-import qualified Data.Data as Prelude'
-import qualified Text.ProtocolBuffers.Header as P'
-import qualified Network.Haskoin.Store.ProtocolBuffers.BlockRef as ProtocolBuffers (BlockRef)
-import qualified Network.Haskoin.Store.ProtocolBuffers.TxId as ProtocolBuffers (TxId)
-
-data BlockTx = BlockTx{block :: !(ProtocolBuffers.BlockRef), txid :: !(ProtocolBuffers.TxId)}
- deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic)
-
-instance P'.Mergeable BlockTx where
- mergeAppend (BlockTx x'1 x'2) (BlockTx y'1 y'2) = BlockTx (P'.mergeAppend x'1 y'1) (P'.mergeAppend x'2 y'2)
-
-instance P'.Default BlockTx where
- defaultValue = BlockTx P'.defaultValue P'.defaultValue
-
-instance P'.Wire BlockTx where
- wireSize ft' self'@(BlockTx x'1 x'2)
- = case ft' of
- 10 -> calc'Size
- 11 -> P'.prependMessageSize calc'Size
- _ -> P'.wireSizeErr ft' self'
- where
- calc'Size = (P'.wireSizeReq 1 11 x'1 + P'.wireSizeReq 1 11 x'2)
- wirePutWithSize ft' self'@(BlockTx x'1 x'2)
- = case ft' of
- 10 -> put'Fields
- 11 -> put'FieldsSized
- _ -> P'.wirePutErr ft' self'
- where
- put'Fields = P'.sequencePutWithSize [P'.wirePutReqWithSize 2 11 x'1, P'.wirePutReqWithSize 10 11 x'2]
- put'FieldsSized
- = let size' = Prelude'.fst (P'.runPutM put'Fields)
- put'Size
- = do
- P'.putSize size'
- Prelude'.return (P'.size'WireSize size')
- in P'.sequencePutWithSize [put'Size, put'Fields]
- wireGet ft'
- = case ft' of
- 10 -> P'.getBareMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- 11 -> P'.getMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- _ -> P'.wireGetErr ft'
- where
- update'Self wire'Tag old'Self
- = case wire'Tag of
- 2 -> Prelude'.fmap (\ !new'Field -> old'Self{block = P'.mergeAppend (block old'Self) (new'Field)}) (P'.wireGet 11)
- 10 -> Prelude'.fmap (\ !new'Field -> old'Self{txid = P'.mergeAppend (txid old'Self) (new'Field)}) (P'.wireGet 11)
- _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in P'.unknown field'Number wire'Type old'Self
-
-instance P'.MessageAPI msg' (msg' -> BlockTx) BlockTx where
- getVal m' f' = f' m'
-
-instance P'.GPB BlockTx
-
-instance P'.ReflectDescriptor BlockTx where
- getMessageInfo _ = P'.GetMessageInfo (P'.fromDistinctAscList [2, 10]) (P'.fromDistinctAscList [2, 10])
- reflectDescriptorInfo _
- = Prelude'.read
- "DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.BlockTx\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"BlockTx\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"BlockTx.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockTx.block\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockTx\"], baseName' = FName \"block\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 2}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.BlockRef\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"BlockRef\"}), hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockTx.txid\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockTx\"], baseName' = FName \"txid\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 10}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.TxId\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"TxId\"}), hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False}"
-
-instance P'.TextType BlockTx where
- tellT = P'.tellSubMessage
- getT = P'.getSubMessage
-
-instance P'.TextMsg BlockTx where
- textPut msg
- = do
- P'.tellT "block" (block msg)
- P'.tellT "txid" (txid msg)
- textGet
- = do
- mods <- P'.sepEndBy (P'.choice [parse'block, parse'txid]) P'.spaces
- Prelude'.return (Prelude'.foldl (\ v f -> f v) P'.defaultValue mods)
- where
- parse'block
- = P'.try
- (do
- v <- P'.getT "block"
- Prelude'.return (\ o -> o{block = v}))
- parse'txid
- = P'.try
- (do
- v <- P'.getT "txid"
- Prelude'.return (\ o -> o{txid = v})) \ No newline at end of file
diff --git a/src/Network/Haskoin/Store/ProtocolBuffers/BlockTxList.hs b/src/Network/Haskoin/Store/ProtocolBuffers/BlockTxList.hs
deleted file mode 100644
index 4059376..0000000
--- a/src/Network/Haskoin/Store/ProtocolBuffers/BlockTxList.hs
+++ /dev/null
@@ -1,82 +0,0 @@
-{-# LANGUAGE BangPatterns, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings #-}
-{-# OPTIONS_GHC -w #-}
-module Network.Haskoin.Store.ProtocolBuffers.BlockTxList (BlockTxList(..)) where
-import Prelude ((+), (/), (++), (.))
-import qualified Prelude as Prelude'
-import qualified Data.Typeable as Prelude'
-import qualified GHC.Generics as Prelude'
-import qualified Data.Data as Prelude'
-import qualified Text.ProtocolBuffers.Header as P'
-import qualified Network.Haskoin.Store.ProtocolBuffers.BlockTx as ProtocolBuffers (BlockTx)
-
-data BlockTxList = BlockTxList{blocktx :: !(P'.Seq ProtocolBuffers.BlockTx)}
- deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic)
-
-instance P'.Mergeable BlockTxList where
- mergeAppend (BlockTxList x'1) (BlockTxList y'1) = BlockTxList (P'.mergeAppend x'1 y'1)
-
-instance P'.Default BlockTxList where
- defaultValue = BlockTxList P'.defaultValue
-
-instance P'.Wire BlockTxList where
- wireSize ft' self'@(BlockTxList x'1)
- = case ft' of
- 10 -> calc'Size
- 11 -> P'.prependMessageSize calc'Size
- _ -> P'.wireSizeErr ft' self'
- where
- calc'Size = (P'.wireSizeRep 1 11 x'1)
- wirePutWithSize ft' self'@(BlockTxList x'1)
- = case ft' of
- 10 -> put'Fields
- 11 -> put'FieldsSized
- _ -> P'.wirePutErr ft' self'
- where
- put'Fields = P'.sequencePutWithSize [P'.wirePutRepWithSize 2 11 x'1]
- put'FieldsSized
- = let size' = Prelude'.fst (P'.runPutM put'Fields)
- put'Size
- = do
- P'.putSize size'
- Prelude'.return (P'.size'WireSize size')
- in P'.sequencePutWithSize [put'Size, put'Fields]
- wireGet ft'
- = case ft' of
- 10 -> P'.getBareMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- 11 -> P'.getMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- _ -> P'.wireGetErr ft'
- where
- update'Self wire'Tag old'Self
- = case wire'Tag of
- 2 -> Prelude'.fmap (\ !new'Field -> old'Self{blocktx = P'.append (blocktx old'Self) new'Field}) (P'.wireGet 11)
- _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in P'.unknown field'Number wire'Type old'Self
-
-instance P'.MessageAPI msg' (msg' -> BlockTxList) BlockTxList where
- getVal m' f' = f' m'
-
-instance P'.GPB BlockTxList
-
-instance P'.ReflectDescriptor BlockTxList where
- getMessageInfo _ = P'.GetMessageInfo (P'.fromDistinctAscList []) (P'.fromDistinctAscList [2])
- reflectDescriptorInfo _
- = Prelude'.read
- "DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.BlockTxList\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"BlockTxList\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"BlockTxList.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.BlockTxList.blocktx\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"BlockTxList\"], baseName' = FName \"blocktx\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 2}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.BlockTx\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"BlockTx\"}), hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False}"
-
-instance P'.TextType BlockTxList where
- tellT = P'.tellSubMessage
- getT = P'.getSubMessage
-
-instance P'.TextMsg BlockTxList where
- textPut msg
- = do
- P'.tellT "blocktx" (blocktx msg)
- textGet
- = do
- mods <- P'.sepEndBy (P'.choice [parse'blocktx]) P'.spaces
- Prelude'.return (Prelude'.foldl (\ v f -> f v) P'.defaultValue mods)
- where
- parse'blocktx
- = P'.try
- (do
- v <- P'.getT "blocktx"
- Prelude'.return (\ o -> o{blocktx = P'.append (blocktx o) v})) \ No newline at end of file
diff --git a/src/Network/Haskoin/Store/ProtocolBuffers/Error.hs b/src/Network/Haskoin/Store/ProtocolBuffers/Error.hs
deleted file mode 100644
index 91aa437..0000000
--- a/src/Network/Haskoin/Store/ProtocolBuffers/Error.hs
+++ /dev/null
@@ -1,81 +0,0 @@
-{-# LANGUAGE BangPatterns, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings #-}
-{-# OPTIONS_GHC -w #-}
-module Network.Haskoin.Store.ProtocolBuffers.Error (Error(..)) where
-import Prelude ((+), (/), (++), (.))
-import qualified Prelude as Prelude'
-import qualified Data.Typeable as Prelude'
-import qualified GHC.Generics as Prelude'
-import qualified Data.Data as Prelude'
-import qualified Text.ProtocolBuffers.Header as P'
-
-data Error = Error{error :: !(P'.Utf8)}
- deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic)
-
-instance P'.Mergeable Error where
- mergeAppend (Error x'1) (Error y'1) = Error (P'.mergeAppend x'1 y'1)
-
-instance P'.Default Error where
- defaultValue = Error P'.defaultValue
-
-instance P'.Wire Error where
- wireSize ft' self'@(Error x'1)
- = case ft' of
- 10 -> calc'Size
- 11 -> P'.prependMessageSize calc'Size
- _ -> P'.wireSizeErr ft' self'
- where
- calc'Size = (P'.wireSizeReq 1 9 x'1)
- wirePutWithSize ft' self'@(Error x'1)
- = case ft' of
- 10 -> put'Fields
- 11 -> put'FieldsSized
- _ -> P'.wirePutErr ft' self'
- where
- put'Fields = P'.sequencePutWithSize [P'.wirePutReqWithSize 2 9 x'1]
- put'FieldsSized
- = let size' = Prelude'.fst (P'.runPutM put'Fields)
- put'Size
- = do
- P'.putSize size'
- Prelude'.return (P'.size'WireSize size')
- in P'.sequencePutWithSize [put'Size, put'Fields]
- wireGet ft'
- = case ft' of
- 10 -> P'.getBareMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- 11 -> P'.getMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- _ -> P'.wireGetErr ft'
- where
- update'Self wire'Tag old'Self
- = case wire'Tag of
- 2 -> Prelude'.fmap (\ !new'Field -> old'Self{error = new'Field}) (P'.wireGet 9)
- _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in P'.unknown field'Number wire'Type old'Self
-
-instance P'.MessageAPI msg' (msg' -> Error) Error where
- getVal m' f' = f' m'
-
-instance P'.GPB Error
-
-instance P'.ReflectDescriptor Error where
- getMessageInfo _ = P'.GetMessageInfo (P'.fromDistinctAscList [2]) (P'.fromDistinctAscList [2])
- reflectDescriptorInfo _
- = Prelude'.read
- "DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.Error\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"Error\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"Error.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Error.error\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Error\"], baseName' = FName \"error\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 2}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False}"
-
-instance P'.TextType Error where
- tellT = P'.tellSubMessage
- getT = P'.getSubMessage
-
-instance P'.TextMsg Error where
- textPut msg
- = do
- P'.tellT "error" (error msg)
- textGet
- = do
- mods <- P'.sepEndBy (P'.choice [parse'error]) P'.spaces
- Prelude'.return (Prelude'.foldl (\ v f -> f v) P'.defaultValue mods)
- where
- parse'error
- = P'.try
- (do
- v <- P'.getT "error"
- Prelude'.return (\ o -> o{error = v})) \ No newline at end of file
diff --git a/src/Network/Haskoin/Store/ProtocolBuffers/Event.hs b/src/Network/Haskoin/Store/ProtocolBuffers/Event.hs
deleted file mode 100644
index 646e46a..0000000
--- a/src/Network/Haskoin/Store/ProtocolBuffers/Event.hs
+++ /dev/null
@@ -1,89 +0,0 @@
-{-# LANGUAGE BangPatterns, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings #-}
-{-# OPTIONS_GHC -w #-}
-module Network.Haskoin.Store.ProtocolBuffers.Event (Event(..)) where
-import Prelude ((+), (/), (++), (.))
-import qualified Prelude as Prelude'
-import qualified Data.Typeable as Prelude'
-import qualified GHC.Generics as Prelude'
-import qualified Data.Data as Prelude'
-import qualified Text.ProtocolBuffers.Header as P'
-import qualified Network.Haskoin.Store.ProtocolBuffers.Event.Type as ProtocolBuffers.Event (Type)
-
-data Event = Event{type' :: !(ProtocolBuffers.Event.Type), id :: !(P'.ByteString)}
- deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic)
-
-instance P'.Mergeable Event where
- mergeAppend (Event x'1 x'2) (Event y'1 y'2) = Event (P'.mergeAppend x'1 y'1) (P'.mergeAppend x'2 y'2)
-
-instance P'.Default Event where
- defaultValue = Event P'.defaultValue P'.defaultValue
-
-instance P'.Wire Event where
- wireSize ft' self'@(Event x'1 x'2)
- = case ft' of
- 10 -> calc'Size
- 11 -> P'.prependMessageSize calc'Size
- _ -> P'.wireSizeErr ft' self'
- where
- calc'Size = (P'.wireSizeReq 1 14 x'1 + P'.wireSizeReq 1 12 x'2)
- wirePutWithSize ft' self'@(Event x'1 x'2)
- = case ft' of
- 10 -> put'Fields
- 11 -> put'FieldsSized
- _ -> P'.wirePutErr ft' self'
- where
- put'Fields = P'.sequencePutWithSize [P'.wirePutReqWithSize 0 14 x'1, P'.wirePutReqWithSize 10 12 x'2]
- put'FieldsSized
- = let size' = Prelude'.fst (P'.runPutM put'Fields)
- put'Size
- = do
- P'.putSize size'
- Prelude'.return (P'.size'WireSize size')
- in P'.sequencePutWithSize [put'Size, put'Fields]
- wireGet ft'
- = case ft' of
- 10 -> P'.getBareMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- 11 -> P'.getMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- _ -> P'.wireGetErr ft'
- where
- update'Self wire'Tag old'Self
- = case wire'Tag of
- 0 -> Prelude'.fmap (\ !new'Field -> old'Self{type' = new'Field}) (P'.wireGet 14)
- 10 -> Prelude'.fmap (\ !new'Field -> old'Self{id = new'Field}) (P'.wireGet 12)
- _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in P'.unknown field'Number wire'Type old'Self
-
-instance P'.MessageAPI msg' (msg' -> Event) Event where
- getVal m' f' = f' m'
-
-instance P'.GPB Event
-
-instance P'.ReflectDescriptor Event where
- getMessageInfo _ = P'.GetMessageInfo (P'.fromDistinctAscList [0, 10]) (P'.fromDistinctAscList [0, 10])
- reflectDescriptorInfo _
- = Prelude'.read
- "DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.Event\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"Event\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"Event.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Event.type\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Event\"], baseName' = FName \"type'\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 0}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 14}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.Event.Type\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\",MName \"Event\"], baseName = MName \"Type\"}), hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Event.id\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Event\"], baseName' = FName \"id\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 10}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 12}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False}"
-
-instance P'.TextType Event where
- tellT = P'.tellSubMessage
- getT = P'.getSubMessage
-
-instance P'.TextMsg Event where
- textPut msg
- = do
- P'.tellT "type" (type' msg)
- P'.tellT "id" (id msg)
- textGet
- = do
- mods <- P'.sepEndBy (P'.choice [parse'type', parse'id]) P'.spaces
- Prelude'.return (Prelude'.foldl (\ v f -> f v) P'.defaultValue mods)
- where
- parse'type'
- = P'.try
- (do
- v <- P'.getT "type"
- Prelude'.return (\ o -> o{type' = v}))
- parse'id
- = P'.try
- (do
- v <- P'.getT "id"
- Prelude'.return (\ o -> o{id = v})) \ No newline at end of file
diff --git a/src/Network/Haskoin/Store/ProtocolBuffers/Event/Type.hs b/src/Network/Haskoin/Store/ProtocolBuffers/Event/Type.hs
deleted file mode 100644
index 2e1325a..0000000
--- a/src/Network/Haskoin/Store/ProtocolBuffers/Event/Type.hs
+++ /dev/null
@@ -1,65 +0,0 @@
-{-# LANGUAGE BangPatterns, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings #-}
-{-# OPTIONS_GHC -w #-}
-module Network.Haskoin.Store.ProtocolBuffers.Event.Type (Type(..)) where
-import Prelude ((+), (/), (.))
-import qualified Prelude as Prelude'
-import qualified Data.Typeable as Prelude'
-import qualified GHC.Generics as Prelude'
-import qualified Data.Data as Prelude'
-import qualified Text.ProtocolBuffers.Header as P'
-
-data Type = TX
- | BLOCK
- deriving (Prelude'.Read, Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic)
-
-instance P'.Mergeable Type
-
-instance Prelude'.Bounded Type where
- minBound = TX
- maxBound = BLOCK
-
-instance P'.Default Type where
- defaultValue = TX
-
-toMaybe'Enum :: Prelude'.Int -> P'.Maybe Type
-toMaybe'Enum 0 = Prelude'.Just TX
-toMaybe'Enum 1 = Prelude'.Just BLOCK
-toMaybe'Enum _ = Prelude'.Nothing
-
-instance Prelude'.Enum Type where
- fromEnum TX = 0
- fromEnum BLOCK = 1
- toEnum
- = P'.fromMaybe
- (Prelude'.error "hprotoc generated code: toEnum failure for type Network.Haskoin.Store.ProtocolBuffers.Event.Type")
- . toMaybe'Enum
- succ TX = BLOCK
- succ _ = Prelude'.error "hprotoc generated code: succ failure for type Network.Haskoin.Store.ProtocolBuffers.Event.Type"
- pred BLOCK = TX
- pred _ = Prelude'.error "hprotoc generated code: pred failure for type Network.Haskoin.Store.ProtocolBuffers.Event.Type"
-
-instance P'.Wire Type where
- wireSize ft' enum = P'.wireSize ft' (Prelude'.fromEnum enum)
- wirePut ft' enum = P'.wirePut ft' (Prelude'.fromEnum enum)
- wireGet 14 = P'.wireGetEnum toMaybe'Enum
- wireGet ft' = P'.wireGetErr ft'
- wireGetPacked 14 = P'.wireGetPackedEnum toMaybe'Enum
- wireGetPacked ft' = P'.wireGetErr ft'
-
-instance P'.GPB Type
-
-instance P'.MessageAPI msg' (msg' -> Type) Type where
- getVal m' f' = f' m'
-
-instance P'.ReflectEnum Type where
- reflectEnum = [(0, "TX", TX), (1, "BLOCK", BLOCK)]
- reflectEnumInfo _
- = P'.EnumInfo
- (P'.makePNF (P'.pack ".ProtocolBuffers.Event.Type") ["Network", "Haskoin", "Store"] ["ProtocolBuffers", "Event"] "Type")
- ["Network", "Haskoin", "Store", "ProtocolBuffers", "Event", "Type.hs"]
- [(0, "TX"), (1, "BLOCK")]
- Prelude'.False
-
-instance P'.TextType Type where
- tellT = P'.tellShow
- getT = P'.getRead \ No newline at end of file
diff --git a/src/Network/Haskoin/Store/ProtocolBuffers/EventList.hs b/src/Network/Haskoin/Store/ProtocolBuffers/EventList.hs
deleted file mode 100644
index 7f5c861..0000000
--- a/src/Network/Haskoin/Store/ProtocolBuffers/EventList.hs
+++ /dev/null
@@ -1,82 +0,0 @@
-{-# LANGUAGE BangPatterns, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings #-}
-{-# OPTIONS_GHC -w #-}
-module Network.Haskoin.Store.ProtocolBuffers.EventList (EventList(..)) where
-import Prelude ((+), (/), (++), (.))
-import qualified Prelude as Prelude'
-import qualified Data.Typeable as Prelude'
-import qualified GHC.Generics as Prelude'
-import qualified Data.Data as Prelude'
-import qualified Text.ProtocolBuffers.Header as P'
-import qualified Network.Haskoin.Store.ProtocolBuffers.Event as ProtocolBuffers (Event)
-
-data EventList = EventList{event :: !(P'.Seq ProtocolBuffers.Event)}
- deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic)
-
-instance P'.Mergeable EventList where
- mergeAppend (EventList x'1) (EventList y'1) = EventList (P'.mergeAppend x'1 y'1)
-
-instance P'.Default EventList where
- defaultValue = EventList P'.defaultValue
-
-instance P'.Wire EventList where
- wireSize ft' self'@(EventList x'1)
- = case ft' of
- 10 -> calc'Size
- 11 -> P'.prependMessageSize calc'Size
- _ -> P'.wireSizeErr ft' self'
- where
- calc'Size = (P'.wireSizeRep 1 11 x'1)
- wirePutWithSize ft' self'@(EventList x'1)
- = case ft' of
- 10 -> put'Fields
- 11 -> put'FieldsSized
- _ -> P'.wirePutErr ft' self'
- where
- put'Fields = P'.sequencePutWithSize [P'.wirePutRepWithSize 2 11 x'1]
- put'FieldsSized
- = let size' = Prelude'.fst (P'.runPutM put'Fields)
- put'Size
- = do
- P'.putSize size'
- Prelude'.return (P'.size'WireSize size')
- in P'.sequencePutWithSize [put'Size, put'Fields]
- wireGet ft'
- = case ft' of
- 10 -> P'.getBareMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- 11 -> P'.getMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- _ -> P'.wireGetErr ft'
- where
- update'Self wire'Tag old'Self
- = case wire'Tag of
- 2 -> Prelude'.fmap (\ !new'Field -> old'Self{event = P'.append (event old'Self) new'Field}) (P'.wireGet 11)
- _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in P'.unknown field'Number wire'Type old'Self
-
-instance P'.MessageAPI msg' (msg' -> EventList) EventList where
- getVal m' f' = f' m'
-
-instance P'.GPB EventList
-
-instance P'.ReflectDescriptor EventList where
- getMessageInfo _ = P'.GetMessageInfo (P'.fromDistinctAscList []) (P'.fromDistinctAscList [2])
- reflectDescriptorInfo _
- = Prelude'.read
- "DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.EventList\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"EventList\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"EventList.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.EventList.event\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"EventList\"], baseName' = FName \"event\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 2}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.Event\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"Event\"}), hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False}"
-
-instance P'.TextType EventList where
- tellT = P'.tellSubMessage
- getT = P'.getSubMessage
-
-instance P'.TextMsg EventList where
- textPut msg
- = do
- P'.tellT "event" (event msg)
- textGet
- = do
- mods <- P'.sepEndBy (P'.choice [parse'event]) P'.spaces
- Prelude'.return (Prelude'.foldl (\ v f -> f v) P'.defaultValue mods)
- where
- parse'event
- = P'.try
- (do
- v <- P'.getT "event"
- Prelude'.return (\ o -> o{event = P'.append (event o) v})) \ No newline at end of file
diff --git a/src/Network/Haskoin/Store/ProtocolBuffers/HealthCheck.hs b/src/Network/Haskoin/Store/ProtocolBuffers/HealthCheck.hs
deleted file mode 100644
index 1be3d21..0000000
--- a/src/Network/Haskoin/Store/ProtocolBuffers/HealthCheck.hs
+++ /dev/null
@@ -1,164 +0,0 @@
-{-# LANGUAGE BangPatterns, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings #-}
-{-# OPTIONS_GHC -w #-}
-module Network.Haskoin.Store.ProtocolBuffers.HealthCheck (HealthCheck(..)) where
-import Prelude ((+), (/), (++), (.))
-import qualified Prelude as Prelude'
-import qualified Data.Typeable as Prelude'
-import qualified GHC.Generics as Prelude'
-import qualified Data.Data as Prelude'
-import qualified Text.ProtocolBuffers.Header as P'
-
-data HealthCheck = HealthCheck{ok :: !(P'.Bool), synced :: !(P'.Bool), version :: !(P'.Utf8), net :: !(P'.Utf8),
- peers :: !(P'.Maybe P'.Word32), headers_hash :: !(P'.Maybe P'.ByteString),
- headers_height :: !(P'.Maybe P'.Word32), blocks_hash :: !(P'.Maybe P'.ByteString),
- blocks_height :: !(P'.Maybe P'.Word32)}
- deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic)
-
-instance P'.Mergeable HealthCheck where
- mergeAppend (HealthCheck x'1 x'2 x'3 x'4 x'5 x'6 x'7 x'8 x'9) (HealthCheck y'1 y'2 y'3 y'4 y'5 y'6 y'7 y'8 y'9)
- = HealthCheck (P'.mergeAppend x'1 y'1) (P'.mergeAppend x'2 y'2) (P'.mergeAppend x'3 y'3) (P'.mergeAppend x'4 y'4)
- (P'.mergeAppend x'5 y'5)
- (P'.mergeAppend x'6 y'6)
- (P'.mergeAppend x'7 y'7)
- (P'.mergeAppend x'8 y'8)
- (P'.mergeAppend x'9 y'9)
-
-instance P'.Default HealthCheck where
- defaultValue
- = HealthCheck P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue
- P'.defaultValue
- P'.defaultValue
-
-instance P'.Wire HealthCheck where
- wireSize ft' self'@(HealthCheck x'1 x'2 x'3 x'4 x'5 x'6 x'7 x'8 x'9)
- = case ft' of
- 10 -> calc'Size
- 11 -> P'.prependMessageSize calc'Size
- _ -> P'.wireSizeErr ft' self'
- where
- calc'Size
- = (P'.wireSizeReq 1 8 x'1 + P'.wireSizeReq 1 8 x'2 + P'.wireSizeReq 1 9 x'3 + P'.wireSizeReq 1 9 x'4 +
- P'.wireSizeOpt 1 13 x'5
- + P'.wireSizeOpt 1 12 x'6
- + P'.wireSizeOpt 1 13 x'7
- + P'.wireSizeOpt 1 12 x'8
- + P'.wireSizeOpt 1 13 x'9)
- wirePutWithSize ft' self'@(HealthCheck x'1 x'2 x'3 x'4 x'5 x'6 x'7 x'8 x'9)
- = case ft' of
- 10 -> put'Fields
- 11 -> put'FieldsSized
- _ -> P'.wirePutErr ft' self'
- where
- put'Fields
- = P'.sequencePutWithSize
- [P'.wirePutReqWithSize 0 8 x'1, P'.wirePutReqWithSize 8 8 x'2, P'.wirePutReqWithSize 18 9 x'3,
- P'.wirePutReqWithSize 26 9 x'4, P'.wirePutOptWithSize 32 13 x'5, P'.wirePutOptWithSize 42 12 x'6,
- P'.wirePutOptWithSize 48 13 x'7, P'.wirePutOptWithSize 58 12 x'8, P'.wirePutOptWithSize 64 13 x'9]
- put'FieldsSized
- = let size' = Prelude'.fst (P'.runPutM put'Fields)
- put'Size
- = do
- P'.putSize size'
- Prelude'.return (P'.size'WireSize size')
- in P'.sequencePutWithSize [put'Size, put'Fields]
- wireGet ft'
- = case ft' of
- 10 -> P'.getBareMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- 11 -> P'.getMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- _ -> P'.wireGetErr ft'
- where
- update'Self wire'Tag old'Self
- = case wire'Tag of
- 0 -> Prelude'.fmap (\ !new'Field -> old'Self{ok = new'Field}) (P'.wireGet 8)
- 8 -> Prelude'.fmap (\ !new'Field -> old'Self{synced = new'Field}) (P'.wireGet 8)
- 18 -> Prelude'.fmap (\ !new'Field -> old'Self{version = new'Field}) (P'.wireGet 9)
- 26 -> Prelude'.fmap (\ !new'Field -> old'Self{net = new'Field}) (P'.wireGet 9)
- 32 -> Prelude'.fmap (\ !new'Field -> old'Self{peers = Prelude'.Just new'Field}) (P'.wireGet 13)
- 42 -> Prelude'.fmap (\ !new'Field -> old'Self{headers_hash = Prelude'.Just new'Field}) (P'.wireGet 12)
- 48 -> Prelude'.fmap (\ !new'Field -> old'Self{headers_height = Prelude'.Just new'Field}) (P'.wireGet 13)
- 58 -> Prelude'.fmap (\ !new'Field -> old'Self{blocks_hash = Prelude'.Just new'Field}) (P'.wireGet 12)
- 64 -> Prelude'.fmap (\ !new'Field -> old'Self{blocks_height = Prelude'.Just new'Field}) (P'.wireGet 13)
- _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in P'.unknown field'Number wire'Type old'Self
-
-instance P'.MessageAPI msg' (msg' -> HealthCheck) HealthCheck where
- getVal m' f' = f' m'
-
-instance P'.GPB HealthCheck
-
-instance P'.ReflectDescriptor HealthCheck where
- getMessageInfo _
- = P'.GetMessageInfo (P'.fromDistinctAscList [0, 8, 18, 26]) (P'.fromDistinctAscList [0, 8, 18, 26, 32, 42, 48, 58, 64])
- reflectDescriptorInfo _
- = Prelude'.read
- "DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.HealthCheck\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"HealthCheck\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"HealthCheck.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.HealthCheck.ok\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"HealthCheck\"], baseName' = FName \"ok\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 0}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 8}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.HealthCheck.synced\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"HealthCheck\"], baseName' = FName \"synced\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 8}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 8}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.HealthCheck.version\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"HealthCheck\"], baseName' = FName \"version\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 18}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.HealthCheck.net\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"HealthCheck\"], baseName' = FName \"net\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 26}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.HealthCheck.peers\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"HealthCheck\"], baseName' = FName \"peers\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 32}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.HealthCheck.headers_hash\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"HealthCheck\"], baseName' = FName \"headers_hash\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 5}, wireTag = WireTag {getWireTag = 42}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 12}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.HealthCheck.headers_height\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"HealthCheck\"], baseName' = FName \"headers_height\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 6}, wireTag = WireTag {getWireTag = 48}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.HealthCheck.blocks_hash\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"HealthCheck\"], baseName' = FName \"blocks_hash\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 7}, wireTag = WireTag {getWireTag = 58}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 12}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.HealthCheck.blocks_height\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"HealthCheck\"], baseName' = FName \"blocks_height\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 8}, wireTag = WireTag {getWireTag = 64}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False}"
-
-instance P'.TextType HealthCheck where
- tellT = P'.tellSubMessage
- getT = P'.getSubMessage
-
-instance P'.TextMsg HealthCheck where
- textPut msg
- = do
- P'.tellT "ok" (ok msg)
- P'.tellT "synced" (synced msg)
- P'.tellT "version" (version msg)
- P'.tellT "net" (net msg)
- P'.tellT "peers" (peers msg)
- P'.tellT "headers_hash" (headers_hash msg)
- P'.tellT "headers_height" (headers_height msg)
- P'.tellT "blocks_hash" (blocks_hash msg)
- P'.tellT "blocks_height" (blocks_height msg)
- textGet
- = do
- mods <- P'.sepEndBy
- (P'.choice
- [parse'ok, parse'synced, parse'version, parse'net, parse'peers, parse'headers_hash, parse'headers_height,
- parse'blocks_hash, parse'blocks_height])
- P'.spaces
- Prelude'.return (Prelude'.foldl (\ v f -> f v) P'.defaultValue mods)
- where
- parse'ok
- = P'.try
- (do
- v <- P'.getT "ok"
- Prelude'.return (\ o -> o{ok = v}))
- parse'synced
- = P'.try
- (do
- v <- P'.getT "synced"
- Prelude'.return (\ o -> o{synced = v}))
- parse'version
- = P'.try
- (do
- v <- P'.getT "version"
- Prelude'.return (\ o -> o{version = v}))
- parse'net
- = P'.try
- (do
- v <- P'.getT "net"
- Prelude'.return (\ o -> o{net = v}))
- parse'peers
- = P'.try
- (do
- v <- P'.getT "peers"
- Prelude'.return (\ o -> o{peers = v}))
- parse'headers_hash
- = P'.try
- (do
- v <- P'.getT "headers_hash"
- Prelude'.return (\ o -> o{headers_hash = v}))
- parse'headers_height
- = P'.try
- (do
- v <- P'.getT "headers_height"
- Prelude'.return (\ o -> o{headers_height = v}))
- parse'blocks_hash
- = P'.try
- (do
- v <- P'.getT "blocks_hash"
- Prelude'.return (\ o -> o{blocks_hash = v}))
- parse'blocks_height
- = P'.try
- (do
- v <- P'.getT "blocks_height"
- Prelude'.return (\ o -> o{blocks_height = v})) \ No newline at end of file
diff --git a/src/Network/Haskoin/Store/ProtocolBuffers/Input.hs b/src/Network/Haskoin/Store/ProtocolBuffers/Input.hs
deleted file mode 100644
index 3251055..0000000
--- a/src/Network/Haskoin/Store/ProtocolBuffers/Input.hs
+++ /dev/null
@@ -1,164 +0,0 @@
-{-# LANGUAGE BangPatterns, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings #-}
-{-# OPTIONS_GHC -w #-}
-module Network.Haskoin.Store.ProtocolBuffers.Input (Input(..)) where
-import Prelude ((+), (/), (++), (.))
-import qualified Prelude as Prelude'
-import qualified Data.Typeable as Prelude'
-import qualified GHC.Generics as Prelude'
-import qualified Data.Data as Prelude'
-import qualified Text.ProtocolBuffers.Header as P'
-import qualified Network.Haskoin.Store.ProtocolBuffers.TxId as ProtocolBuffers (TxId)
-
-data Input = Input{coinbase :: !(P'.Bool), txid :: !(ProtocolBuffers.TxId), output :: !(P'.Word32), sigscript :: !(P'.ByteString),
- sequence :: !(P'.Word32), witness :: !(P'.Seq P'.ByteString), value :: !(P'.Maybe P'.Word64),
- pkscript :: !(P'.Maybe P'.ByteString), address :: !(P'.Maybe P'.Utf8)}
- deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic)
-
-instance P'.Mergeable Input where
- mergeAppend (Input x'1 x'2 x'3 x'4 x'5 x'6 x'7 x'8 x'9) (Input y'1 y'2 y'3 y'4 y'5 y'6 y'7 y'8 y'9)
- = Input (P'.mergeAppend x'1 y'1) (P'.mergeAppend x'2 y'2) (P'.mergeAppend x'3 y'3) (P'.mergeAppend x'4 y'4)
- (P'.mergeAppend x'5 y'5)
- (P'.mergeAppend x'6 y'6)
- (P'.mergeAppend x'7 y'7)
- (P'.mergeAppend x'8 y'8)
- (P'.mergeAppend x'9 y'9)
-
-instance P'.Default Input where
- defaultValue
- = Input P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue
- P'.defaultValue
- P'.defaultValue
-
-instance P'.Wire Input where
- wireSize ft' self'@(Input x'1 x'2 x'3 x'4 x'5 x'6 x'7 x'8 x'9)
- = case ft' of
- 10 -> calc'Size
- 11 -> P'.prependMessageSize calc'Size
- _ -> P'.wireSizeErr ft' self'
- where
- calc'Size
- = (P'.wireSizeReq 1 8 x'1 + P'.wireSizeReq 1 11 x'2 + P'.wireSizeReq 1 13 x'3 + P'.wireSizeReq 1 12 x'4 +
- P'.wireSizeReq 1 13 x'5
- + P'.wireSizeRep 1 12 x'6
- + P'.wireSizeOpt 1 4 x'7
- + P'.wireSizeOpt 1 12 x'8
- + P'.wireSizeOpt 1 9 x'9)
- wirePutWithSize ft' self'@(Input x'1 x'2 x'3 x'4 x'5 x'6 x'7 x'8 x'9)
- = case ft' of
- 10 -> put'Fields
- 11 -> put'FieldsSized
- _ -> P'.wirePutErr ft' self'
- where
- put'Fields
- = P'.sequencePutWithSize
- [P'.wirePutReqWithSize 0 8 x'1, P'.wirePutReqWithSize 10 11 x'2, P'.wirePutReqWithSize 16 13 x'3,
- P'.wirePutReqWithSize 26 12 x'4, P'.wirePutReqWithSize 32 13 x'5, P'.wirePutRepWithSize 42 12 x'6,
- P'.wirePutOptWithSize 48 4 x'7, P'.wirePutOptWithSize 58 12 x'8, P'.wirePutOptWithSize 66 9 x'9]
- put'FieldsSized
- = let size' = Prelude'.fst (P'.runPutM put'Fields)
- put'Size
- = do
- P'.putSize size'
- Prelude'.return (P'.size'WireSize size')
- in P'.sequencePutWithSize [put'Size, put'Fields]
- wireGet ft'
- = case ft' of
- 10 -> P'.getBareMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- 11 -> P'.getMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- _ -> P'.wireGetErr ft'
- where
- update'Self wire'Tag old'Self
- = case wire'Tag of
- 0 -> Prelude'.fmap (\ !new'Field -> old'Self{coinbase = new'Field}) (P'.wireGet 8)
- 10 -> Prelude'.fmap (\ !new'Field -> old'Self{txid = P'.mergeAppend (txid old'Self) (new'Field)}) (P'.wireGet 11)
- 16 -> Prelude'.fmap (\ !new'Field -> old'Self{output = new'Field}) (P'.wireGet 13)
- 26 -> Prelude'.fmap (\ !new'Field -> old'Self{sigscript = new'Field}) (P'.wireGet 12)
- 32 -> Prelude'.fmap (\ !new'Field -> old'Self{sequence = new'Field}) (P'.wireGet 13)
- 42 -> Prelude'.fmap (\ !new'Field -> old'Self{witness = P'.append (witness old'Self) new'Field}) (P'.wireGet 12)
- 48 -> Prelude'.fmap (\ !new'Field -> old'Self{value = Prelude'.Just new'Field}) (P'.wireGet 4)
- 58 -> Prelude'.fmap (\ !new'Field -> old'Self{pkscript = Prelude'.Just new'Field}) (P'.wireGet 12)
- 66 -> Prelude'.fmap (\ !new'Field -> old'Self{address = Prelude'.Just new'Field}) (P'.wireGet 9)
- _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in P'.unknown field'Number wire'Type old'Self
-
-instance P'.MessageAPI msg' (msg' -> Input) Input where
- getVal m' f' = f' m'
-
-instance P'.GPB Input
-
-instance P'.ReflectDescriptor Input where
- getMessageInfo _
- = P'.GetMessageInfo (P'.fromDistinctAscList [0, 10, 16, 26, 32]) (P'.fromDistinctAscList [0, 10, 16, 26, 32, 42, 48, 58, 66])
- reflectDescriptorInfo _
- = Prelude'.read
- "DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.Input\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"Input\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"Input.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Input.coinbase\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Input\"], baseName' = FName \"coinbase\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 0}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 8}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Input.txid\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Input\"], baseName' = FName \"txid\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 10}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.TxId\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"TxId\"}), hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Input.output\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Input\"], baseName' = FName \"output\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 16}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Input.sigscript\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Input\"], baseName' = FName \"sigscript\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 26}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 12}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Input.sequence\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Input\"], baseName' = FName \"sequence\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 32}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Input.witness\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Input\"], baseName' = FName \"witness\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 5}, wireTag = WireTag {getWireTag = 42}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 12}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Input.value\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Input\"], baseName' = FName \"value\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 6}, wireTag = WireTag {getWireTag = 48}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 4}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Input.pkscript\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Input\"], baseName' = FName \"pkscript\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 7}, wireTag = WireTag {getWireTag = 58}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 12}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Input.address\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Input\"], baseName' = FName \"address\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 8}, wireTag = WireTag {getWireTag = 66}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False}"
-
-instance P'.TextType Input where
- tellT = P'.tellSubMessage
- getT = P'.getSubMessage
-
-instance P'.TextMsg Input where
- textPut msg
- = do
- P'.tellT "coinbase" (coinbase msg)
- P'.tellT "txid" (txid msg)
- P'.tellT "output" (output msg)
- P'.tellT "sigscript" (sigscript msg)
- P'.tellT "sequence" (sequence msg)
- P'.tellT "witness" (witness msg)
- P'.tellT "value" (value msg)
- P'.tellT "pkscript" (pkscript msg)
- P'.tellT "address" (address msg)
- textGet
- = do
- mods <- P'.sepEndBy
- (P'.choice
- [parse'coinbase, parse'txid, parse'output, parse'sigscript, parse'sequence, parse'witness, parse'value,
- parse'pkscript, parse'address])
- P'.spaces
- Prelude'.return (Prelude'.foldl (\ v f -> f v) P'.defaultValue mods)
- where
- parse'coinbase
- = P'.try
- (do
- v <- P'.getT "coinbase"
- Prelude'.return (\ o -> o{coinbase = v}))
- parse'txid
- = P'.try
- (do
- v <- P'.getT "txid"
- Prelude'.return (\ o -> o{txid = v}))
- parse'output
- = P'.try
- (do
- v <- P'.getT "output"
- Prelude'.return (\ o -> o{output = v}))
- parse'sigscript
- = P'.try
- (do
- v <- P'.getT "sigscript"
- Prelude'.return (\ o -> o{sigscript = v}))
- parse'sequence
- = P'.try
- (do
- v <- P'.getT "sequence"
- Prelude'.return (\ o -> o{sequence = v}))
- parse'witness
- = P'.try
- (do
- v <- P'.getT "witness"
- Prelude'.return (\ o -> o{witness = P'.append (witness o) v}))
- parse'value
- = P'.try
- (do
- v <- P'.getT "value"
- Prelude'.return (\ o -> o{value = v}))
- parse'pkscript
- = P'.try
- (do
- v <- P'.getT "pkscript"
- Prelude'.return (\ o -> o{pkscript = v}))
- parse'address
- = P'.try
- (do
- v <- P'.getT "address"
- Prelude'.return (\ o -> o{address = v})) \ No newline at end of file
diff --git a/src/Network/Haskoin/Store/ProtocolBuffers/Output.hs b/src/Network/Haskoin/Store/ProtocolBuffers/Output.hs
deleted file mode 100644
index 9b840a9..0000000
--- a/src/Network/Haskoin/Store/ProtocolBuffers/Output.hs
+++ /dev/null
@@ -1,109 +0,0 @@
-{-# LANGUAGE BangPatterns, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings #-}
-{-# OPTIONS_GHC -w #-}
-module Network.Haskoin.Store.ProtocolBuffers.Output (Output(..)) where
-import Prelude ((+), (/), (++), (.))
-import qualified Prelude as Prelude'
-import qualified Data.Typeable as Prelude'
-import qualified GHC.Generics as Prelude'
-import qualified Data.Data as Prelude'
-import qualified Text.ProtocolBuffers.Header as P'
-import qualified Network.Haskoin.Store.ProtocolBuffers.Spender as ProtocolBuffers (Spender)
-
-data Output = Output{pkscript :: !(P'.ByteString), value :: !(P'.Word64), address :: !(P'.Maybe P'.Utf8),
- spender :: !(P'.Maybe ProtocolBuffers.Spender)}
- deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic)
-
-instance P'.Mergeable Output where
- mergeAppend (Output x'1 x'2 x'3 x'4) (Output y'1 y'2 y'3 y'4)
- = Output (P'.mergeAppend x'1 y'1) (P'.mergeAppend x'2 y'2) (P'.mergeAppend x'3 y'3) (P'.mergeAppend x'4 y'4)
-
-instance P'.Default Output where
- defaultValue = Output P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue
-
-instance P'.Wire Output where
- wireSize ft' self'@(Output x'1 x'2 x'3 x'4)
- = case ft' of
- 10 -> calc'Size
- 11 -> P'.prependMessageSize calc'Size
- _ -> P'.wireSizeErr ft' self'
- where
- calc'Size = (P'.wireSizeReq 1 12 x'1 + P'.wireSizeReq 1 4 x'2 + P'.wireSizeOpt 1 9 x'3 + P'.wireSizeOpt 1 11 x'4)
- wirePutWithSize ft' self'@(Output x'1 x'2 x'3 x'4)
- = case ft' of
- 10 -> put'Fields
- 11 -> put'FieldsSized
- _ -> P'.wirePutErr ft' self'
- where
- put'Fields
- = P'.sequencePutWithSize
- [P'.wirePutReqWithSize 2 12 x'1, P'.wirePutReqWithSize 8 4 x'2, P'.wirePutOptWithSize 18 9 x'3,
- P'.wirePutOptWithSize 26 11 x'4]
- put'FieldsSized
- = let size' = Prelude'.fst (P'.runPutM put'Fields)
- put'Size
- = do
- P'.putSize size'
- Prelude'.return (P'.size'WireSize size')
- in P'.sequencePutWithSize [put'Size, put'Fields]
- wireGet ft'
- = case ft' of
- 10 -> P'.getBareMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- 11 -> P'.getMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- _ -> P'.wireGetErr ft'
- where
- update'Self wire'Tag old'Self
- = case wire'Tag of
- 2 -> Prelude'.fmap (\ !new'Field -> old'Self{pkscript = new'Field}) (P'.wireGet 12)
- 8 -> Prelude'.fmap (\ !new'Field -> old'Self{value = new'Field}) (P'.wireGet 4)
- 18 -> Prelude'.fmap (\ !new'Field -> old'Self{address = Prelude'.Just new'Field}) (P'.wireGet 9)
- 26 -> Prelude'.fmap (\ !new'Field -> old'Self{spender = P'.mergeAppend (spender old'Self) (Prelude'.Just new'Field)})
- (P'.wireGet 11)
- _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in P'.unknown field'Number wire'Type old'Self
-
-instance P'.MessageAPI msg' (msg' -> Output) Output where
- getVal m' f' = f' m'
-
-instance P'.GPB Output
-
-instance P'.ReflectDescriptor Output where
- getMessageInfo _ = P'.GetMessageInfo (P'.fromDistinctAscList [2, 8]) (P'.fromDistinctAscList [2, 8, 18, 26])
- reflectDescriptorInfo _
- = Prelude'.read
- "DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.Output\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"Output\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"Output.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Output.pkscript\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Output\"], baseName' = FName \"pkscript\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 2}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 12}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Output.value\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Output\"], baseName' = FName \"value\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 8}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 4}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Output.address\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Output\"], baseName' = FName \"address\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 18}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Output.spender\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Output\"], baseName' = FName \"spender\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 26}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.Spender\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"Spender\"}), hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False}"
-
-instance P'.TextType Output where
- tellT = P'.tellSubMessage
- getT = P'.getSubMessage
-
-instance P'.TextMsg Output where
- textPut msg
- = do
- P'.tellT "pkscript" (pkscript msg)
- P'.tellT "value" (value msg)
- P'.tellT "address" (address msg)
- P'.tellT "spender" (spender msg)
- textGet
- = do
- mods <- P'.sepEndBy (P'.choice [parse'pkscript, parse'value, parse'address, parse'spender]) P'.spaces
- Prelude'.return (Prelude'.foldl (\ v f -> f v) P'.defaultValue mods)
- where
- parse'pkscript
- = P'.try
- (do
- v <- P'.getT "pkscript"
- Prelude'.return (\ o -> o{pkscript = v}))
- parse'value
- = P'.try
- (do
- v <- P'.getT "value"
- Prelude'.return (\ o -> o{value = v}))
- parse'address
- = P'.try
- (do
- v <- P'.getT "address"
- Prelude'.return (\ o -> o{address = v}))
- parse'spender
- = P'.try
- (do
- v <- P'.getT "spender"
- Prelude'.return (\ o -> o{spender = v})) \ No newline at end of file
diff --git a/src/Network/Haskoin/Store/ProtocolBuffers/Peer.hs b/src/Network/Haskoin/Store/ProtocolBuffers/Peer.hs
deleted file mode 100644
index 9bec4a3..0000000
--- a/src/Network/Haskoin/Store/ProtocolBuffers/Peer.hs
+++ /dev/null
@@ -1,117 +0,0 @@
-{-# LANGUAGE BangPatterns, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings #-}
-{-# OPTIONS_GHC -w #-}
-module Network.Haskoin.Store.ProtocolBuffers.Peer (Peer(..)) where
-import Prelude ((+), (/), (++), (.))
-import qualified Prelude as Prelude'
-import qualified Data.Typeable as Prelude'
-import qualified GHC.Generics as Prelude'
-import qualified Data.Data as Prelude'
-import qualified Text.ProtocolBuffers.Header as P'
-
-data Peer = Peer{useragent :: !(P'.Utf8), address :: !(P'.Utf8), version :: !(P'.Word32), services :: !(P'.Word64),
- relay :: !(P'.Bool)}
- deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic)
-
-instance P'.Mergeable Peer where
- mergeAppend (Peer x'1 x'2 x'3 x'4 x'5) (Peer y'1 y'2 y'3 y'4 y'5)
- = Peer (P'.mergeAppend x'1 y'1) (P'.mergeAppend x'2 y'2) (P'.mergeAppend x'3 y'3) (P'.mergeAppend x'4 y'4)
- (P'.mergeAppend x'5 y'5)
-
-instance P'.Default Peer where
- defaultValue = Peer P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue
-
-instance P'.Wire Peer where
- wireSize ft' self'@(Peer x'1 x'2 x'3 x'4 x'5)
- = case ft' of
- 10 -> calc'Size
- 11 -> P'.prependMessageSize calc'Size
- _ -> P'.wireSizeErr ft' self'
- where
- calc'Size
- = (P'.wireSizeReq 1 9 x'1 + P'.wireSizeReq 1 9 x'2 + P'.wireSizeReq 1 13 x'3 + P'.wireSizeReq 1 4 x'4 +
- P'.wireSizeReq 1 8 x'5)
- wirePutWithSize ft' self'@(Peer x'1 x'2 x'3 x'4 x'5)
- = case ft' of
- 10 -> put'Fields
- 11 -> put'FieldsSized
- _ -> P'.wirePutErr ft' self'
- where
- put'Fields
- = P'.sequencePutWithSize
- [P'.wirePutReqWithSize 2 9 x'1, P'.wirePutReqWithSize 10 9 x'2, P'.wirePutReqWithSize 16 13 x'3,
- P'.wirePutReqWithSize 24 4 x'4, P'.wirePutReqWithSize 32 8 x'5]
- put'FieldsSized
- = let size' = Prelude'.fst (P'.runPutM put'Fields)
- put'Size
- = do
- P'.putSize size'
- Prelude'.return (P'.size'WireSize size')
- in P'.sequencePutWithSize [put'Size, put'Fields]
- wireGet ft'
- = case ft' of
- 10 -> P'.getBareMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- 11 -> P'.getMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- _ -> P'.wireGetErr ft'
- where
- update'Self wire'Tag old'Self
- = case wire'Tag of
- 2 -> Prelude'.fmap (\ !new'Field -> old'Self{useragent = new'Field}) (P'.wireGet 9)
- 10 -> Prelude'.fmap (\ !new'Field -> old'Self{address = new'Field}) (P'.wireGet 9)
- 16 -> Prelude'.fmap (\ !new'Field -> old'Self{version = new'Field}) (P'.wireGet 13)
- 24 -> Prelude'.fmap (\ !new'Field -> old'Self{services = new'Field}) (P'.wireGet 4)
- 32 -> Prelude'.fmap (\ !new'Field -> old'Self{relay = new'Field}) (P'.wireGet 8)
- _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in P'.unknown field'Number wire'Type old'Self
-
-instance P'.MessageAPI msg' (msg' -> Peer) Peer where
- getVal m' f' = f' m'
-
-instance P'.GPB Peer
-
-instance P'.ReflectDescriptor Peer where
- getMessageInfo _ = P'.GetMessageInfo (P'.fromDistinctAscList [2, 10, 16, 24, 32]) (P'.fromDistinctAscList [2, 10, 16, 24, 32])
- reflectDescriptorInfo _
- = Prelude'.read
- "DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.Peer\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"Peer\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"Peer.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Peer.useragent\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Peer\"], baseName' = FName \"useragent\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 2}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Peer.address\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Peer\"], baseName' = FName \"address\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 10}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Peer.version\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Peer\"], baseName' = FName \"version\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 16}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Peer.services\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Peer\"], baseName' = FName \"services\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 24}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 4}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Peer.relay\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Peer\"], baseName' = FName \"relay\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 32}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 8}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False}"
-
-instance P'.TextType Peer where
- tellT = P'.tellSubMessage
- getT = P'.getSubMessage
-
-instance P'.TextMsg Peer where
- textPut msg
- = do
- P'.tellT "useragent" (useragent msg)
- P'.tellT "address" (address msg)
- P'.tellT "version" (version msg)
- P'.tellT "services" (services msg)
- P'.tellT "relay" (relay msg)
- textGet
- = do
- mods <- P'.sepEndBy (P'.choice [parse'useragent, parse'address, parse'version, parse'services, parse'relay]) P'.spaces
- Prelude'.return (Prelude'.foldl (\ v f -> f v) P'.defaultValue mods)
- where
- parse'useragent
- = P'.try
- (do
- v <- P'.getT "useragent"
- Prelude'.return (\ o -> o{useragent = v}))
- parse'address
- = P'.try
- (do
- v <- P'.getT "address"
- Prelude'.return (\ o -> o{address = v}))
- parse'version
- = P'.try
- (do
- v <- P'.getT "version"
- Prelude'.return (\ o -> o{version = v}))
- parse'services
- = P'.try
- (do
- v <- P'.getT "services"
- Prelude'.return (\ o -> o{services = v}))
- parse'relay
- = P'.try
- (do
- v <- P'.getT "relay"
- Prelude'.return (\ o -> o{relay = v})) \ No newline at end of file
diff --git a/src/Network/Haskoin/Store/ProtocolBuffers/PeerList.hs b/src/Network/Haskoin/Store/ProtocolBuffers/PeerList.hs
deleted file mode 100644
index 8a12939..0000000
--- a/src/Network/Haskoin/Store/ProtocolBuffers/PeerList.hs
+++ /dev/null
@@ -1,82 +0,0 @@
-{-# LANGUAGE BangPatterns, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings #-}
-{-# OPTIONS_GHC -w #-}
-module Network.Haskoin.Store.ProtocolBuffers.PeerList (PeerList(..)) where
-import Prelude ((+), (/), (++), (.))
-import qualified Prelude as Prelude'
-import qualified Data.Typeable as Prelude'
-import qualified GHC.Generics as Prelude'
-import qualified Data.Data as Prelude'
-import qualified Text.ProtocolBuffers.Header as P'
-import qualified Network.Haskoin.Store.ProtocolBuffers.Peer as ProtocolBuffers (Peer)
-
-data PeerList = PeerList{peer :: !(P'.Seq ProtocolBuffers.Peer)}
- deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic)
-
-instance P'.Mergeable PeerList where
- mergeAppend (PeerList x'1) (PeerList y'1) = PeerList (P'.mergeAppend x'1 y'1)
-
-instance P'.Default PeerList where
- defaultValue = PeerList P'.defaultValue
-
-instance P'.Wire PeerList where
- wireSize ft' self'@(PeerList x'1)
- = case ft' of
- 10 -> calc'Size
- 11 -> P'.prependMessageSize calc'Size
- _ -> P'.wireSizeErr ft' self'
- where
- calc'Size = (P'.wireSizeRep 1 11 x'1)
- wirePutWithSize ft' self'@(PeerList x'1)
- = case ft' of
- 10 -> put'Fields
- 11 -> put'FieldsSized
- _ -> P'.wirePutErr ft' self'
- where
- put'Fields = P'.sequencePutWithSize [P'.wirePutRepWithSize 2 11 x'1]
- put'FieldsSized
- = let size' = Prelude'.fst (P'.runPutM put'Fields)
- put'Size
- = do
- P'.putSize size'
- Prelude'.return (P'.size'WireSize size')
- in P'.sequencePutWithSize [put'Size, put'Fields]
- wireGet ft'
- = case ft' of
- 10 -> P'.getBareMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- 11 -> P'.getMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- _ -> P'.wireGetErr ft'
- where
- update'Self wire'Tag old'Self
- = case wire'Tag of
- 2 -> Prelude'.fmap (\ !new'Field -> old'Self{peer = P'.append (peer old'Self) new'Field}) (P'.wireGet 11)
- _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in P'.unknown field'Number wire'Type old'Self
-
-instance P'.MessageAPI msg' (msg' -> PeerList) PeerList where
- getVal m' f' = f' m'
-
-instance P'.GPB PeerList
-
-instance P'.ReflectDescriptor PeerList where
- getMessageInfo _ = P'.GetMessageInfo (P'.fromDistinctAscList []) (P'.fromDistinctAscList [2])
- reflectDescriptorInfo _
- = Prelude'.read
- "DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.PeerList\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"PeerList\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"PeerList.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.PeerList.peer\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"PeerList\"], baseName' = FName \"peer\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 2}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.Peer\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"Peer\"}), hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False}"
-
-instance P'.TextType PeerList where
- tellT = P'.tellSubMessage
- getT = P'.getSubMessage
-
-instance P'.TextMsg PeerList where
- textPut msg
- = do
- P'.tellT "peer" (peer msg)
- textGet
- = do
- mods <- P'.sepEndBy (P'.choice [parse'peer]) P'.spaces
- Prelude'.return (Prelude'.foldl (\ v f -> f v) P'.defaultValue mods)
- where
- parse'peer
- = P'.try
- (do
- v <- P'.getT "peer"
- Prelude'.return (\ o -> o{peer = P'.append (peer o) v})) \ No newline at end of file
diff --git a/src/Network/Haskoin/Store/ProtocolBuffers/Spender.hs b/src/Network/Haskoin/Store/ProtocolBuffers/Spender.hs
deleted file mode 100644
index b4ad81e..0000000
--- a/src/Network/Haskoin/Store/ProtocolBuffers/Spender.hs
+++ /dev/null
@@ -1,89 +0,0 @@
-{-# LANGUAGE BangPatterns, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings #-}
-{-# OPTIONS_GHC -w #-}
-module Network.Haskoin.Store.ProtocolBuffers.Spender (Spender(..)) where
-import Prelude ((+), (/), (++), (.))
-import qualified Prelude as Prelude'
-import qualified Data.Typeable as Prelude'
-import qualified GHC.Generics as Prelude'
-import qualified Data.Data as Prelude'
-import qualified Text.ProtocolBuffers.Header as P'
-import qualified Network.Haskoin.Store.ProtocolBuffers.TxId as ProtocolBuffers (TxId)
-
-data Spender = Spender{txid :: !(ProtocolBuffers.TxId), input :: !(P'.Word32)}
- deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic)
-
-instance P'.Mergeable Spender where
- mergeAppend (Spender x'1 x'2) (Spender y'1 y'2) = Spender (P'.mergeAppend x'1 y'1) (P'.mergeAppend x'2 y'2)
-
-instance P'.Default Spender where
- defaultValue = Spender P'.defaultValue P'.defaultValue
-
-instance P'.Wire Spender where
- wireSize ft' self'@(Spender x'1 x'2)
- = case ft' of
- 10 -> calc'Size
- 11 -> P'.prependMessageSize calc'Size
- _ -> P'.wireSizeErr ft' self'
- where
- calc'Size = (P'.wireSizeReq 1 11 x'1 + P'.wireSizeReq 1 13 x'2)
- wirePutWithSize ft' self'@(Spender x'1 x'2)
- = case ft' of
- 10 -> put'Fields
- 11 -> put'FieldsSized
- _ -> P'.wirePutErr ft' self'
- where
- put'Fields = P'.sequencePutWithSize [P'.wirePutReqWithSize 2 11 x'1, P'.wirePutReqWithSize 8 13 x'2]
- put'FieldsSized
- = let size' = Prelude'.fst (P'.runPutM put'Fields)
- put'Size
- = do
- P'.putSize size'
- Prelude'.return (P'.size'WireSize size')
- in P'.sequencePutWithSize [put'Size, put'Fields]
- wireGet ft'
- = case ft' of
- 10 -> P'.getBareMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- 11 -> P'.getMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- _ -> P'.wireGetErr ft'
- where
- update'Self wire'Tag old'Self
- = case wire'Tag of
- 2 -> Prelude'.fmap (\ !new'Field -> old'Self{txid = P'.mergeAppend (txid old'Self) (new'Field)}) (P'.wireGet 11)
- 8 -> Prelude'.fmap (\ !new'Field -> old'Self{input = new'Field}) (P'.wireGet 13)
- _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in P'.unknown field'Number wire'Type old'Self
-
-instance P'.MessageAPI msg' (msg' -> Spender) Spender where
- getVal m' f' = f' m'
-
-instance P'.GPB Spender
-
-instance P'.ReflectDescriptor Spender where
- getMessageInfo _ = P'.GetMessageInfo (P'.fromDistinctAscList [2, 8]) (P'.fromDistinctAscList [2, 8])
- reflectDescriptorInfo _
- = Prelude'.read
- "DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.Spender\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"Spender\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"Spender.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Spender.txid\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Spender\"], baseName' = FName \"txid\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 2}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.TxId\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"TxId\"}), hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Spender.input\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Spender\"], baseName' = FName \"input\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 8}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False}"
-
-instance P'.TextType Spender where
- tellT = P'.tellSubMessage
- getT = P'.getSubMessage
-
-instance P'.TextMsg Spender where
- textPut msg
- = do
- P'.tellT "txid" (txid msg)
- P'.tellT "input" (input msg)
- textGet
- = do
- mods <- P'.sepEndBy (P'.choice [parse'txid, parse'input]) P'.spaces
- Prelude'.return (Prelude'.foldl (\ v f -> f v) P'.defaultValue mods)
- where
- parse'txid
- = P'.try
- (do
- v <- P'.getT "txid"
- Prelude'.return (\ o -> o{txid = v}))
- parse'input
- = P'.try
- (do
- v <- P'.getT "input"
- Prelude'.return (\ o -> o{input = v})) \ No newline at end of file
diff --git a/src/Network/Haskoin/Store/ProtocolBuffers/Transaction.hs b/src/Network/Haskoin/Store/ProtocolBuffers/Transaction.hs
deleted file mode 100644
index 2abb5f5..0000000
--- a/src/Network/Haskoin/Store/ProtocolBuffers/Transaction.hs
+++ /dev/null
@@ -1,202 +0,0 @@
-{-# LANGUAGE BangPatterns, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings #-}
-{-# OPTIONS_GHC -w #-}
-module Network.Haskoin.Store.ProtocolBuffers.Transaction (Transaction(..)) where
-import Prelude ((+), (/), (++), (.))
-import qualified Prelude as Prelude'
-import qualified Data.Typeable as Prelude'
-import qualified GHC.Generics as Prelude'
-import qualified Data.Data as Prelude'
-import qualified Text.ProtocolBuffers.Header as P'
-import qualified Network.Haskoin.Store.ProtocolBuffers.BlockRef as ProtocolBuffers (BlockRef)
-import qualified Network.Haskoin.Store.ProtocolBuffers.Input as ProtocolBuffers (Input)
-import qualified Network.Haskoin.Store.ProtocolBuffers.Output as ProtocolBuffers (Output)
-import qualified Network.Haskoin.Store.ProtocolBuffers.TxId as ProtocolBuffers (TxId)
-
-data Transaction = Transaction{txid :: !(ProtocolBuffers.TxId), size :: !(P'.Word32), version :: !(P'.Word32),
- locktime :: !(P'.Word32), block :: !(ProtocolBuffers.BlockRef), deleted :: !(P'.Bool),
- fee :: !(P'.Word64), time :: !(P'.Word64), rbf :: !(P'.Bool),
- inputs :: !(P'.Seq ProtocolBuffers.Input), outputs :: !(P'.Seq ProtocolBuffers.Output),
- weight :: !(P'.Maybe P'.Word32)}
- deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic)
-
-instance P'.Mergeable Transaction where
- mergeAppend (Transaction x'1 x'2 x'3 x'4 x'5 x'6 x'7 x'8 x'9 x'10 x'11 x'12)
- (Transaction y'1 y'2 y'3 y'4 y'5 y'6 y'7 y'8 y'9 y'10 y'11 y'12)
- = Transaction (P'.mergeAppend x'1 y'1) (P'.mergeAppend x'2 y'2) (P'.mergeAppend x'3 y'3) (P'.mergeAppend x'4 y'4)
- (P'.mergeAppend x'5 y'5)
- (P'.mergeAppend x'6 y'6)
- (P'.mergeAppend x'7 y'7)
- (P'.mergeAppend x'8 y'8)
- (P'.mergeAppend x'9 y'9)
- (P'.mergeAppend x'10 y'10)
- (P'.mergeAppend x'11 y'11)
- (P'.mergeAppend x'12 y'12)
-
-instance P'.Default Transaction where
- defaultValue
- = Transaction P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue
- P'.defaultValue
- P'.defaultValue
- P'.defaultValue
- P'.defaultValue
- P'.defaultValue
-
-instance P'.Wire Transaction where
- wireSize ft' self'@(Transaction x'1 x'2 x'3 x'4 x'5 x'6 x'7 x'8 x'9 x'10 x'11 x'12)
- = case ft' of
- 10 -> calc'Size
- 11 -> P'.prependMessageSize calc'Size
- _ -> P'.wireSizeErr ft' self'
- where
- calc'Size
- = (P'.wireSizeReq 1 11 x'1 + P'.wireSizeReq 1 13 x'2 + P'.wireSizeReq 1 13 x'3 + P'.wireSizeReq 1 13 x'4 +
- P'.wireSizeReq 1 11 x'5
- + P'.wireSizeReq 1 8 x'6
- + P'.wireSizeReq 1 4 x'7
- + P'.wireSizeReq 1 4 x'8
- + P'.wireSizeReq 1 8 x'9
- + P'.wireSizeRep 1 11 x'10
- + P'.wireSizeRep 1 11 x'11
- + P'.wireSizeOpt 1 13 x'12)
- wirePutWithSize ft' self'@(Transaction x'1 x'2 x'3 x'4 x'5 x'6 x'7 x'8 x'9 x'10 x'11 x'12)
- = case ft' of
- 10 -> put'Fields
- 11 -> put'FieldsSized
- _ -> P'.wirePutErr ft' self'
- where
- put'Fields
- = P'.sequencePutWithSize
- [P'.wirePutReqWithSize 2 11 x'1, P'.wirePutReqWithSize 8 13 x'2, P'.wirePutReqWithSize 16 13 x'3,
- P'.wirePutReqWithSize 24 13 x'4, P'.wirePutReqWithSize 34 11 x'5, P'.wirePutReqWithSize 40 8 x'6,
- P'.wirePutReqWithSize 48 4 x'7, P'.wirePutReqWithSize 56 4 x'8, P'.wirePutReqWithSize 64 8 x'9,
- P'.wirePutRepWithSize 74 11 x'10, P'.wirePutRepWithSize 82 11 x'11, P'.wirePutOptWithSize 88 13 x'12]
- put'FieldsSized
- = let size' = Prelude'.fst (P'.runPutM put'Fields)
- put'Size
- = do
- P'.putSize size'
- Prelude'.return (P'.size'WireSize size')
- in P'.sequencePutWithSize [put'Size, put'Fields]
- wireGet ft'
- = case ft' of
- 10 -> P'.getBareMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- 11 -> P'.getMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- _ -> P'.wireGetErr ft'
- where
- update'Self wire'Tag old'Self
- = case wire'Tag of
- 2 -> Prelude'.fmap (\ !new'Field -> old'Self{txid = P'.mergeAppend (txid old'Self) (new'Field)}) (P'.wireGet 11)
- 8 -> Prelude'.fmap (\ !new'Field -> old'Self{size = new'Field}) (P'.wireGet 13)
- 16 -> Prelude'.fmap (\ !new'Field -> old'Self{version = new'Field}) (P'.wireGet 13)
- 24 -> Prelude'.fmap (\ !new'Field -> old'Self{locktime = new'Field}) (P'.wireGet 13)
- 34 -> Prelude'.fmap (\ !new'Field -> old'Self{block = P'.mergeAppend (block old'Self) (new'Field)}) (P'.wireGet 11)
- 40 -> Prelude'.fmap (\ !new'Field -> old'Self{deleted = new'Field}) (P'.wireGet 8)
- 48 -> Prelude'.fmap (\ !new'Field -> old'Self{fee = new'Field}) (P'.wireGet 4)
- 56 -> Prelude'.fmap (\ !new'Field -> old'Self{time = new'Field}) (P'.wireGet 4)
- 64 -> Prelude'.fmap (\ !new'Field -> old'Self{rbf = new'Field}) (P'.wireGet 8)
- 74 -> Prelude'.fmap (\ !new'Field -> old'Self{inputs = P'.append (inputs old'Self) new'Field}) (P'.wireGet 11)
- 82 -> Prelude'.fmap (\ !new'Field -> old'Self{outputs = P'.append (outputs old'Self) new'Field}) (P'.wireGet 11)
- 88 -> Prelude'.fmap (\ !new'Field -> old'Self{weight = Prelude'.Just new'Field}) (P'.wireGet 13)
- _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in P'.unknown field'Number wire'Type old'Self
-
-instance P'.MessageAPI msg' (msg' -> Transaction) Transaction where
- getVal m' f' = f' m'
-
-instance P'.GPB Transaction
-
-instance P'.ReflectDescriptor Transaction where
- getMessageInfo _
- = P'.GetMessageInfo (P'.fromDistinctAscList [2, 8, 16, 24, 34, 40, 48, 56, 64])
- (P'.fromDistinctAscList [2, 8, 16, 24, 34, 40, 48, 56, 64, 74, 82, 88])
- reflectDescriptorInfo _
- = Prelude'.read
- "DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.Transaction\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"Transaction\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"Transaction.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Transaction.txid\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Transaction\"], baseName' = FName \"txid\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 2}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.TxId\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"TxId\"}), hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Transaction.size\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Transaction\"], baseName' = FName \"size\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 8}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Transaction.version\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Transaction\"], baseName' = FName \"version\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 16}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Transaction.locktime\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Transaction\"], baseName' = FName \"locktime\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 24}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Transaction.block\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Transaction\"], baseName' = FName \"block\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 34}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.BlockRef\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"BlockRef\"}), hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Transaction.deleted\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Transaction\"], baseName' = FName \"deleted\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 5}, wireTag = WireTag {getWireTag = 40}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 8}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Transaction.fee\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Transaction\"], baseName' = FName \"fee\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 6}, wireTag = WireTag {getWireTag = 48}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 4}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Transaction.time\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Transaction\"], baseName' = FName \"time\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 7}, wireTag = WireTag {getWireTag = 56}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 4}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Transaction.rbf\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Transaction\"], baseName' = FName \"rbf\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 8}, wireTag = WireTag {getWireTag = 64}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 8}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Transaction.inputs\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Transaction\"], baseName' = FName \"inputs\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 9}, wireTag = WireTag {getWireTag = 74}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.Input\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"Input\"}), hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Transaction.outputs\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Transaction\"], baseName' = FName \"outputs\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 10}, wireTag = WireTag {getWireTag = 82}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.Output\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"Output\"}), hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Transaction.weight\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Transaction\"], baseName' = FName \"weight\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 11}, wireTag = WireTag {getWireTag = 88}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False}"
-
-instance P'.TextType Transaction where
- tellT = P'.tellSubMessage
- getT = P'.getSubMessage
-
-instance P'.TextMsg Transaction where
- textPut msg
- = do
- P'.tellT "txid" (txid msg)
- P'.tellT "size" (size msg)
- P'.tellT "version" (version msg)
- P'.tellT "locktime" (locktime msg)
- P'.tellT "block" (block msg)
- P'.tellT "deleted" (deleted msg)
- P'.tellT "fee" (fee msg)
- P'.tellT "time" (time msg)
- P'.tellT "rbf" (rbf msg)
- P'.tellT "inputs" (inputs msg)
- P'.tellT "outputs" (outputs msg)
- P'.tellT "weight" (weight msg)
- textGet
- = do
- mods <- P'.sepEndBy
- (P'.choice
- [parse'txid, parse'size, parse'version, parse'locktime, parse'block, parse'deleted, parse'fee, parse'time,
- parse'rbf, parse'inputs, parse'outputs, parse'weight])
- P'.spaces
- Prelude'.return (Prelude'.foldl (\ v f -> f v) P'.defaultValue mods)
- where
- parse'txid
- = P'.try
- (do
- v <- P'.getT "txid"
- Prelude'.return (\ o -> o{txid = v}))
- parse'size
- = P'.try
- (do
- v <- P'.getT "size"
- Prelude'.return (\ o -> o{size = v}))
- parse'version
- = P'.try
- (do
- v <- P'.getT "version"
- Prelude'.return (\ o -> o{version = v}))
- parse'locktime
- = P'.try
- (do
- v <- P'.getT "locktime"
- Prelude'.return (\ o -> o{locktime = v}))
- parse'block
- = P'.try
- (do
- v <- P'.getT "block"
- Prelude'.return (\ o -> o{block = v}))
- parse'deleted
- = P'.try
- (do
- v <- P'.getT "deleted"
- Prelude'.return (\ o -> o{deleted = v}))
- parse'fee
- = P'.try
- (do
- v <- P'.getT "fee"
- Prelude'.return (\ o -> o{fee = v}))
- parse'time
- = P'.try
- (do
- v <- P'.getT "time"
- Prelude'.return (\ o -> o{time = v}))
- parse'rbf
- = P'.try
- (do
- v <- P'.getT "rbf"
- Prelude'.return (\ o -> o{rbf = v}))
- parse'inputs
- = P'.try
- (do
- v <- P'.getT "inputs"
- Prelude'.return (\ o -> o{inputs = P'.append (inputs o) v}))
- parse'outputs
- = P'.try
- (do
- v <- P'.getT "outputs"
- Prelude'.return (\ o -> o{outputs = P'.append (outputs o) v}))
- parse'weight
- = P'.try
- (do
- v <- P'.getT "weight"
- Prelude'.return (\ o -> o{weight = v})) \ No newline at end of file
diff --git a/src/Network/Haskoin/Store/ProtocolBuffers/TransactionList.hs b/src/Network/Haskoin/Store/ProtocolBuffers/TransactionList.hs
deleted file mode 100644
index b508b43..0000000
--- a/src/Network/Haskoin/Store/ProtocolBuffers/TransactionList.hs
+++ /dev/null
@@ -1,82 +0,0 @@
-{-# LANGUAGE BangPatterns, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings #-}
-{-# OPTIONS_GHC -w #-}
-module Network.Haskoin.Store.ProtocolBuffers.TransactionList (TransactionList(..)) where
-import Prelude ((+), (/), (++), (.))
-import qualified Prelude as Prelude'
-import qualified Data.Typeable as Prelude'
-import qualified GHC.Generics as Prelude'
-import qualified Data.Data as Prelude'
-import qualified Text.ProtocolBuffers.Header as P'
-import qualified Network.Haskoin.Store.ProtocolBuffers.Transaction as ProtocolBuffers (Transaction)
-
-data TransactionList = TransactionList{transaction :: !(P'.Seq ProtocolBuffers.Transaction)}
- deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic)
-
-instance P'.Mergeable TransactionList where
- mergeAppend (TransactionList x'1) (TransactionList y'1) = TransactionList (P'.mergeAppend x'1 y'1)
-
-instance P'.Default TransactionList where
- defaultValue = TransactionList P'.defaultValue
-
-instance P'.Wire TransactionList where
- wireSize ft' self'@(TransactionList x'1)
- = case ft' of
- 10 -> calc'Size
- 11 -> P'.prependMessageSize calc'Size
- _ -> P'.wireSizeErr ft' self'
- where
- calc'Size = (P'.wireSizeRep 1 11 x'1)
- wirePutWithSize ft' self'@(TransactionList x'1)
- = case ft' of
- 10 -> put'Fields
- 11 -> put'FieldsSized
- _ -> P'.wirePutErr ft' self'
- where
- put'Fields = P'.sequencePutWithSize [P'.wirePutRepWithSize 2 11 x'1]
- put'FieldsSized
- = let size' = Prelude'.fst (P'.runPutM put'Fields)
- put'Size
- = do
- P'.putSize size'
- Prelude'.return (P'.size'WireSize size')
- in P'.sequencePutWithSize [put'Size, put'Fields]
- wireGet ft'
- = case ft' of
- 10 -> P'.getBareMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- 11 -> P'.getMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- _ -> P'.wireGetErr ft'
- where
- update'Self wire'Tag old'Self
- = case wire'Tag of
- 2 -> Prelude'.fmap (\ !new'Field -> old'Self{transaction = P'.append (transaction old'Self) new'Field}) (P'.wireGet 11)
- _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in P'.unknown field'Number wire'Type old'Self
-
-instance P'.MessageAPI msg' (msg' -> TransactionList) TransactionList where
- getVal m' f' = f' m'
-
-instance P'.GPB TransactionList
-
-instance P'.ReflectDescriptor TransactionList where
- getMessageInfo _ = P'.GetMessageInfo (P'.fromDistinctAscList []) (P'.fromDistinctAscList [2])
- reflectDescriptorInfo _
- = Prelude'.read
- "DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.TransactionList\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"TransactionList\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"TransactionList.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.TransactionList.transaction\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"TransactionList\"], baseName' = FName \"transaction\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 2}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.Transaction\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"Transaction\"}), hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False}"
-
-instance P'.TextType TransactionList where
- tellT = P'.tellSubMessage
- getT = P'.getSubMessage
-
-instance P'.TextMsg TransactionList where
- textPut msg
- = do
- P'.tellT "transaction" (transaction msg)
- textGet
- = do
- mods <- P'.sepEndBy (P'.choice [parse'transaction]) P'.spaces
- Prelude'.return (Prelude'.foldl (\ v f -> f v) P'.defaultValue mods)
- where
- parse'transaction
- = P'.try
- (do
- v <- P'.getT "transaction"
- Prelude'.return (\ o -> o{transaction = P'.append (transaction o) v})) \ No newline at end of file
diff --git a/src/Network/Haskoin/Store/ProtocolBuffers/TxAfterHeight.hs b/src/Network/Haskoin/Store/ProtocolBuffers/TxAfterHeight.hs
deleted file mode 100644
index e8e6bf4..0000000
--- a/src/Network/Haskoin/Store/ProtocolBuffers/TxAfterHeight.hs
+++ /dev/null
@@ -1,81 +0,0 @@
-{-# LANGUAGE BangPatterns, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings #-}
-{-# OPTIONS_GHC -w #-}
-module Network.Haskoin.Store.ProtocolBuffers.TxAfterHeight (TxAfterHeight(..)) where
-import Prelude ((+), (/), (++), (.))
-import qualified Prelude as Prelude'
-import qualified Data.Typeable as Prelude'
-import qualified GHC.Generics as Prelude'
-import qualified Data.Data as Prelude'
-import qualified Text.ProtocolBuffers.Header as P'
-
-data TxAfterHeight = TxAfterHeight{result :: !(P'.Maybe P'.Bool)}
- deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic)
-
-instance P'.Mergeable TxAfterHeight where
- mergeAppend (TxAfterHeight x'1) (TxAfterHeight y'1) = TxAfterHeight (P'.mergeAppend x'1 y'1)
-
-instance P'.Default TxAfterHeight where
- defaultValue = TxAfterHeight P'.defaultValue
-
-instance P'.Wire TxAfterHeight where
- wireSize ft' self'@(TxAfterHeight x'1)
- = case ft' of
- 10 -> calc'Size
- 11 -> P'.prependMessageSize calc'Size
- _ -> P'.wireSizeErr ft' self'
- where
- calc'Size = (P'.wireSizeOpt 1 8 x'1)
- wirePutWithSize ft' self'@(TxAfterHeight x'1)
- = case ft' of
- 10 -> put'Fields
- 11 -> put'FieldsSized
- _ -> P'.wirePutErr ft' self'
- where
- put'Fields = P'.sequencePutWithSize [P'.wirePutOptWithSize 0 8 x'1]
- put'FieldsSized
- = let size' = Prelude'.fst (P'.runPutM put'Fields)
- put'Size
- = do
- P'.putSize size'
- Prelude'.return (P'.size'WireSize size')
- in P'.sequencePutWithSize [put'Size, put'Fields]
- wireGet ft'
- = case ft' of
- 10 -> P'.getBareMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- 11 -> P'.getMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- _ -> P'.wireGetErr ft'
- where
- update'Self wire'Tag old'Self
- = case wire'Tag of
- 0 -> Prelude'.fmap (\ !new'Field -> old'Self{result = Prelude'.Just new'Field}) (P'.wireGet 8)
- _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in P'.unknown field'Number wire'Type old'Self
-
-instance P'.MessageAPI msg' (msg' -> TxAfterHeight) TxAfterHeight where
- getVal m' f' = f' m'
-
-instance P'.GPB TxAfterHeight
-
-instance P'.ReflectDescriptor TxAfterHeight where
- getMessageInfo _ = P'.GetMessageInfo (P'.fromDistinctAscList []) (P'.fromDistinctAscList [0])
- reflectDescriptorInfo _
- = Prelude'.read
- "DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.TxAfterHeight\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"TxAfterHeight\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"TxAfterHeight.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.TxAfterHeight.result\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"TxAfterHeight\"], baseName' = FName \"result\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 0}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 8}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False}"
-
-instance P'.TextType TxAfterHeight where
- tellT = P'.tellSubMessage
- getT = P'.getSubMessage
-
-instance P'.TextMsg TxAfterHeight where
- textPut msg
- = do
- P'.tellT "result" (result msg)
- textGet
- = do
- mods <- P'.sepEndBy (P'.choice [parse'result]) P'.spaces
- Prelude'.return (Prelude'.foldl (\ v f -> f v) P'.defaultValue mods)
- where
- parse'result
- = P'.try
- (do
- v <- P'.getT "result"
- Prelude'.return (\ o -> o{result = v})) \ No newline at end of file
diff --git a/src/Network/Haskoin/Store/ProtocolBuffers/TxId.hs b/src/Network/Haskoin/Store/ProtocolBuffers/TxId.hs
deleted file mode 100644
index cc16b70..0000000
--- a/src/Network/Haskoin/Store/ProtocolBuffers/TxId.hs
+++ /dev/null
@@ -1,81 +0,0 @@
-{-# LANGUAGE BangPatterns, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings #-}
-{-# OPTIONS_GHC -w #-}
-module Network.Haskoin.Store.ProtocolBuffers.TxId (TxId(..)) where
-import Prelude ((+), (/), (++), (.))
-import qualified Prelude as Prelude'
-import qualified Data.Typeable as Prelude'
-import qualified GHC.Generics as Prelude'
-import qualified Data.Data as Prelude'
-import qualified Text.ProtocolBuffers.Header as P'
-
-data TxId = TxId{txid :: !(P'.ByteString)}
- deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic)
-
-instance P'.Mergeable TxId where
- mergeAppend (TxId x'1) (TxId y'1) = TxId (P'.mergeAppend x'1 y'1)
-
-instance P'.Default TxId where
- defaultValue = TxId P'.defaultValue
-
-instance P'.Wire TxId where
- wireSize ft' self'@(TxId x'1)
- = case ft' of
- 10 -> calc'Size
- 11 -> P'.prependMessageSize calc'Size
- _ -> P'.wireSizeErr ft' self'
- where
- calc'Size = (P'.wireSizeReq 1 12 x'1)
- wirePutWithSize ft' self'@(TxId x'1)
- = case ft' of
- 10 -> put'Fields
- 11 -> put'FieldsSized
- _ -> P'.wirePutErr ft' self'
- where
- put'Fields = P'.sequencePutWithSize [P'.wirePutReqWithSize 2 12 x'1]
- put'FieldsSized
- = let size' = Prelude'.fst (P'.runPutM put'Fields)
- put'Size
- = do
- P'.putSize size'
- Prelude'.return (P'.size'WireSize size')
- in P'.sequencePutWithSize [put'Size, put'Fields]
- wireGet ft'
- = case ft' of
- 10 -> P'.getBareMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- 11 -> P'.getMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- _ -> P'.wireGetErr ft'
- where
- update'Self wire'Tag old'Self
- = case wire'Tag of
- 2 -> Prelude'.fmap (\ !new'Field -> old'Self{txid = new'Field}) (P'.wireGet 12)
- _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in P'.unknown field'Number wire'Type old'Self
-
-instance P'.MessageAPI msg' (msg' -> TxId) TxId where
- getVal m' f' = f' m'
-
-instance P'.GPB TxId
-
-instance P'.ReflectDescriptor TxId where
- getMessageInfo _ = P'.GetMessageInfo (P'.fromDistinctAscList [2]) (P'.fromDistinctAscList [2])
- reflectDescriptorInfo _
- = Prelude'.read
- "DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.TxId\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"TxId\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"TxId.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.TxId.txid\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"TxId\"], baseName' = FName \"txid\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 2}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 12}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False}"
-
-instance P'.TextType TxId where
- tellT = P'.tellSubMessage
- getT = P'.getSubMessage
-
-instance P'.TextMsg TxId where
- textPut msg
- = do
- P'.tellT "txid" (txid msg)
- textGet
- = do
- mods <- P'.sepEndBy (P'.choice [parse'txid]) P'.spaces
- Prelude'.return (Prelude'.foldl (\ v f -> f v) P'.defaultValue mods)
- where
- parse'txid
- = P'.try
- (do
- v <- P'.getT "txid"
- Prelude'.return (\ o -> o{txid = v})) \ No newline at end of file
diff --git a/src/Network/Haskoin/Store/ProtocolBuffers/TxIdList.hs b/src/Network/Haskoin/Store/ProtocolBuffers/TxIdList.hs
deleted file mode 100644
index 716078c..0000000
--- a/src/Network/Haskoin/Store/ProtocolBuffers/TxIdList.hs
+++ /dev/null
@@ -1,82 +0,0 @@
-{-# LANGUAGE BangPatterns, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings #-}
-{-# OPTIONS_GHC -w #-}
-module Network.Haskoin.Store.ProtocolBuffers.TxIdList (TxIdList(..)) where
-import Prelude ((+), (/), (++), (.))
-import qualified Prelude as Prelude'
-import qualified Data.Typeable as Prelude'
-import qualified GHC.Generics as Prelude'
-import qualified Data.Data as Prelude'
-import qualified Text.ProtocolBuffers.Header as P'
-import qualified Network.Haskoin.Store.ProtocolBuffers.TxId as ProtocolBuffers (TxId)
-
-data TxIdList = TxIdList{txid :: !(P'.Seq ProtocolBuffers.TxId)}
- deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic)
-
-instance P'.Mergeable TxIdList where
- mergeAppend (TxIdList x'1) (TxIdList y'1) = TxIdList (P'.mergeAppend x'1 y'1)
-
-instance P'.Default TxIdList where
- defaultValue = TxIdList P'.defaultValue
-
-instance P'.Wire TxIdList where
- wireSize ft' self'@(TxIdList x'1)
- = case ft' of
- 10 -> calc'Size
- 11 -> P'.prependMessageSize calc'Size
- _ -> P'.wireSizeErr ft' self'
- where
- calc'Size = (P'.wireSizeRep 1 11 x'1)
- wirePutWithSize ft' self'@(TxIdList x'1)
- = case ft' of
- 10 -> put'Fields
- 11 -> put'FieldsSized
- _ -> P'.wirePutErr ft' self'
- where
- put'Fields = P'.sequencePutWithSize [P'.wirePutRepWithSize 2 11 x'1]
- put'FieldsSized
- = let size' = Prelude'.fst (P'.runPutM put'Fields)
- put'Size
- = do
- P'.putSize size'
- Prelude'.return (P'.size'WireSize size')
- in P'.sequencePutWithSize [put'Size, put'Fields]
- wireGet ft'
- = case ft' of
- 10 -> P'.getBareMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- 11 -> P'.getMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- _ -> P'.wireGetErr ft'
- where
- update'Self wire'Tag old'Self
- = case wire'Tag of
- 2 -> Prelude'.fmap (\ !new'Field -> old'Self{txid = P'.append (txid old'Self) new'Field}) (P'.wireGet 11)
- _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in P'.unknown field'Number wire'Type old'Self
-
-instance P'.MessageAPI msg' (msg' -> TxIdList) TxIdList where
- getVal m' f' = f' m'
-
-instance P'.GPB TxIdList
-
-instance P'.ReflectDescriptor TxIdList where
- getMessageInfo _ = P'.GetMessageInfo (P'.fromDistinctAscList []) (P'.fromDistinctAscList [2])
- reflectDescriptorInfo _
- = Prelude'.read
- "DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.TxIdList\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"TxIdList\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"TxIdList.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.TxIdList.txid\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"TxIdList\"], baseName' = FName \"txid\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 2}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.TxId\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"TxId\"}), hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False}"
-
-instance P'.TextType TxIdList where
- tellT = P'.tellSubMessage
- getT = P'.getSubMessage
-
-instance P'.TextMsg TxIdList where
- textPut msg
- = do
- P'.tellT "txid" (txid msg)
- textGet
- = do
- mods <- P'.sepEndBy (P'.choice [parse'txid]) P'.spaces
- Prelude'.return (Prelude'.foldl (\ v f -> f v) P'.defaultValue mods)
- where
- parse'txid
- = P'.try
- (do
- v <- P'.getT "txid"
- Prelude'.return (\ o -> o{txid = P'.append (txid o) v})) \ No newline at end of file
diff --git a/src/Network/Haskoin/Store/ProtocolBuffers/Unspent.hs b/src/Network/Haskoin/Store/ProtocolBuffers/Unspent.hs
deleted file mode 100644
index 174712f..0000000
--- a/src/Network/Haskoin/Store/ProtocolBuffers/Unspent.hs
+++ /dev/null
@@ -1,128 +0,0 @@
-{-# LANGUAGE BangPatterns, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings #-}
-{-# OPTIONS_GHC -w #-}
-module Network.Haskoin.Store.ProtocolBuffers.Unspent (Unspent(..)) where
-import Prelude ((+), (/), (++), (.))
-import qualified Prelude as Prelude'
-import qualified Data.Typeable as Prelude'
-import qualified GHC.Generics as Prelude'
-import qualified Data.Data as Prelude'
-import qualified Text.ProtocolBuffers.Header as P'
-import qualified Network.Haskoin.Store.ProtocolBuffers.BlockRef as ProtocolBuffers (BlockRef)
-import qualified Network.Haskoin.Store.ProtocolBuffers.TxId as ProtocolBuffers (TxId)
-
-data Unspent = Unspent{txid :: !(ProtocolBuffers.TxId), index :: !(P'.Word32), pkscript :: !(P'.ByteString), value :: !(P'.Word64),
- block :: !(ProtocolBuffers.BlockRef), address :: !(P'.Maybe P'.Utf8)}
- deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic)
-
-instance P'.Mergeable Unspent where
- mergeAppend (Unspent x'1 x'2 x'3 x'4 x'5 x'6) (Unspent y'1 y'2 y'3 y'4 y'5 y'6)
- = Unspent (P'.mergeAppend x'1 y'1) (P'.mergeAppend x'2 y'2) (P'.mergeAppend x'3 y'3) (P'.mergeAppend x'4 y'4)
- (P'.mergeAppend x'5 y'5)
- (P'.mergeAppend x'6 y'6)
-
-instance P'.Default Unspent where
- defaultValue = Unspent P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue
-
-instance P'.Wire Unspent where
- wireSize ft' self'@(Unspent x'1 x'2 x'3 x'4 x'5 x'6)
- = case ft' of
- 10 -> calc'Size
- 11 -> P'.prependMessageSize calc'Size
- _ -> P'.wireSizeErr ft' self'
- where
- calc'Size
- = (P'.wireSizeReq 1 11 x'1 + P'.wireSizeReq 1 13 x'2 + P'.wireSizeReq 1 12 x'3 + P'.wireSizeReq 1 4 x'4 +
- P'.wireSizeReq 1 11 x'5
- + P'.wireSizeOpt 1 9 x'6)
- wirePutWithSize ft' self'@(Unspent x'1 x'2 x'3 x'4 x'5 x'6)
- = case ft' of
- 10 -> put'Fields
- 11 -> put'FieldsSized
- _ -> P'.wirePutErr ft' self'
- where
- put'Fields
- = P'.sequencePutWithSize
- [P'.wirePutReqWithSize 2 11 x'1, P'.wirePutReqWithSize 8 13 x'2, P'.wirePutReqWithSize 18 12 x'3,
- P'.wirePutReqWithSize 24 4 x'4, P'.wirePutReqWithSize 34 11 x'5, P'.wirePutOptWithSize 42 9 x'6]
- put'FieldsSized
- = let size' = Prelude'.fst (P'.runPutM put'Fields)
- put'Size
- = do
- P'.putSize size'
- Prelude'.return (P'.size'WireSize size')
- in P'.sequencePutWithSize [put'Size, put'Fields]
- wireGet ft'
- = case ft' of
- 10 -> P'.getBareMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- 11 -> P'.getMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- _ -> P'.wireGetErr ft'
- where
- update'Self wire'Tag old'Self
- = case wire'Tag of
- 2 -> Prelude'.fmap (\ !new'Field -> old'Self{txid = P'.mergeAppend (txid old'Self) (new'Field)}) (P'.wireGet 11)
- 8 -> Prelude'.fmap (\ !new'Field -> old'Self{index = new'Field}) (P'.wireGet 13)
- 18 -> Prelude'.fmap (\ !new'Field -> old'Self{pkscript = new'Field}) (P'.wireGet 12)
- 24 -> Prelude'.fmap (\ !new'Field -> old'Self{value = new'Field}) (P'.wireGet 4)
- 34 -> Prelude'.fmap (\ !new'Field -> old'Self{block = P'.mergeAppend (block old'Self) (new'Field)}) (P'.wireGet 11)
- 42 -> Prelude'.fmap (\ !new'Field -> old'Self{address = Prelude'.Just new'Field}) (P'.wireGet 9)
- _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in P'.unknown field'Number wire'Type old'Self
-
-instance P'.MessageAPI msg' (msg' -> Unspent) Unspent where
- getVal m' f' = f' m'
-
-instance P'.GPB Unspent
-
-instance P'.ReflectDescriptor Unspent where
- getMessageInfo _ = P'.GetMessageInfo (P'.fromDistinctAscList [2, 8, 18, 24, 34]) (P'.fromDistinctAscList [2, 8, 18, 24, 34, 42])
- reflectDescriptorInfo _
- = Prelude'.read
- "DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.Unspent\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"Unspent\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"Unspent.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Unspent.txid\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Unspent\"], baseName' = FName \"txid\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 2}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.TxId\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"TxId\"}), hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Unspent.index\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Unspent\"], baseName' = FName \"index\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 8}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Unspent.pkscript\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Unspent\"], baseName' = FName \"pkscript\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 18}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 12}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Unspent.value\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Unspent\"], baseName' = FName \"value\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 24}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 4}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Unspent.block\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Unspent\"], baseName' = FName \"block\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 34}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.BlockRef\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"BlockRef\"}), hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.Unspent.address\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"Unspent\"], baseName' = FName \"address\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 5}, wireTag = WireTag {getWireTag = 42}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 9}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False}"
-
-instance P'.TextType Unspent where
- tellT = P'.tellSubMessage
- getT = P'.getSubMessage
-
-instance P'.TextMsg Unspent where
- textPut msg
- = do
- P'.tellT "txid" (txid msg)
- P'.tellT "index" (index msg)
- P'.tellT "pkscript" (pkscript msg)
- P'.tellT "value" (value msg)
- P'.tellT "block" (block msg)
- P'.tellT "address" (address msg)
- textGet
- = do
- mods <- P'.sepEndBy (P'.choice [parse'txid, parse'index, parse'pkscript, parse'value, parse'block, parse'address]) P'.spaces
- Prelude'.return (Prelude'.foldl (\ v f -> f v) P'.defaultValue mods)
- where
- parse'txid
- = P'.try
- (do
- v <- P'.getT "txid"
- Prelude'.return (\ o -> o{txid = v}))
- parse'index
- = P'.try
- (do
- v <- P'.getT "index"
- Prelude'.return (\ o -> o{index = v}))
- parse'pkscript
- = P'.try
- (do
- v <- P'.getT "pkscript"
- Prelude'.return (\ o -> o{pkscript = v}))
- parse'value
- = P'.try
- (do
- v <- P'.getT "value"
- Prelude'.return (\ o -> o{value = v}))
- parse'block
- = P'.try
- (do
- v <- P'.getT "block"
- Prelude'.return (\ o -> o{block = v}))
- parse'address
- = P'.try
- (do
- v <- P'.getT "address"
- Prelude'.return (\ o -> o{address = v})) \ No newline at end of file
diff --git a/src/Network/Haskoin/Store/ProtocolBuffers/UnspentList.hs b/src/Network/Haskoin/Store/ProtocolBuffers/UnspentList.hs
deleted file mode 100644
index 915dc6a..0000000
--- a/src/Network/Haskoin/Store/ProtocolBuffers/UnspentList.hs
+++ /dev/null
@@ -1,82 +0,0 @@
-{-# LANGUAGE BangPatterns, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings #-}
-{-# OPTIONS_GHC -w #-}
-module Network.Haskoin.Store.ProtocolBuffers.UnspentList (UnspentList(..)) where
-import Prelude ((+), (/), (++), (.))
-import qualified Prelude as Prelude'
-import qualified Data.Typeable as Prelude'
-import qualified GHC.Generics as Prelude'
-import qualified Data.Data as Prelude'
-import qualified Text.ProtocolBuffers.Header as P'
-import qualified Network.Haskoin.Store.ProtocolBuffers.Unspent as ProtocolBuffers (Unspent)
-
-data UnspentList = UnspentList{unspent :: !(P'.Seq ProtocolBuffers.Unspent)}
- deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic)
-
-instance P'.Mergeable UnspentList where
- mergeAppend (UnspentList x'1) (UnspentList y'1) = UnspentList (P'.mergeAppend x'1 y'1)
-
-instance P'.Default UnspentList where
- defaultValue = UnspentList P'.defaultValue
-
-instance P'.Wire UnspentList where
- wireSize ft' self'@(UnspentList x'1)
- = case ft' of
- 10 -> calc'Size
- 11 -> P'.prependMessageSize calc'Size
- _ -> P'.wireSizeErr ft' self'
- where
- calc'Size = (P'.wireSizeRep 1 11 x'1)
- wirePutWithSize ft' self'@(UnspentList x'1)
- = case ft' of
- 10 -> put'Fields
- 11 -> put'FieldsSized
- _ -> P'.wirePutErr ft' self'
- where
- put'Fields = P'.sequencePutWithSize [P'.wirePutRepWithSize 2 11 x'1]
- put'FieldsSized
- = let size' = Prelude'.fst (P'.runPutM put'Fields)
- put'Size
- = do
- P'.putSize size'
- Prelude'.return (P'.size'WireSize size')
- in P'.sequencePutWithSize [put'Size, put'Fields]
- wireGet ft'
- = case ft' of
- 10 -> P'.getBareMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- 11 -> P'.getMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- _ -> P'.wireGetErr ft'
- where
- update'Self wire'Tag old'Self
- = case wire'Tag of
- 2 -> Prelude'.fmap (\ !new'Field -> old'Self{unspent = P'.append (unspent old'Self) new'Field}) (P'.wireGet 11)
- _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in P'.unknown field'Number wire'Type old'Self
-
-instance P'.MessageAPI msg' (msg' -> UnspentList) UnspentList where
- getVal m' f' = f' m'
-
-instance P'.GPB UnspentList
-
-instance P'.ReflectDescriptor UnspentList where
- getMessageInfo _ = P'.GetMessageInfo (P'.fromDistinctAscList []) (P'.fromDistinctAscList [2])
- reflectDescriptorInfo _
- = Prelude'.read
- "DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.UnspentList\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"UnspentList\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"UnspentList.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.UnspentList.unspent\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"UnspentList\"], baseName' = FName \"unspent\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 2}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.Unspent\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"Unspent\"}), hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False}"
-
-instance P'.TextType UnspentList where
- tellT = P'.tellSubMessage
- getT = P'.getSubMessage
-
-instance P'.TextMsg UnspentList where
- textPut msg
- = do
- P'.tellT "unspent" (unspent msg)
- textGet
- = do
- mods <- P'.sepEndBy (P'.choice [parse'unspent]) P'.spaces
- Prelude'.return (Prelude'.foldl (\ v f -> f v) P'.defaultValue mods)
- where
- parse'unspent
- = P'.try
- (do
- v <- P'.getT "unspent"
- Prelude'.return (\ o -> o{unspent = P'.append (unspent o) v})) \ No newline at end of file
diff --git a/src/Network/Haskoin/Store/ProtocolBuffers/XPubBalance.hs b/src/Network/Haskoin/Store/ProtocolBuffers/XPubBalance.hs
deleted file mode 100644
index f61f580..0000000
--- a/src/Network/Haskoin/Store/ProtocolBuffers/XPubBalance.hs
+++ /dev/null
@@ -1,90 +0,0 @@
-{-# LANGUAGE BangPatterns, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings #-}
-{-# OPTIONS_GHC -w #-}
-module Network.Haskoin.Store.ProtocolBuffers.XPubBalance (XPubBalance(..)) where
-import Prelude ((+), (/), (++), (.))
-import qualified Prelude as Prelude'
-import qualified Data.Typeable as Prelude'
-import qualified GHC.Generics as Prelude'
-import qualified Data.Data as Prelude'
-import qualified Text.ProtocolBuffers.Header as P'
-import qualified Network.Haskoin.Store.ProtocolBuffers.Balance as ProtocolBuffers (Balance)
-
-data XPubBalance = XPubBalance{path :: !(P'.Seq P'.Word32), balance :: !(ProtocolBuffers.Balance)}
- deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic)
-
-instance P'.Mergeable XPubBalance where
- mergeAppend (XPubBalance x'1 x'2) (XPubBalance y'1 y'2) = XPubBalance (P'.mergeAppend x'1 y'1) (P'.mergeAppend x'2 y'2)
-
-instance P'.Default XPubBalance where
- defaultValue = XPubBalance P'.defaultValue P'.defaultValue
-
-instance P'.Wire XPubBalance where
- wireSize ft' self'@(XPubBalance x'1 x'2)
- = case ft' of
- 10 -> calc'Size
- 11 -> P'.prependMessageSize calc'Size
- _ -> P'.wireSizeErr ft' self'
- where
- calc'Size = (P'.wireSizePacked 1 13 x'1 + P'.wireSizeReq 1 11 x'2)
- wirePutWithSize ft' self'@(XPubBalance x'1 x'2)
- = case ft' of
- 10 -> put'Fields
- 11 -> put'FieldsSized
- _ -> P'.wirePutErr ft' self'
- where
- put'Fields = P'.sequencePutWithSize [P'.wirePutPackedWithSize 2 13 x'1, P'.wirePutReqWithSize 10 11 x'2]
- put'FieldsSized
- = let size' = Prelude'.fst (P'.runPutM put'Fields)
- put'Size
- = do
- P'.putSize size'
- Prelude'.return (P'.size'WireSize size')
- in P'.sequencePutWithSize [put'Size, put'Fields]
- wireGet ft'
- = case ft' of
- 10 -> P'.getBareMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- 11 -> P'.getMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- _ -> P'.wireGetErr ft'
- where
- update'Self wire'Tag old'Self
- = case wire'Tag of
- 0 -> Prelude'.fmap (\ !new'Field -> old'Self{path = P'.append (path old'Self) new'Field}) (P'.wireGet 13)
- 2 -> Prelude'.fmap (\ !new'Field -> old'Self{path = P'.mergeAppend (path old'Self) new'Field}) (P'.wireGetPacked 13)
- 10 -> Prelude'.fmap (\ !new'Field -> old'Self{balance = P'.mergeAppend (balance old'Self) (new'Field)}) (P'.wireGet 11)
- _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in P'.unknown field'Number wire'Type old'Self
-
-instance P'.MessageAPI msg' (msg' -> XPubBalance) XPubBalance where
- getVal m' f' = f' m'
-
-instance P'.GPB XPubBalance
-
-instance P'.ReflectDescriptor XPubBalance where
- getMessageInfo _ = P'.GetMessageInfo (P'.fromDistinctAscList [10]) (P'.fromDistinctAscList [0, 2, 10])
- reflectDescriptorInfo _
- = Prelude'.read
- "DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.XPubBalance\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"XPubBalance\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"XPubBalance.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.XPubBalance.path\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"XPubBalance\"], baseName' = FName \"path\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 2}, packedTag = Just (WireTag {getWireTag = 0},WireTag {getWireTag = 2}), wireTagLength = 1, isPacked = True, isRequired = False, canRepeat = True, mightPack = True, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.XPubBalance.balance\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"XPubBalance\"], baseName' = FName \"balance\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 10}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.Balance\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"Balance\"}), hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False}"
-
-instance P'.TextType XPubBalance where
- tellT = P'.tellSubMessage
- getT = P'.getSubMessage
-
-instance P'.TextMsg XPubBalance where
- textPut msg
- = do
- P'.tellT "path" (path msg)
- P'.tellT "balance" (balance msg)
- textGet
- = do
- mods <- P'.sepEndBy (P'.choice [parse'path, parse'balance]) P'.spaces
- Prelude'.return (Prelude'.foldl (\ v f -> f v) P'.defaultValue mods)
- where
- parse'path
- = P'.try
- (do
- v <- P'.getT "path"
- Prelude'.return (\ o -> o{path = P'.append (path o) v}))
- parse'balance
- = P'.try
- (do
- v <- P'.getT "balance"
- Prelude'.return (\ o -> o{balance = v})) \ No newline at end of file
diff --git a/src/Network/Haskoin/Store/ProtocolBuffers/XPubBalanceList.hs b/src/Network/Haskoin/Store/ProtocolBuffers/XPubBalanceList.hs
deleted file mode 100644
index a320f32..0000000
--- a/src/Network/Haskoin/Store/ProtocolBuffers/XPubBalanceList.hs
+++ /dev/null
@@ -1,82 +0,0 @@
-{-# LANGUAGE BangPatterns, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings #-}
-{-# OPTIONS_GHC -w #-}
-module Network.Haskoin.Store.ProtocolBuffers.XPubBalanceList (XPubBalanceList(..)) where
-import Prelude ((+), (/), (++), (.))
-import qualified Prelude as Prelude'
-import qualified Data.Typeable as Prelude'
-import qualified GHC.Generics as Prelude'
-import qualified Data.Data as Prelude'
-import qualified Text.ProtocolBuffers.Header as P'
-import qualified Network.Haskoin.Store.ProtocolBuffers.XPubBalance as ProtocolBuffers (XPubBalance)
-
-data XPubBalanceList = XPubBalanceList{xpubbalance :: !(P'.Seq ProtocolBuffers.XPubBalance)}
- deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic)
-
-instance P'.Mergeable XPubBalanceList where
- mergeAppend (XPubBalanceList x'1) (XPubBalanceList y'1) = XPubBalanceList (P'.mergeAppend x'1 y'1)
-
-instance P'.Default XPubBalanceList where
- defaultValue = XPubBalanceList P'.defaultValue
-
-instance P'.Wire XPubBalanceList where
- wireSize ft' self'@(XPubBalanceList x'1)
- = case ft' of
- 10 -> calc'Size
- 11 -> P'.prependMessageSize calc'Size
- _ -> P'.wireSizeErr ft' self'
- where
- calc'Size = (P'.wireSizeRep 1 11 x'1)
- wirePutWithSize ft' self'@(XPubBalanceList x'1)
- = case ft' of
- 10 -> put'Fields
- 11 -> put'FieldsSized
- _ -> P'.wirePutErr ft' self'
- where
- put'Fields = P'.sequencePutWithSize [P'.wirePutRepWithSize 2 11 x'1]
- put'FieldsSized
- = let size' = Prelude'.fst (P'.runPutM put'Fields)
- put'Size
- = do
- P'.putSize size'
- Prelude'.return (P'.size'WireSize size')
- in P'.sequencePutWithSize [put'Size, put'Fields]
- wireGet ft'
- = case ft' of
- 10 -> P'.getBareMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- 11 -> P'.getMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- _ -> P'.wireGetErr ft'
- where
- update'Self wire'Tag old'Self
- = case wire'Tag of
- 2 -> Prelude'.fmap (\ !new'Field -> old'Self{xpubbalance = P'.append (xpubbalance old'Self) new'Field}) (P'.wireGet 11)
- _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in P'.unknown field'Number wire'Type old'Self
-
-instance P'.MessageAPI msg' (msg' -> XPubBalanceList) XPubBalanceList where
- getVal m' f' = f' m'
-
-instance P'.GPB XPubBalanceList
-
-instance P'.ReflectDescriptor XPubBalanceList where
- getMessageInfo _ = P'.GetMessageInfo (P'.fromDistinctAscList []) (P'.fromDistinctAscList [2])
- reflectDescriptorInfo _
- = Prelude'.read
- "DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.XPubBalanceList\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"XPubBalanceList\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"XPubBalanceList.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.XPubBalanceList.xpubbalance\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"XPubBalanceList\"], baseName' = FName \"xpubbalance\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 2}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.XPubBalance\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"XPubBalance\"}), hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False}"
-
-instance P'.TextType XPubBalanceList where
- tellT = P'.tellSubMessage
- getT = P'.getSubMessage
-
-instance P'.TextMsg XPubBalanceList where
- textPut msg
- = do
- P'.tellT "xpubbalance" (xpubbalance msg)
- textGet
- = do
- mods <- P'.sepEndBy (P'.choice [parse'xpubbalance]) P'.spaces
- Prelude'.return (Prelude'.foldl (\ v f -> f v) P'.defaultValue mods)
- where
- parse'xpubbalance
- = P'.try
- (do
- v <- P'.getT "xpubbalance"
- Prelude'.return (\ o -> o{xpubbalance = P'.append (xpubbalance o) v})) \ No newline at end of file
diff --git a/src/Network/Haskoin/Store/ProtocolBuffers/XPubUnspent.hs b/src/Network/Haskoin/Store/ProtocolBuffers/XPubUnspent.hs
deleted file mode 100644
index 12bf4ba..0000000
--- a/src/Network/Haskoin/Store/ProtocolBuffers/XPubUnspent.hs
+++ /dev/null
@@ -1,90 +0,0 @@
-{-# LANGUAGE BangPatterns, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings #-}
-{-# OPTIONS_GHC -w #-}
-module Network.Haskoin.Store.ProtocolBuffers.XPubUnspent (XPubUnspent(..)) where
-import Prelude ((+), (/), (++), (.))
-import qualified Prelude as Prelude'
-import qualified Data.Typeable as Prelude'
-import qualified GHC.Generics as Prelude'
-import qualified Data.Data as Prelude'
-import qualified Text.ProtocolBuffers.Header as P'
-import qualified Network.Haskoin.Store.ProtocolBuffers.Unspent as ProtocolBuffers (Unspent)
-
-data XPubUnspent = XPubUnspent{path :: !(P'.Seq P'.Word32), unspent :: !(ProtocolBuffers.Unspent)}
- deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic)
-
-instance P'.Mergeable XPubUnspent where
- mergeAppend (XPubUnspent x'1 x'2) (XPubUnspent y'1 y'2) = XPubUnspent (P'.mergeAppend x'1 y'1) (P'.mergeAppend x'2 y'2)
-
-instance P'.Default XPubUnspent where
- defaultValue = XPubUnspent P'.defaultValue P'.defaultValue
-
-instance P'.Wire XPubUnspent where
- wireSize ft' self'@(XPubUnspent x'1 x'2)
- = case ft' of
- 10 -> calc'Size
- 11 -> P'.prependMessageSize calc'Size
- _ -> P'.wireSizeErr ft' self'
- where
- calc'Size = (P'.wireSizePacked 1 13 x'1 + P'.wireSizeReq 1 11 x'2)
- wirePutWithSize ft' self'@(XPubUnspent x'1 x'2)
- = case ft' of
- 10 -> put'Fields
- 11 -> put'FieldsSized
- _ -> P'.wirePutErr ft' self'
- where
- put'Fields = P'.sequencePutWithSize [P'.wirePutPackedWithSize 2 13 x'1, P'.wirePutReqWithSize 10 11 x'2]
- put'FieldsSized
- = let size' = Prelude'.fst (P'.runPutM put'Fields)
- put'Size
- = do
- P'.putSize size'
- Prelude'.return (P'.size'WireSize size')
- in P'.sequencePutWithSize [put'Size, put'Fields]
- wireGet ft'
- = case ft' of
- 10 -> P'.getBareMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- 11 -> P'.getMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- _ -> P'.wireGetErr ft'
- where
- update'Self wire'Tag old'Self
- = case wire'Tag of
- 0 -> Prelude'.fmap (\ !new'Field -> old'Self{path = P'.append (path old'Self) new'Field}) (P'.wireGet 13)
- 2 -> Prelude'.fmap (\ !new'Field -> old'Self{path = P'.mergeAppend (path old'Self) new'Field}) (P'.wireGetPacked 13)
- 10 -> Prelude'.fmap (\ !new'Field -> old'Self{unspent = P'.mergeAppend (unspent old'Self) (new'Field)}) (P'.wireGet 11)
- _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in P'.unknown field'Number wire'Type old'Self
-
-instance P'.MessageAPI msg' (msg' -> XPubUnspent) XPubUnspent where
- getVal m' f' = f' m'
-
-instance P'.GPB XPubUnspent
-
-instance P'.ReflectDescriptor XPubUnspent where
- getMessageInfo _ = P'.GetMessageInfo (P'.fromDistinctAscList [10]) (P'.fromDistinctAscList [0, 2, 10])
- reflectDescriptorInfo _
- = Prelude'.read
- "DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.XPubUnspent\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"XPubUnspent\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"XPubUnspent.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.XPubUnspent.path\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"XPubUnspent\"], baseName' = FName \"path\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 2}, packedTag = Just (WireTag {getWireTag = 0},WireTag {getWireTag = 2}), wireTagLength = 1, isPacked = True, isRequired = False, canRepeat = True, mightPack = True, typeCode = FieldType {getFieldType = 13}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.XPubUnspent.unspent\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"XPubUnspent\"], baseName' = FName \"unspent\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 10}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.Unspent\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"Unspent\"}), hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False}"
-
-instance P'.TextType XPubUnspent where
- tellT = P'.tellSubMessage
- getT = P'.getSubMessage
-
-instance P'.TextMsg XPubUnspent where
- textPut msg
- = do
- P'.tellT "path" (path msg)
- P'.tellT "unspent" (unspent msg)
- textGet
- = do
- mods <- P'.sepEndBy (P'.choice [parse'path, parse'unspent]) P'.spaces
- Prelude'.return (Prelude'.foldl (\ v f -> f v) P'.defaultValue mods)
- where
- parse'path
- = P'.try
- (do
- v <- P'.getT "path"
- Prelude'.return (\ o -> o{path = P'.append (path o) v}))
- parse'unspent
- = P'.try
- (do
- v <- P'.getT "unspent"
- Prelude'.return (\ o -> o{unspent = v})) \ No newline at end of file
diff --git a/src/Network/Haskoin/Store/ProtocolBuffers/XPubUnspentList.hs b/src/Network/Haskoin/Store/ProtocolBuffers/XPubUnspentList.hs
deleted file mode 100644
index 78700a3..0000000
--- a/src/Network/Haskoin/Store/ProtocolBuffers/XPubUnspentList.hs
+++ /dev/null
@@ -1,82 +0,0 @@
-{-# LANGUAGE BangPatterns, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings #-}
-{-# OPTIONS_GHC -w #-}
-module Network.Haskoin.Store.ProtocolBuffers.XPubUnspentList (XPubUnspentList(..)) where
-import Prelude ((+), (/), (++), (.))
-import qualified Prelude as Prelude'
-import qualified Data.Typeable as Prelude'
-import qualified GHC.Generics as Prelude'
-import qualified Data.Data as Prelude'
-import qualified Text.ProtocolBuffers.Header as P'
-import qualified Network.Haskoin.Store.ProtocolBuffers.XPubUnspent as ProtocolBuffers (XPubUnspent)
-
-data XPubUnspentList = XPubUnspentList{xpubunspent :: !(P'.Seq ProtocolBuffers.XPubUnspent)}
- deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic)
-
-instance P'.Mergeable XPubUnspentList where
- mergeAppend (XPubUnspentList x'1) (XPubUnspentList y'1) = XPubUnspentList (P'.mergeAppend x'1 y'1)
-
-instance P'.Default XPubUnspentList where
- defaultValue = XPubUnspentList P'.defaultValue
-
-instance P'.Wire XPubUnspentList where
- wireSize ft' self'@(XPubUnspentList x'1)
- = case ft' of
- 10 -> calc'Size
- 11 -> P'.prependMessageSize calc'Size
- _ -> P'.wireSizeErr ft' self'
- where
- calc'Size = (P'.wireSizeRep 1 11 x'1)
- wirePutWithSize ft' self'@(XPubUnspentList x'1)
- = case ft' of
- 10 -> put'Fields
- 11 -> put'FieldsSized
- _ -> P'.wirePutErr ft' self'
- where
- put'Fields = P'.sequencePutWithSize [P'.wirePutRepWithSize 2 11 x'1]
- put'FieldsSized
- = let size' = Prelude'.fst (P'.runPutM put'Fields)
- put'Size
- = do
- P'.putSize size'
- Prelude'.return (P'.size'WireSize size')
- in P'.sequencePutWithSize [put'Size, put'Fields]
- wireGet ft'
- = case ft' of
- 10 -> P'.getBareMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- 11 -> P'.getMessageWith (P'.catch'Unknown' P'.discardUnknown update'Self)
- _ -> P'.wireGetErr ft'
- where
- update'Self wire'Tag old'Self
- = case wire'Tag of
- 2 -> Prelude'.fmap (\ !new'Field -> old'Self{xpubunspent = P'.append (xpubunspent old'Self) new'Field}) (P'.wireGet 11)
- _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in P'.unknown field'Number wire'Type old'Self
-
-instance P'.MessageAPI msg' (msg' -> XPubUnspentList) XPubUnspentList where
- getVal m' f' = f' m'
-
-instance P'.GPB XPubUnspentList
-
-instance P'.ReflectDescriptor XPubUnspentList where
- getMessageInfo _ = P'.GetMessageInfo (P'.fromDistinctAscList []) (P'.fromDistinctAscList [2])
- reflectDescriptorInfo _
- = Prelude'.read
- "DescriptorInfo {descName = ProtoName {protobufName = FIName \".ProtocolBuffers.XPubUnspentList\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"XPubUnspentList\"}, descFilePath = [\"Network\",\"Haskoin\",\"Store\",\"ProtocolBuffers\",\"XPubUnspentList.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".ProtocolBuffers.XPubUnspentList.xpubunspent\", haskellPrefix' = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule' = [MName \"ProtocolBuffers\",MName \"XPubUnspentList\"], baseName' = FName \"xpubunspent\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 0}, wireTag = WireTag {getWireTag = 2}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".ProtocolBuffers.XPubUnspent\", haskellPrefix = [MName \"Network\",MName \"Haskoin\",MName \"Store\"], parentModule = [MName \"ProtocolBuffers\"], baseName = MName \"XPubUnspent\"}), hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False, jsonInstances = False}"
-
-instance P'.TextType XPubUnspentList where
- tellT = P'.tellSubMessage
- getT = P'.getSubMessage
-
-instance P'.TextMsg XPubUnspentList where
- textPut msg
- = do
- P'.tellT "xpubunspent" (xpubunspent msg)
- textGet
- = do
- mods <- P'.sepEndBy (P'.choice [parse'xpubunspent]) P'.spaces
- Prelude'.return (Prelude'.foldl (\ v f -> f v) P'.defaultValue mods)
- where
- parse'xpubunspent
- = P'.try
- (do
- v <- P'.getT "xpubunspent"
- Prelude'.return (\ o -> o{xpubunspent = P'.append (xpubunspent o) v})) \ No newline at end of file
diff --git a/test/Spec.hs b/test/Spec.hs
index 75abb50..fc853f8 100644
--- a/test/Spec.hs
+++ b/test/Spec.hs
@@ -38,30 +38,33 @@ main = do
bestHeight = nodeHeight bestNode
bestHeight `shouldBe` 8
it "get a block and its transactions" $
- withTestStore net "get-block-txs" $ \TestStore {..} -> do
- let get_the_block h =
- receive testStoreEvents >>= \case
- StoreBestBlock b
- | h == 0 -> return b
- | otherwise -> get_the_block ((h :: Int) - 1)
- _ -> get_the_block h
- bh <- get_the_block 380
- m <- getBlock (testStoreDB, defaultReadOptions) bh
- let bd = fromMaybe (error "Could not get block") m
- blockDataHeight bd `shouldBe` 381
- length (blockDataTxs bd) `shouldBe` 2
- let h1 =
- "e8588129e146eeb0aa7abdc3590f8c5920cc5ff42daf05c23b29d4ae5b51fc22"
- h2 =
- "7e621eeb02874ab039a8566fd36f4591e65eca65313875221842c53de6907d6c"
- head (blockDataTxs bd) `shouldBe` h1
- last (blockDataTxs bd) `shouldBe` h2
- t1 <- getTransaction (testStoreDB, defaultReadOptions) h1
- t1 `shouldSatisfy` isJust
- txHash (transactionData (fromJust t1)) `shouldBe` h1
- t2 <- getTransaction (testStoreDB, defaultReadOptions) h2
- t2 `shouldSatisfy` isJust
- txHash (transactionData (fromJust t2)) `shouldBe` h2
+ withTestStore net "get-block-txs" $ \TestStore {..} ->
+ withBlockDB defaultReadOptions testStoreDB $ do
+ let h1 =
+ "e8588129e146eeb0aa7abdc3590f8c5920cc5ff42daf05c23b29d4ae5b51fc22"
+ h2 =
+ "7e621eeb02874ab039a8566fd36f4591e65eca65313875221842c53de6907d6c"
+ get_the_block h =
+ receive testStoreEvents >>= \case
+ StoreBestBlock b
+ | h == 0 -> return b
+ | otherwise ->
+ get_the_block ((h :: Int) - 1)
+ _ -> get_the_block h
+ bh <- get_the_block 380
+ m <- getBlock bh
+ let bd = fromMaybe (error "Could not get block") m
+ t1 <- getTransaction h1
+ t2 <- getTransaction h2
+ lift $ do
+ blockDataHeight bd `shouldBe` 381
+ length (blockDataTxs bd) `shouldBe` 2
+ head (blockDataTxs bd) `shouldBe` h1
+ last (blockDataTxs bd) `shouldBe` h2
+ t1 `shouldSatisfy` isJust
+ txHash (transactionData (fromJust t1)) `shouldBe` h1
+ t2 `shouldSatisfy` isJust
+ txHash (transactionData (fromJust t2)) `shouldBe` h2
withTestStore ::
MonadUnliftIO m => Network -> String -> (TestStore -> m a) -> m a