From f9816408b2120bb9524934fbba7f4b0bfbba0535 Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 31 Jul 2018 20:15:00 -0700 Subject: [PATCH] Update CWalletTx::GetAmounts() to return COutputEntry for Sapling valueBalance. --- src/wallet/wallet.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index e93525ff5..2aa589dae 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1906,6 +1906,18 @@ void CWalletTx::GetAmounts(list& listReceived, } } + // If we sent utxos from this transaction, create output for value taken from (negative valueBalance) + // or added (positive valueBalance) to the transparent value pool by Sapling shielding and unshielding. + if (isFromMyTaddr) { + if (valueBalance < 0) { + COutputEntry output = {CNoDestination(), -valueBalance, (int) vout.size()}; + listSent.push_back(output); + } else if (valueBalance > 0) { + COutputEntry output = {CNoDestination(), valueBalance, (int) vout.size()}; + listReceived.push_back(output); + } + } + // Sent/received. for (unsigned int i = 0; i < vout.size(); ++i) {