|
|
@ -2567,7 +2567,7 @@ UniValue z_listunspent(const UniValue& params, bool fHelp) |
|
|
|
UniValue results(UniValue::VARR); |
|
|
|
|
|
|
|
if (zaddrs.size() > 0) { |
|
|
|
std::vector<CSproutNotePlaintextEntry> sproutEntries; |
|
|
|
std::vector<SproutNoteEntry> sproutEntries; |
|
|
|
std::vector<SaplingNoteEntry> saplingEntries; |
|
|
|
pwalletMain->GetFilteredNotes(sproutEntries, saplingEntries, zaddrs, nMinDepth, nMaxDepth, true, !fIncludeWatchonly, false); |
|
|
|
std::set<std::pair<PaymentAddress, uint256>> nullifierSet = pwalletMain->GetNullifiersForAddresses(zaddrs); |
|
|
@ -2581,8 +2581,8 @@ UniValue z_listunspent(const UniValue& params, bool fHelp) |
|
|
|
bool hasSproutSpendingKey = pwalletMain->HaveSproutSpendingKey(boost::get<libzcash::SproutPaymentAddress>(entry.address)); |
|
|
|
obj.push_back(Pair("spendable", hasSproutSpendingKey)); |
|
|
|
obj.push_back(Pair("address", EncodePaymentAddress(entry.address))); |
|
|
|
obj.push_back(Pair("amount", ValueFromAmount(CAmount(entry.plaintext.value())))); |
|
|
|
std::string data(entry.plaintext.memo().begin(), entry.plaintext.memo().end()); |
|
|
|
obj.push_back(Pair("amount", ValueFromAmount(CAmount(entry.note.value())))); |
|
|
|
std::string data(entry.memo.begin(), entry.memo.end()); |
|
|
|
obj.push_back(Pair("memo", HexStr(data))); |
|
|
|
if (hasSproutSpendingKey) { |
|
|
|
obj.push_back(Pair("change", pwalletMain->IsNoteSproutChange(nullifierSet, entry.address, entry.jsop))); |
|
|
@ -3291,12 +3291,12 @@ CAmount getBalanceTaddr(std::string transparentAddress, int minDepth=1, bool ign |
|
|
|
|
|
|
|
CAmount getBalanceZaddr(std::string address, int minDepth = 1, bool ignoreUnspendable=true) { |
|
|
|
CAmount balance = 0; |
|
|
|
std::vector<CSproutNotePlaintextEntry> sproutEntries; |
|
|
|
std::vector<SproutNoteEntry> sproutEntries; |
|
|
|
std::vector<SaplingNoteEntry> saplingEntries; |
|
|
|
LOCK2(cs_main, pwalletMain->cs_wallet); |
|
|
|
pwalletMain->GetFilteredNotes(sproutEntries, saplingEntries, address, minDepth, true, ignoreUnspendable); |
|
|
|
for (auto & entry : sproutEntries) { |
|
|
|
balance += CAmount(entry.plaintext.value()); |
|
|
|
balance += CAmount(entry.note.value()); |
|
|
|
} |
|
|
|
for (auto & entry : saplingEntries) { |
|
|
|
balance += CAmount(entry.note.value()); |
|
|
@ -3356,7 +3356,7 @@ UniValue z_listreceivedbyaddress(const UniValue& params, bool fHelp) |
|
|
|
} |
|
|
|
|
|
|
|
UniValue result(UniValue::VARR); |
|
|
|
std::vector<CSproutNotePlaintextEntry> sproutEntries; |
|
|
|
std::vector<SproutNoteEntry> sproutEntries; |
|
|
|
std::vector<SaplingNoteEntry> saplingEntries; |
|
|
|
pwalletMain->GetFilteredNotes(sproutEntries, saplingEntries, fromaddress, nMinDepth, false, false); |
|
|
|
|
|
|
@ -3367,11 +3367,11 @@ UniValue z_listreceivedbyaddress(const UniValue& params, bool fHelp) |
|
|
|
} |
|
|
|
|
|
|
|
if (boost::get<libzcash::SproutPaymentAddress>(&zaddr) != nullptr) { |
|
|
|
for (CSproutNotePlaintextEntry & entry : sproutEntries) { |
|
|
|
for (SproutNoteEntry & entry : sproutEntries) { |
|
|
|
UniValue obj(UniValue::VOBJ); |
|
|
|
obj.push_back(Pair("txid", entry.jsop.hash.ToString())); |
|
|
|
obj.push_back(Pair("amount", ValueFromAmount(CAmount(entry.plaintext.value())))); |
|
|
|
std::string data(entry.plaintext.memo().begin(), entry.plaintext.memo().end()); |
|
|
|
obj.push_back(Pair("amount", ValueFromAmount(CAmount(entry.note.value())))); |
|
|
|
std::string data(entry.memo.begin(), entry.memo.end()); |
|
|
|
obj.push_back(Pair("memo", HexStr(data))); |
|
|
|
obj.push_back(Pair("jsindex", entry.jsop.js)); |
|
|
|
obj.push_back(Pair("jsoutindex", entry.jsop.n)); |
|
|
@ -3965,7 +3965,7 @@ UniValue z_getmigrationstatus(const UniValue& params, bool fHelp) { |
|
|
|
// account failed transactions, that were not mined within their expiration
|
|
|
|
// height.
|
|
|
|
{ |
|
|
|
std::vector<CSproutNotePlaintextEntry> sproutEntries; |
|
|
|
std::vector<SproutNoteEntry> sproutEntries; |
|
|
|
std::vector<SaplingNoteEntry> saplingEntries; |
|
|
|
std::set<PaymentAddress> noFilter; |
|
|
|
// Here we are looking for any and all Sprout notes for which we have the spending key, including those
|
|
|
@ -3973,7 +3973,7 @@ UniValue z_getmigrationstatus(const UniValue& params, bool fHelp) { |
|
|
|
pwalletMain->GetFilteredNotes(sproutEntries, saplingEntries, noFilter, 0, INT_MAX, true, true, false); |
|
|
|
CAmount unmigratedAmount = 0; |
|
|
|
for (const auto& sproutEntry : sproutEntries) { |
|
|
|
unmigratedAmount += sproutEntry.plaintext.value(); |
|
|
|
unmigratedAmount += sproutEntry.note.value(); |
|
|
|
} |
|
|
|
migrationStatus.push_back(Pair("unmigrated_amount", FormatMoney(unmigratedAmount))); |
|
|
|
} |
|
|
@ -4525,7 +4525,7 @@ UniValue z_mergetoaddress(const UniValue& params, bool fHelp) |
|
|
|
|
|
|
|
if (useAnySprout || useAnySapling || zaddrs.size() > 0) { |
|
|
|
// Get available notes
|
|
|
|
std::vector<CSproutNotePlaintextEntry> sproutEntries; |
|
|
|
std::vector<SproutNoteEntry> sproutEntries; |
|
|
|
std::vector<SaplingNoteEntry> saplingEntries; |
|
|
|
pwalletMain->GetFilteredNotes(sproutEntries, saplingEntries, zaddrs); |
|
|
|
|
|
|
@ -4547,9 +4547,9 @@ UniValue z_mergetoaddress(const UniValue& params, bool fHelp) |
|
|
|
} |
|
|
|
|
|
|
|
// Find unspent notes and update estimated size
|
|
|
|
for (const CSproutNotePlaintextEntry& entry : sproutEntries) { |
|
|
|
for (const SproutNoteEntry& entry : sproutEntries) { |
|
|
|
noteCounter++; |
|
|
|
CAmount nValue = entry.plaintext.value(); |
|
|
|
CAmount nValue = entry.note.value(); |
|
|
|
|
|
|
|
if (!maxedOutNotesFlag) { |
|
|
|
// If we haven't added any notes yet and the merge is to a
|
|
|
@ -4564,7 +4564,7 @@ UniValue z_mergetoaddress(const UniValue& params, bool fHelp) |
|
|
|
auto zaddr = entry.address; |
|
|
|
SproutSpendingKey zkey; |
|
|
|
pwalletMain->GetSproutSpendingKey(zaddr, zkey); |
|
|
|
sproutNoteInputs.emplace_back(entry.jsop, entry.plaintext.note(zaddr), nValue, zkey); |
|
|
|
sproutNoteInputs.emplace_back(entry.jsop, entry.note, nValue, zkey); |
|
|
|
mergedNoteValue += nValue; |
|
|
|
} |
|
|
|
} |
|
|
|