Compare commits
No commits in common. "b3e33b798bcafb772c0dc82644892f9d13353523" and "0a2e585eb920598bc646e3322c3596e8b4568aeb" have entirely different histories.
b3e33b798b
...
0a2e585eb9
4 changed files with 9 additions and 42 deletions
|
@ -12,4 +12,4 @@ main = do
|
|||
{-dataStorePath <- require config "dataStorePath"-}
|
||||
zebraPort <- require config "zebraPort"
|
||||
zebraHost <- require config "zebraHost"
|
||||
scanZebra 2772000 zebraHost zebraPort dbFilePath
|
||||
scanZebra 2764500 zebraHost zebraPort dbFilePath
|
||||
|
|
|
@ -5,18 +5,15 @@ module Zenith.Scanner where
|
|||
import Control.Exception (throwIO, try)
|
||||
import Data.Aeson
|
||||
import Data.HexString
|
||||
import Data.Maybe
|
||||
import qualified Data.Text as T
|
||||
import GHC.Utils.Monad (concatMapM)
|
||||
import Network.HTTP.Simple (getResponseBody)
|
||||
import ZcashHaskell.Types
|
||||
( BlockResponse(..)
|
||||
, RawZebraTx(..)
|
||||
, Transaction(..)
|
||||
, RpcResponse(..)
|
||||
, ZebraGetBlockChainInfo(..)
|
||||
, ZebraTxResponse(..)
|
||||
, fromRawTBundle
|
||||
)
|
||||
import ZcashHaskell.Utils (makeZebraCall, readZebraTransaction)
|
||||
import ZcashHaskell.Utils (makeZebraCall)
|
||||
import Zenith.Core (checkBlockChain)
|
||||
import Zenith.DB (initRawStore)
|
||||
import Zenith.Utils (jsonNumber)
|
||||
|
@ -42,7 +39,7 @@ scanZebra b host port dbFilePath = do
|
|||
let bList = [b .. (zgb_blocks bStatus)]
|
||||
txList <-
|
||||
try $ concatMapM (processBlock host port) bList :: IO
|
||||
(Either IOError [Transaction])
|
||||
(Either IOError [HexString])
|
||||
case txList of
|
||||
Left e1 -> print e1
|
||||
Right txList' -> print txList'
|
||||
|
@ -52,7 +49,7 @@ processBlock ::
|
|||
T.Text -- ^ Host name for `zebrad`
|
||||
-> Int -- ^ Port for `zebrad`
|
||||
-> Int -- ^ The block number to process
|
||||
-> IO [Transaction]
|
||||
-> IO [HexString]
|
||||
processBlock host port b = do
|
||||
r <-
|
||||
makeZebraCall
|
||||
|
@ -62,34 +59,4 @@ processBlock host port b = do
|
|||
[Data.Aeson.String $ T.pack $ show b, jsonNumber 1]
|
||||
case r of
|
||||
Left e -> throwIO $ userError e
|
||||
Right blk -> do
|
||||
x <- mapM (processTx host port) $ bl_txs blk
|
||||
return $ catMaybes x
|
||||
|
||||
-- | Function to process a raw transaction
|
||||
processTx ::
|
||||
T.Text -- ^ Host name for `zebrad`
|
||||
-> Int -- ^ Port for `zebrad`
|
||||
-> HexString -- ^ transaction id
|
||||
-> IO (Maybe Transaction)
|
||||
processTx host port t = do
|
||||
r <-
|
||||
makeZebraCall
|
||||
host
|
||||
port
|
||||
"getrawtransaction"
|
||||
[Data.Aeson.String $ toText t, jsonNumber 1]
|
||||
case r of
|
||||
Left e -> throwIO $ userError e
|
||||
Right rawTx -> do
|
||||
case readZebraTransaction (ztr_hex rawTx) of
|
||||
Nothing -> return Nothing
|
||||
Just rzt ->
|
||||
return $
|
||||
Just $
|
||||
Transaction
|
||||
t
|
||||
(ztr_blockheight rawTx)
|
||||
(ztr_conf rawTx)
|
||||
(fromIntegral $ zt_expiry rzt)
|
||||
(fromRawTBundle $ zt_tBundle rzt)
|
||||
Right blk -> return $ bl_txs blk
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 4b064af4dece54fe51e3704aa95db18324167d36
|
||||
Subproject commit f0995441628381fee14ae1c655c3c4f8d96162e5
|
|
@ -1,6 +1,6 @@
|
|||
cabal-version: 3.0
|
||||
name: zenith
|
||||
version: 0.4.4.2
|
||||
version: 0.4.4.1
|
||||
license: MIT
|
||||
license-file: LICENSE
|
||||
author: Rene Vergara
|
||||
|
|
Loading…
Reference in a new issue