Implements scanning of transparent transactions #72

Merged
pitmutt merged 9 commits from rav001 into dev041 2024-03-27 18:40:58 +00:00
2 changed files with 23 additions and 0 deletions
Showing only changes of commit 826ed5b697 - Show all commits

22
src/Zenith/Scanner.hs Normal file
View 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)]

View file

@ -32,6 +32,7 @@ library
Zenith.Types
Zenith.Utils
Zenith.Zcashd
Zenith.Scanner
hs-source-dirs:
src
build-depends: