Correct data type for getblock

This commit is contained in:
Rene Vergara 2023-09-28 13:26:24 -05:00
parent 85bf0fef59
commit fb600aa5fc
Signed by: pitmutt
GPG key ID: 65122AD495A7F5B2

View file

@ -1803,14 +1803,14 @@ generateToken = do
runCryptoRNGT rngState $ randomString 24 "abcdef0123456789" runCryptoRNGT rngState $ randomString 24 "abcdef0123456789"
getBlockInfo :: getBlockInfo ::
BS.ByteString -> BS.ByteString -> SC.Scientific -> IO (Maybe BlockResponse) BS.ByteString -> BS.ByteString -> T.Text -> IO (Maybe BlockResponse)
getBlockInfo nodeUser nodePwd bh = do getBlockInfo nodeUser nodePwd bh = do
blockInfo <- blockInfo <-
makeZcashCall makeZcashCall
nodeUser nodeUser
nodePwd nodePwd
"getblock" "getblock"
[Number bh, Number $ SC.scientific 1 0] [Data.Aeson.String bh, Number $ SC.scientific 1 0]
let content = getResponseBody blockInfo :: RpcResponse BlockResponse let content = getResponseBody blockInfo :: RpcResponse BlockResponse
if isNothing (err content) if isNothing (err content)
then return $ result content then return $ result content
@ -1825,7 +1825,7 @@ scanTxNative pipe db nodeUser nodePwd = do
let ownerList = cast' . Doc <$> keyOwnerList let ownerList = cast' . Doc <$> keyOwnerList
let keyList = map (maybe "" oviewkey) ownerList let keyList = map (maybe "" oviewkey) ownerList
lastBlockData <- access pipe master db findBlock lastBlockData <- access pipe master db findBlock
latestBlock <- getBlockInfo nodeUser nodePwd (SC.scientific (-1) 0) latestBlock <- getBlockInfo nodeUser nodePwd "-1"
case latestBlock of case latestBlock of
Nothing -> fail "No block data from node" Nothing -> fail "No block data from node"
Just lB -> do Just lB -> do
@ -1833,7 +1833,7 @@ scanTxNative pipe db nodeUser nodePwd = do
Nothing -> do Nothing -> do
blockList <- blockList <-
mapM mapM
(getBlockInfo nodeUser nodePwd . fromInteger) (getBlockInfo nodeUser nodePwd . T.pack . show)
[2220000 .. (bl_height lB)] [2220000 .. (bl_height lB)]
let filteredBlockList = filter filterBlock blockList let filteredBlockList = filter filterBlock blockList
let txIdList = concatMap extractTxs filteredBlockList let txIdList = concatMap extractTxs filteredBlockList