Implement Sapling decoding

This commit is contained in:
Rene Vergara 2023-09-29 13:49:34 -05:00
parent 3ed60ae2dd
commit 0224db1993
Signed by: pitmutt
GPG Key ID: 65122AD495A7F5B2
1 changed files with 8 additions and 6 deletions

View File

@ -1836,7 +1836,7 @@ scanTxNative pipe db nodeUser nodePwd = do
blockList <- blockList <-
mapM mapM
(getBlockInfo nodeUser nodePwd . T.pack . show) (getBlockInfo nodeUser nodePwd . T.pack . show)
[2243000 .. (bl_height lB)] [((bl_height lB) - 50) .. (bl_height lB)]
print "filtering blocks..." print "filtering blocks..."
let filteredBlockList = filter filterBlock blockList let filteredBlockList = filter filterBlock blockList
print "extracting txs from blocks..." print "extracting txs from blocks..."
@ -1876,19 +1876,21 @@ scanTxNative pipe db nodeUser nodePwd = do
return Nothing return Nothing
checkTx :: [RawTxResponse] -> T.Text -> IO () checkTx :: [RawTxResponse] -> T.Text -> IO ()
checkTx txList' k = do checkTx txList' k = do
let sOutList = concatMap rt_shieldedOutputs txList'
if isValidSaplingViewingKey (E.encodeUtf8 k) if isValidSaplingViewingKey (E.encodeUtf8 k)
then do then do
print "decoding Sapling tx" print "decoding Sapling tx"
print txList' let decodedSapList' =
map
(decodeSaplingOutput (bytes (decodeBech32 $ E.encodeUtf8 k)))
sOutList
print decodedSapList'
else do else do
let vk = decodeUfvk $ E.encodeUtf8 k let vk = decodeUfvk $ E.encodeUtf8 k
case vk of case vk of
Nothing -> print "Not a valid key" Nothing -> print "Not a valid key"
Just v -> do Just v -> do
let decodedSapList = let decodedSapList = map (decodeSaplingOutput (s_key v)) sOutList
map
(decodeSaplingOutput (s_key v))
(concatMap rt_shieldedOutputs txList')
print decodedSapList print decodedSapList
let decodedOrchList = let decodedOrchList =
map map