Skip to content

Commit

Permalink
Show spark output addresses (#1485)
Browse files Browse the repository at this point in the history
  • Loading branch information
levonpetrosyan93 authored Nov 21, 2024
1 parent 9d6ad89 commit 2422a07
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/wallet/rpcwallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1682,6 +1682,17 @@ void ListTransactions(CWallet * const pwallet, const CWalletTx& wtx, const std::
}
entry.push_back(Pair("account", strSentAccount));
MaybePushAddress(entry, s.destination, addr);

CSparkOutputTx output;
if (wtx.tx->IsSparkTransaction()) {
const CTxOut& txout = wtx.tx->vout[s.vout];
if (txout.scriptPubKey.IsSparkMint() || txout.scriptPubKey.IsSparkSMint()) {
if(pwallet->GetSparkOutputTx(txout.scriptPubKey, output)) {
entry.push_back(Pair("address", output.address));
}
}
}

if (wtx.tx->HasNoRegularInputs()) {
entry.push_back(Pair("category", "spend"));
}
Expand All @@ -1691,7 +1702,12 @@ void ListTransactions(CWallet * const pwallet, const CWalletTx& wtx, const std::
else {
entry.push_back(Pair("category", "send"));
}
entry.push_back(Pair("amount", ValueFromAmount(-s.amount)));

if (!output.address.empty())
entry.push_back(Pair("amount", ValueFromAmount(-output.amount)));
else
entry.push_back(Pair("amount", ValueFromAmount(-s.amount)));

if (pwallet->mapAddressBook.count(s.destination)) {
entry.push_back(Pair("label", pwallet->mapAddressBook[s.destination].name));
}
Expand Down

0 comments on commit 2422a07

Please sign in to comment.