Browse Source

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

dev-aarch64
Duke Leto 5 years ago
parent
commit
c0ca9ee8fe
  1. 5
      src/coins.cpp
  2. 5
      src/coins.h
  3. 6
      src/wallet/rpcwallet.cpp
  4. 8
      src/wallet/wallet.cpp

5
src/coins.cpp

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

5
src/coins.h

@ -1,6 +1,6 @@
// Copyright (c) 2009-2010 Satoshi Nakamoto
// 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
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
@ -490,8 +490,9 @@ public:
CCoinsViewCache(CCoinsView *baseIn);
~CCoinsViewCache();
CNullifiersMap getNullifiers();
// Standard CCoinsView methods
//static CLaunchMap &LaunchMap() { return launchMap; }
bool GetSproutAnchorAt(const uint256 &rt, SproutMerkleTree &tree) const;
bool GetSaplingAnchorAt(const uint256 &rt, SaplingMerkleTree &tree) const;
bool GetNullifier(const uint256 &nullifier, ShieldedType type) const;

6
src/wallet/rpcwallet.cpp

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

8
src/wallet/wallet.cpp

@ -970,7 +970,13 @@ std::set<uint256> CWallet::GetNullifiers()
int64_t CWallet::NullifierCount()
{
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();
}

Loading…
Cancel
Save