diff --git a/src/coins.cpp b/src/coins.cpp index ae48c4f90..ea6970147 100644 --- a/src/coins.cpp +++ b/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()) diff --git a/src/coins.h b/src/coins.h index 9948a9e3c..cc8b19f68 100644 --- a/src/coins.h +++ b/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; diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 8a8d02654..39209effc 100644 --- a/src/wallet/rpcwallet.cpp +++ b/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; } diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 10bf3405a..97efb5e6d 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -970,7 +970,13 @@ std::set 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(); }