Add orchard support to z_getnotescount

This commit is contained in:
Kris Nuttycombe 2022-03-15 15:49:01 -06:00
parent 5d65952f54
commit 24ce54f3ed
1 changed files with 7 additions and 3 deletions

View File

@ -5604,11 +5604,12 @@ UniValue z_getnotescount(const UniValue& params, bool fHelp)
"z_getnotescount\n"
"\nArguments:\n"
"1. minconf (numeric, optional, default=1) Only include notes in transactions confirmed at least this many times.\n"
"\nReturns the number of sprout and sapling notes available in the wallet.\n"
"\nReturns the number of shielded notes of each pool available in the wallet.\n"
"\nResult:\n"
"{\n"
" \"sprout\" (numeric) the number of sprout notes in the wallet\n"
" \"sapling\" (numeric) the number of sapling notes in the wallet\n"
" \"sprout\" (numeric) the number of Sprout notes in the wallet\n"
" \"sapling\" (numeric) the number of Sapling notes in the wallet\n"
" \"orchard\" (numeric) the number of Orchard notes in the wallet\n"
"}\n"
"\nExamples:\n"
+ HelpExampleCli("z_getnotescount", "0")
@ -5623,15 +5624,18 @@ UniValue z_getnotescount(const UniValue& params, bool fHelp)
int sprout = 0;
int sapling = 0;
int orchard = 0;
for (auto& wtx : pwalletMain->mapWallet) {
if (wtx.second.GetDepthInMainChain() >= nMinDepth) {
sprout += wtx.second.mapSproutNoteData.size();
sapling += wtx.second.mapSaplingNoteData.size();
orchard += wtx.second.orchardTxMeta.GetMyActionIVKs().size();
}
}
UniValue ret(UniValue::VOBJ);
ret.pushKV("sprout", sprout);
ret.pushKV("sapling", sapling);
ret.pushKV("orchard", orchard);
return ret;
}