diff --git a/src/ZGoBackend.hs b/src/ZGoBackend.hs index 113cd48..7d9de60 100644 --- a/src/ZGoBackend.hs +++ b/src/ZGoBackend.hs @@ -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)