Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get spark output addresses in daemon api #1485

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading