Auto merge of #3581 - Eirik0:3580-unspent-note-cleanup, r=daira
Remove GetUnspentFilteredNotes Closes #3580 This PR generalized `GetFilteredNotes`, expanding its functionality to also do what we do in `GetUnspentFilteredNotes`. This enables us to remove the latter.
This commit is contained in:
@@ -2566,17 +2566,17 @@ UniValue z_listunspent(const UniValue& params, bool fHelp)
|
||||
UniValue results(UniValue::VARR);
|
||||
|
||||
if (zaddrs.size() > 0) {
|
||||
std::vector<CUnspentSproutNotePlaintextEntry> sproutEntries;
|
||||
std::vector<UnspentSaplingNoteEntry> saplingEntries;
|
||||
pwalletMain->GetUnspentFilteredNotes(sproutEntries, saplingEntries, zaddrs, nMinDepth, nMaxDepth, !fIncludeWatchonly);
|
||||
std::vector<CSproutNotePlaintextEntry> 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);
|
||||
|
||||
for (CUnspentSproutNotePlaintextEntry & entry : sproutEntries) {
|
||||
for (auto & entry : sproutEntries) {
|
||||
UniValue obj(UniValue::VOBJ);
|
||||
obj.push_back(Pair("txid", entry.jsop.hash.ToString()));
|
||||
obj.push_back(Pair("jsindex", (int)entry.jsop.js ));
|
||||
obj.push_back(Pair("jsoutindex", (int)entry.jsop.n));
|
||||
obj.push_back(Pair("confirmations", entry.nHeight));
|
||||
obj.push_back(Pair("confirmations", entry.confirmations));
|
||||
bool hasSproutSpendingKey = pwalletMain->HaveSproutSpendingKey(boost::get<libzcash::SproutPaymentAddress>(entry.address));
|
||||
obj.push_back(Pair("spendable", hasSproutSpendingKey));
|
||||
obj.push_back(Pair("address", EncodePaymentAddress(entry.address)));
|
||||
@@ -2589,11 +2589,11 @@ UniValue z_listunspent(const UniValue& params, bool fHelp)
|
||||
results.push_back(obj);
|
||||
}
|
||||
|
||||
for (UnspentSaplingNoteEntry & entry : saplingEntries) {
|
||||
for (auto & entry : saplingEntries) {
|
||||
UniValue obj(UniValue::VOBJ);
|
||||
obj.push_back(Pair("txid", entry.op.hash.ToString()));
|
||||
obj.push_back(Pair("outindex", (int)entry.op.n));
|
||||
obj.push_back(Pair("confirmations", entry.nHeight));
|
||||
obj.push_back(Pair("confirmations", entry.confirmations));
|
||||
libzcash::SaplingIncomingViewingKey ivk;
|
||||
libzcash::SaplingFullViewingKey fvk;
|
||||
pwalletMain->GetSaplingIncomingViewingKey(boost::get<libzcash::SaplingPaymentAddress>(entry.address), ivk);
|
||||
|
||||
Reference in New Issue
Block a user