diff --git a/src/coins.cpp b/src/coins.cpp index 48155a5df..c8bd65a9d 100644 --- a/src/coins.cpp +++ b/src/coins.cpp @@ -41,7 +41,7 @@ bool CCoins::Spend(uint32_t nPos) return true; } bool CCoinsView::GetAnchorAt(const uint256 &rt, ZCIncrementalMerkleTree &tree) const { return false; } -bool CCoinsView::GetSerial(const uint256 &serial) const { return false; } +bool CCoinsView::GetNullifier(const uint256 &serial) const { return false; } bool CCoinsView::GetCoins(const uint256 &txid, CCoins &coins) const { return false; } bool CCoinsView::HaveCoins(const uint256 &txid) const { return false; } uint256 CCoinsView::GetBestBlock() const { return uint256(); } @@ -57,7 +57,7 @@ bool CCoinsView::GetStats(CCoinsStats &stats) const { return false; } CCoinsViewBacked::CCoinsViewBacked(CCoinsView *viewIn) : base(viewIn) { } bool CCoinsViewBacked::GetAnchorAt(const uint256 &rt, ZCIncrementalMerkleTree &tree) const { return base->GetAnchorAt(rt, tree); } -bool CCoinsViewBacked::GetSerial(const uint256 &serial) const { return base->GetSerial(serial); } +bool CCoinsViewBacked::GetNullifier(const uint256 &serial) const { return base->GetNullifier(serial); } bool CCoinsViewBacked::GetCoins(const uint256 &txid, CCoins &coins) const { return base->GetCoins(txid, coins); } bool CCoinsViewBacked::HaveCoins(const uint256 &txid) const { return base->HaveCoins(txid); } uint256 CCoinsViewBacked::GetBestBlock() const { return base->GetBestBlock(); } @@ -128,13 +128,13 @@ bool CCoinsViewCache::GetAnchorAt(const uint256 &rt, ZCIncrementalMerkleTree &tr return true; } -bool CCoinsViewCache::GetSerial(const uint256 &serial) const { +bool CCoinsViewCache::GetNullifier(const uint256 &serial) const { CSerialsMap::iterator it = cacheSerials.find(serial); if (it != cacheSerials.end()) return it->second.entered; CSerialsCacheEntry entry; - bool tmp = base->GetSerial(serial); + bool tmp = base->GetNullifier(serial); entry.entered = tmp; cacheSerials.insert(std::make_pair(serial, entry)); @@ -398,7 +398,7 @@ bool CCoinsViewCache::HaveJoinSplitRequirements(const CTransaction& tx) const { BOOST_FOREACH(const uint256& serial, pour.nullifiers) { - if (GetSerial(serial)) { + if (GetNullifier(serial)) { // If the serial is set, this transaction // double-spends! return false; diff --git a/src/coins.h b/src/coins.h index 0e2cfb6d5..219583b10 100644 --- a/src/coins.h +++ b/src/coins.h @@ -347,7 +347,7 @@ public: virtual bool GetAnchorAt(const uint256 &rt, ZCIncrementalMerkleTree &tree) const; //! Determine whether a serial is spent or not - virtual bool GetSerial(const uint256 &serial) const; + virtual bool GetNullifier(const uint256 &serial) const; //! Retrieve the CCoins (unspent transaction outputs) for a given txid virtual bool GetCoins(const uint256 &txid, CCoins &coins) const; @@ -387,7 +387,7 @@ protected: public: CCoinsViewBacked(CCoinsView *viewIn); bool GetAnchorAt(const uint256 &rt, ZCIncrementalMerkleTree &tree) const; - bool GetSerial(const uint256 &serial) const; + bool GetNullifier(const uint256 &serial) const; bool GetCoins(const uint256 &txid, CCoins &coins) const; bool HaveCoins(const uint256 &txid) const; uint256 GetBestBlock() const; @@ -451,7 +451,7 @@ public: // Standard CCoinsView methods bool GetAnchorAt(const uint256 &rt, ZCIncrementalMerkleTree &tree) const; - bool GetSerial(const uint256 &serial) const; + bool GetNullifier(const uint256 &serial) const; bool GetCoins(const uint256 &txid, CCoins &coins) const; bool HaveCoins(const uint256 &txid) const; uint256 GetBestBlock() const; diff --git a/src/test/coins_tests.cpp b/src/test/coins_tests.cpp index a492dcb73..40c0a6cc0 100644 --- a/src/test/coins_tests.cpp +++ b/src/test/coins_tests.cpp @@ -47,7 +47,7 @@ public: } } - bool GetSerial(const uint256 &serial) const + bool GetNullifier(const uint256 &serial) const { std::map::const_iterator it = mapSerials_.find(serial); @@ -170,21 +170,21 @@ BOOST_AUTO_TEST_CASE(serials_test) uint256 myserial = GetRandHash(); - BOOST_CHECK(!cache.GetSerial(myserial)); + BOOST_CHECK(!cache.GetNullifier(myserial)); cache.SetSerial(myserial, true); - BOOST_CHECK(cache.GetSerial(myserial)); + BOOST_CHECK(cache.GetNullifier(myserial)); cache.Flush(); CCoinsViewCacheTest cache2(&base); - BOOST_CHECK(cache2.GetSerial(myserial)); + BOOST_CHECK(cache2.GetNullifier(myserial)); cache2.SetSerial(myserial, false); - BOOST_CHECK(!cache2.GetSerial(myserial)); + BOOST_CHECK(!cache2.GetNullifier(myserial)); cache2.Flush(); CCoinsViewCacheTest cache3(&base); - BOOST_CHECK(!cache3.GetSerial(myserial)); + BOOST_CHECK(!cache3.GetNullifier(myserial)); } BOOST_AUTO_TEST_CASE(anchors_flush_test) diff --git a/src/txdb.cpp b/src/txdb.cpp index 5e971a827..b7bd0e742 100644 --- a/src/txdb.cpp +++ b/src/txdb.cpp @@ -81,7 +81,7 @@ bool CCoinsViewDB::GetAnchorAt(const uint256 &rt, ZCIncrementalMerkleTree &tree) return read; } -bool CCoinsViewDB::GetSerial(const uint256 &serial) const { +bool CCoinsViewDB::GetNullifier(const uint256 &serial) const { bool spent = false; bool read = db.Read(make_pair(DB_SERIAL, serial), spent); diff --git a/src/txdb.h b/src/txdb.h index 8e6782141..f24b48abb 100644 --- a/src/txdb.h +++ b/src/txdb.h @@ -35,7 +35,7 @@ public: CCoinsViewDB(size_t nCacheSize, bool fMemory = false, bool fWipe = false); bool GetAnchorAt(const uint256 &rt, ZCIncrementalMerkleTree &tree) const; - bool GetSerial(const uint256 &serial) const; + bool GetNullifier(const uint256 &serial) const; bool GetCoins(const uint256 &txid, CCoins &coins) const; bool HaveCoins(const uint256 &txid) const; uint256 GetBestBlock() const; diff --git a/src/txmempool.cpp b/src/txmempool.cpp index 34b39650e..6f38c0e9f 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -319,7 +319,7 @@ void CTxMemPool::check(const CCoinsViewCache *pcoins) const BOOST_FOREACH(const JSDescription &pour, tx.vjoinsplit) { BOOST_FOREACH(const uint256 &serial, pour.nullifiers) { - assert(!pcoins->GetSerial(serial)); + assert(!pcoins->GetNullifier(serial)); } ZCIncrementalMerkleTree tree; @@ -484,11 +484,11 @@ bool CTxMemPool::HasNoInputsOf(const CTransaction &tx) const CCoinsViewMemPool::CCoinsViewMemPool(CCoinsView *baseIn, CTxMemPool &mempoolIn) : CCoinsViewBacked(baseIn), mempool(mempoolIn) { } -bool CCoinsViewMemPool::GetSerial(const uint256 &serial) const { +bool CCoinsViewMemPool::GetNullifier(const uint256 &serial) const { if (mempool.mapSerials.count(serial)) return true; - return base->GetSerial(serial); + return base->GetNullifier(serial); } bool CCoinsViewMemPool::GetCoins(const uint256 &txid, CCoins &coins) const { diff --git a/src/txmempool.h b/src/txmempool.h index 972daa722..f2ff7ffd2 100644 --- a/src/txmempool.h +++ b/src/txmempool.h @@ -177,7 +177,7 @@ protected: public: CCoinsViewMemPool(CCoinsView *baseIn, CTxMemPool &mempoolIn); - bool GetSerial(const uint256 &txid) const; + bool GetNullifier(const uint256 &txid) const; bool GetCoins(const uint256 &txid, CCoins &coins) const; bool HaveCoins(const uint256 &txid) const; };