Publish Zenith beta version #80
2 changed files with 23 additions and 0 deletions
22
src/Zenith/Scanner.hs
Normal file
22
src/Zenith/Scanner.hs
Normal file
|
@ -0,0 +1,22 @@
|
|||
module Zenith.Scanner where
|
||||
|
||||
import Control.Monad (when)
|
||||
import qualified Data.Text as T
|
||||
import Zenith.Core (checkBlockChain)
|
||||
|
||||
-- | Function to scan the Zcash blockchain through the Zebra node and populate the Zenith database
|
||||
scanZebra ::
|
||||
Int -- ^ Starting block
|
||||
-> T.Text -- ^ Host
|
||||
-> Int -- ^ Port
|
||||
-> T.Text -- ^ Path to database file
|
||||
-> IO ()
|
||||
scanZebra b host port dbFilePath = do
|
||||
bc <- checkBlockChain host port
|
||||
case bc of
|
||||
Nothing -> throwIO $ userError "Failed to determine blockchain status"
|
||||
Just bStatus -> do
|
||||
if b > zgb_blocks bStatus
|
||||
then throwIO $ userError "Invalid starting block for scan"
|
||||
else do
|
||||
let bList = [b .. (zgb_blocks bStatus)]
|
|
@ -32,6 +32,7 @@ library
|
|||
Zenith.Types
|
||||
Zenith.Utils
|
||||
Zenith.Zcashd
|
||||
Zenith.Scanner
|
||||
hs-source-dirs:
|
||||
src
|
||||
build-depends:
|
||||
|
|
Loading…
Reference in a new issue