Log the sizes of various datastructures about nullifiers when NullifierCount() is called, if -zdebug

This commit is contained in:
Duke Leto
2020-01-02 12:46:35 -05:00
parent cc3e1c11d7
commit c0ca9ee8fe
4 changed files with 18 additions and 6 deletions

View File

@@ -52,6 +52,11 @@ void CCoins::CalcMaskSize(unsigned int &nBytes, unsigned int &nNonzeroBytes) con
nBytes += nLastUsedByte; nBytes += nLastUsedByte;
} }
CNullifiersMap CCoinsViewCache::getNullifiers()
{
return cacheSaplingNullifiers;
}
bool CCoins::Spend(uint32_t nPos) bool CCoins::Spend(uint32_t nPos)
{ {
if (nPos >= vout.size() || vout[nPos].IsNull()) if (nPos >= vout.size() || vout[nPos].IsNull())

View File

@@ -1,6 +1,6 @@
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2014 The Bitcoin Core developers // Copyright (c) 2009-2014 The Bitcoin Core developers
// Copyright (c) 2019 The Hush developers // Copyright (c) 2019-2020 The Hush developers
// Distributed under the MIT software license, see the accompanying // Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
@@ -490,8 +490,9 @@ public:
CCoinsViewCache(CCoinsView *baseIn); CCoinsViewCache(CCoinsView *baseIn);
~CCoinsViewCache(); ~CCoinsViewCache();
CNullifiersMap getNullifiers();
// Standard CCoinsView methods // Standard CCoinsView methods
//static CLaunchMap &LaunchMap() { return launchMap; }
bool GetSproutAnchorAt(const uint256 &rt, SproutMerkleTree &tree) const; bool GetSproutAnchorAt(const uint256 &rt, SproutMerkleTree &tree) const;
bool GetSaplingAnchorAt(const uint256 &rt, SaplingMerkleTree &tree) const; bool GetSaplingAnchorAt(const uint256 &rt, SaplingMerkleTree &tree) const;
bool GetNullifier(const uint256 &nullifier, ShieldedType type) const; bool GetNullifier(const uint256 &nullifier, ShieldedType type) const;

View File

@@ -3764,9 +3764,9 @@ UniValue z_listnullifiers(const UniValue& params, bool fHelp, const CPubKey& myp
LOCK2(cs_main, pwalletMain->cs_wallet); LOCK2(cs_main, pwalletMain->cs_wallet);
UniValue ret(UniValue::VARR); UniValue ret(UniValue::VARR);
//for (auto nullifier: mempool.getNullifiers()) { for (auto nullifier: mempool.getNullifiers()) {
// ret.push_back(nullifier.GetHex()); ret.push_back(nullifier.first.GetHex());
//} }
return ret; return ret;
} }

View File

@@ -970,7 +970,13 @@ std::set<uint256> CWallet::GetNullifiers()
int64_t CWallet::NullifierCount() int64_t CWallet::NullifierCount()
{ {
LOCK(cs_wallet); LOCK(cs_wallet);
return mempool.getNullifiers().size(); //return mempool.getNullifiers().size();
if(fZdebug) {
fprintf(stderr,"%s:mapTxSaplingNullifers.size=%d\n",__FUNCTION__,(int)mapTxSaplingNullifiers.size() );
fprintf(stderr,"%s:mempool.getNullifiers.size=%d\n",__FUNCTION__,(int)mempool.getNullifiers().size() );
fprintf(stderr,"%s:cacheSaplingNullifiers.size=%d\n",__FUNCTION__,(int)pcoinsTip->getNullifiers().size() );
}
return mapTxSaplingNullifiers.size();
} }