Improve decoding of Txs
This commit is contained in:
parent
bf740857b3
commit
493d17abfd
1 changed files with 6 additions and 14 deletions
|
@ -1881,8 +1881,8 @@ scanTxNative pipe db nodeUser nodePwd = do
|
|||
if isValidSaplingViewingKey (E.encodeUtf8 k)
|
||||
then do
|
||||
print "decoding Sapling tx"
|
||||
let decodedSapList' = map (decodeSaplingTx k) txList'
|
||||
print decodedSapList'
|
||||
let decodedSapList' = concatMap (decodeSaplingTx k) txList'
|
||||
print $ filter isJust decodedSapList'
|
||||
else do
|
||||
let vk = decodeUfvk $ E.encodeUtf8 k
|
||||
case vk of
|
||||
|
@ -1895,26 +1895,18 @@ scanTxNative pipe db nodeUser nodePwd = do
|
|||
(decryptOrchardAction v)
|
||||
(concatMap rt_orchardActions txList')
|
||||
print decodedOrchList
|
||||
decodeSaplingTx :: T.Text -> RawTxResponse -> [ZcashTx]
|
||||
decodeSaplingTx :: T.Text -> RawTxResponse -> [Maybe ZcashTx]
|
||||
decodeSaplingTx k t =
|
||||
map
|
||||
(buildZcashTx t .
|
||||
decodeSaplingOutput (bytes (decodeBech32 $ E.encodeUtf8 k)))
|
||||
(rt_shieldedOutputs t)
|
||||
buildZcashTx :: RawTxResponse -> Maybe DecodedNote -> ZcashTx
|
||||
buildZcashTx :: RawTxResponse -> Maybe DecodedNote -> Maybe ZcashTx
|
||||
buildZcashTx t n =
|
||||
case n of
|
||||
Nothing ->
|
||||
ZcashTx
|
||||
(rt_id t)
|
||||
0.0
|
||||
0
|
||||
(rt_blockheight t)
|
||||
(rt_blocktime t)
|
||||
True
|
||||
(rt_confirmations t)
|
||||
""
|
||||
Nothing -> Nothing
|
||||
Just n ->
|
||||
Just $
|
||||
ZcashTx
|
||||
(rt_id t)
|
||||
(fromIntegral (a_value n) * 0.00000001)
|
||||
|
|
Loading…
Reference in a new issue