Correct the Sapling decoding

This commit is contained in:
Rene Vergara 2023-09-28 15:17:41 -05:00
parent ae5606f4be
commit 5f32fd1142
Signed by: pitmutt
GPG Key ID: 65122AD495A7F5B2
2 changed files with 12 additions and 5 deletions

View File

@ -1824,6 +1824,7 @@ scanTxNative pipe db nodeUser nodePwd = do
unless (null keyOwnerList) $ do
let ownerList = cast' . Doc <$> keyOwnerList
let keyList = map (maybe "" oviewkey) ownerList
print keyList
lastBlockData <- access pipe master db findBlock
latestBlock <- getBlockInfo nodeUser nodePwd "-1"
case latestBlock of
@ -1831,19 +1832,24 @@ scanTxNative pipe db nodeUser nodePwd = do
Just lB -> do
case cast' . Doc =<< lastBlockData of
Nothing -> do
print "Getting blocks"
blockList <-
mapM
(getBlockInfo nodeUser nodePwd . T.pack . show)
[2243000 .. (bl_height lB)]
print "filtering blocks..."
let filteredBlockList = filter filterBlock blockList
print "extracting txs from blocks..."
let txIdList = concatMap extractTxs filteredBlockList
print "getting tx data from node..."
txList <- mapM (getTxData nodeUser nodePwd) txIdList
print "filtering txs..."
let filteredTxList = map fromJust $ filter filterTx txList
print "checking txs against keys..."
mapM_ (checkTx filteredTxList) keyList
Just lastBlock -> do
let blockList' = [(bl_height lastBlock + 1) .. (bl_height lB)]
print blockList'
print keyList
where
filterBlock :: Maybe BlockResponse -> Bool
filterBlock b = maybe 0 bl_confirmations b >= 5
@ -1872,9 +1878,10 @@ scanTxNative pipe db nodeUser nodePwd = do
checkTx txList k = do
if isValidSaplingViewingKey (E.encodeUtf8 k)
then do
print "decoding Sapling tx"
let decodedTxList =
map
(decodeSaplingOutput (E.encodeUtf8 k))
(decodeSaplingOutput (bytes (decodeBech32 $ E.encodeUtf8 k)))
(concatMap
rt_shieldedOutputs
(filter (\x -> rt_shieldedOutputs x /= []) txList))

View File

@ -16,15 +16,15 @@ packages:
commit: 085c16fb21b9f856a435a3faab980e7e0b319341
git: https://github.com/reach-sh/haskell-hexstring.git
- completed:
commit: a6a69ae4cc83f18228c20da6c1b34151c6ebd36e
commit: 697ce83f7c3db28e691ae0924c4857511aa96ac7
git: https://git.vergara.tech/Vergara_Tech/zcash-haskell.git
name: zcash-haskell
pantry-tree:
sha256: 73bc6593bfb26f61b63bf51206c8d9b1ecc51b78741df23d4940c9ff69c1aa05
sha256: 5b3ed1888cf157fa7f0b5a73b60468a767635379b94c1e1a00b04f86b4013208
size: 1229
version: 0.2.0
original:
commit: a6a69ae4cc83f18228c20da6c1b34151c6ebd36e
commit: 697ce83f7c3db28e691ae0924c4857511aa96ac7
git: https://git.vergara.tech/Vergara_Tech/zcash-haskell.git
- completed:
commit: 787c2e813eb3a5d16c375d4b37dfefbd2adcdf05