Use global mempool nullifier count, not local wallet nullifier count
This commit is contained in:
@@ -3748,27 +3748,25 @@ UniValue z_listnullifiers(const UniValue& params, bool fHelp, const CPubKey& myp
|
||||
if (!EnsureWalletIsAvailable(fHelp))
|
||||
return NullUniValue;
|
||||
|
||||
if (fHelp || params.size() > 1)
|
||||
if (fHelp || params.size() > 0)
|
||||
throw runtime_error(
|
||||
"z_listaddresses ( includeWatchonly )\n"
|
||||
"\nReturns the list of Sprout and Sapling shielded addresses belonging to the wallet.\n"
|
||||
"\nArguments:\n"
|
||||
"1. includeWatchonly (bool, optional, default=false) Also include watchonly addresses (see 'z_importviewingkey')\n"
|
||||
"z_listnullifiers\n"
|
||||
"\nReturns the list of Sapling nullifiers.\n"
|
||||
"\nResult:\n"
|
||||
"[ (json array of string)\n"
|
||||
" \"zaddr\" (string) a zaddr belonging to the wallet\n"
|
||||
" \"nullifier\" (string) a Sapling nullifer\n"
|
||||
" ,...\n"
|
||||
"]\n"
|
||||
"\nExamples:\n"
|
||||
+ HelpExampleCli("z_listaddresses", "")
|
||||
+ HelpExampleRpc("z_listaddresses", "")
|
||||
+ HelpExampleCli("z_listnullifiers", "")
|
||||
+ HelpExampleRpc("z_listnullifiers", "")
|
||||
);
|
||||
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
UniValue ret(UniValue::VARR);
|
||||
for (auto nullifier: Nullifiers){
|
||||
ret.push_back(EncodePaymentAddress(addr));
|
||||
}
|
||||
//for (auto nullifier: mempool.getNullifiers()) {
|
||||
// ret.push_back(nullifier.GetHex());
|
||||
//}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -613,15 +613,6 @@ std::set<std::pair<libzcash::PaymentAddress, uint256>> CWallet::GetNullifiersFor
|
||||
}
|
||||
}
|
||||
for (const auto & txPair : mapWallet) {
|
||||
// Sprout
|
||||
for (const auto & noteDataPair : txPair.second.mapSproutNoteData) {
|
||||
auto & noteData = noteDataPair.second;
|
||||
auto & nullifier = noteData.nullifier;
|
||||
auto & address = noteData.address;
|
||||
if (nullifier && addresses.count(address)) {
|
||||
nullifierSet.insert(std::make_pair(address, nullifier.get()));
|
||||
}
|
||||
}
|
||||
// Sapling
|
||||
for (const auto & noteDataPair : txPair.second.mapSaplingNoteData) {
|
||||
auto & noteData = noteDataPair.second;
|
||||
@@ -960,12 +951,29 @@ void CWallet::AddToSpends(const uint256& wtxid)
|
||||
}
|
||||
}
|
||||
|
||||
std::set<uint256> CWallet::GetNullifiers()
|
||||
{
|
||||
std::set<uint256> nullifierSet;
|
||||
for (const auto & txPair : mapWallet) {
|
||||
// Sapling
|
||||
for (const auto & noteDataPair : txPair.second.mapSaplingNoteData) {
|
||||
auto & noteData = noteDataPair.second;
|
||||
auto & nullifier = noteData.nullifier;
|
||||
if (nullifier) {
|
||||
nullifierSet.insert(nullifier.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
return nullifierSet;
|
||||
}
|
||||
|
||||
int64_t CWallet::NullifierCount()
|
||||
{
|
||||
LOCK(cs_wallet);
|
||||
return mapTxSaplingNullifiers.size();
|
||||
return mempool.getNullifiers().size();
|
||||
}
|
||||
|
||||
|
||||
void CWallet::ClearNoteWitnessCache()
|
||||
{
|
||||
LOCK(cs_wallet);
|
||||
|
||||
@@ -797,6 +797,7 @@ public:
|
||||
void ClearNoteWitnessCache();
|
||||
|
||||
int64_t NullifierCount();
|
||||
std::set<uint256> GetNullifiers();
|
||||
|
||||
protected:
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user