diff --git a/src/coins.cpp b/src/coins.cpp index ad5b8f18b..bd77f0bfe 100644 --- a/src/coins.cpp +++ b/src/coins.cpp @@ -50,7 +50,7 @@ bool CCoinsView::BatchWrite(CCoinsMap &mapCoins, const uint256 &hashBlock, const uint256 &hashAnchor, CAnchorsMap &mapAnchors, - CNullifiersMap &mapSerials) { return false; } + CNullifiersMap &mapNullifiers) { return false; } bool CCoinsView::GetStats(CCoinsStats &stats) const { return false; } @@ -67,7 +67,7 @@ bool CCoinsViewBacked::BatchWrite(CCoinsMap &mapCoins, const uint256 &hashBlock, const uint256 &hashAnchor, CAnchorsMap &mapAnchors, - CNullifiersMap &mapSerials) { return base->BatchWrite(mapCoins, hashBlock, hashAnchor, mapAnchors, mapSerials); } + CNullifiersMap &mapNullifiers) { return base->BatchWrite(mapCoins, hashBlock, hashAnchor, mapAnchors, mapNullifiers); } bool CCoinsViewBacked::GetStats(CCoinsStats &stats) const { return base->GetStats(stats); } CCoinsKeyHasher::CCoinsKeyHasher() : salt(GetRandHash()) {} @@ -260,7 +260,7 @@ bool CCoinsViewCache::BatchWrite(CCoinsMap &mapCoins, const uint256 &hashBlockIn, const uint256 &hashAnchorIn, CAnchorsMap &mapAnchors, - CNullifiersMap &mapSerials) { + CNullifiersMap &mapNullifiers) { assert(!hasModifier); for (CCoinsMap::iterator it = mapCoins.begin(); it != mapCoins.end();) { if (it->second.flags & CCoinsCacheEntry::DIRTY) { // Ignore non-dirty entries (optimization). @@ -326,7 +326,7 @@ bool CCoinsViewCache::BatchWrite(CCoinsMap &mapCoins, mapAnchors.erase(itOld); } - for (CNullifiersMap::iterator child_it = mapSerials.begin(); child_it != mapSerials.end();) + for (CNullifiersMap::iterator child_it = mapNullifiers.begin(); child_it != mapNullifiers.end();) { if (child_it->second.flags & CSerialsCacheEntry::DIRTY) { // Ignore non-dirty entries (optimization). CNullifiersMap::iterator parent_it = cacheSerials.find(child_it->first); @@ -348,7 +348,7 @@ bool CCoinsViewCache::BatchWrite(CCoinsMap &mapCoins, } } CNullifiersMap::iterator itOld = child_it++; - mapSerials.erase(itOld); + mapNullifiers.erase(itOld); } hashAnchor = hashAnchorIn; diff --git a/src/coins.h b/src/coins.h index f00372100..4e0dd63d1 100644 --- a/src/coins.h +++ b/src/coins.h @@ -368,7 +368,7 @@ public: const uint256 &hashBlock, const uint256 &hashAnchor, CAnchorsMap &mapAnchors, - CNullifiersMap &mapSerials); + CNullifiersMap &mapNullifiers); //! Calculate statistics about the unspent transaction output set virtual bool GetStats(CCoinsStats &stats) const; @@ -397,7 +397,7 @@ public: const uint256 &hashBlock, const uint256 &hashAnchor, CAnchorsMap &mapAnchors, - CNullifiersMap &mapSerials); + CNullifiersMap &mapNullifiers); bool GetStats(CCoinsStats &stats) const; }; @@ -461,7 +461,7 @@ public: const uint256 &hashBlock, const uint256 &hashAnchor, CAnchorsMap &mapAnchors, - CNullifiersMap &mapSerials); + CNullifiersMap &mapNullifiers); // Adds the tree to mapAnchors and sets the current commitment diff --git a/src/main.cpp b/src/main.cpp index 3b50dc48f..326318fd8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1106,7 +1106,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa } BOOST_FOREACH(const JSDescription &pour, tx.vjoinsplit) { BOOST_FOREACH(const uint256 &serial, pour.nullifiers) { - if (pool.mapSerials.count(serial)) + if (pool.mapNullifiers.count(serial)) { return false; } diff --git a/src/test/coins_tests.cpp b/src/test/coins_tests.cpp index 4ab9832a3..4e6d8fe04 100644 --- a/src/test/coins_tests.cpp +++ b/src/test/coins_tests.cpp @@ -24,7 +24,7 @@ class CCoinsViewTest : public CCoinsView uint256 hashBestAnchor_; std::map map_; std::map mapAnchors_; - std::map mapSerials_; + std::map mapNullifiers_; public: CCoinsViewTest() { @@ -49,9 +49,9 @@ public: bool GetNullifier(const uint256 &serial) const { - std::map::const_iterator it = mapSerials_.find(serial); + std::map::const_iterator it = mapNullifiers_.find(serial); - if (it == mapSerials_.end()) { + if (it == mapNullifiers_.end()) { return false; } else { // The map shouldn't contain any false entries. @@ -88,7 +88,7 @@ public: const uint256& hashBlock, const uint256& hashAnchor, CAnchorsMap& mapAnchors, - CNullifiersMap& mapSerials) + CNullifiersMap& mapNullifiers) { for (CCoinsMap::iterator it = mapCoins.begin(); it != mapCoins.end(); ) { map_[it->first] = it->second.coins; @@ -109,17 +109,17 @@ public: } mapAnchors.erase(it++); } - for (CNullifiersMap::iterator it = mapSerials.begin(); it != mapSerials.end(); ) { + for (CNullifiersMap::iterator it = mapNullifiers.begin(); it != mapNullifiers.end(); ) { if (it->second.entered) { - mapSerials_[it->first] = true; + mapNullifiers_[it->first] = true; } else { - mapSerials_.erase(it->first); + mapNullifiers_.erase(it->first); } - mapSerials.erase(it++); + mapNullifiers.erase(it++); } mapCoins.clear(); mapAnchors.clear(); - mapSerials.clear(); + mapNullifiers.clear(); hashBestBlock_ = hashBlock; hashBestAnchor_ = hashAnchor; return true; diff --git a/src/txdb.cpp b/src/txdb.cpp index af5e9119c..df02c4a5a 100644 --- a/src/txdb.cpp +++ b/src/txdb.cpp @@ -114,7 +114,7 @@ bool CCoinsViewDB::BatchWrite(CCoinsMap &mapCoins, const uint256 &hashBlock, const uint256 &hashAnchor, CAnchorsMap &mapAnchors, - CNullifiersMap &mapSerials) { + CNullifiersMap &mapNullifiers) { CLevelDBBatch batch; size_t count = 0; size_t changed = 0; @@ -137,13 +137,13 @@ bool CCoinsViewDB::BatchWrite(CCoinsMap &mapCoins, mapAnchors.erase(itOld); } - for (CNullifiersMap::iterator it = mapSerials.begin(); it != mapSerials.end();) { + for (CNullifiersMap::iterator it = mapNullifiers.begin(); it != mapNullifiers.end();) { if (it->second.flags & CSerialsCacheEntry::DIRTY) { BatchWriteSerial(batch, it->first, it->second.entered); // TODO: changed++? } CNullifiersMap::iterator itOld = it++; - mapSerials.erase(itOld); + mapNullifiers.erase(itOld); } if (!hashBlock.IsNull()) diff --git a/src/txdb.h b/src/txdb.h index 4402b119f..293ceb850 100644 --- a/src/txdb.h +++ b/src/txdb.h @@ -44,7 +44,7 @@ public: const uint256 &hashBlock, const uint256 &hashAnchor, CAnchorsMap &mapAnchors, - CNullifiersMap &mapSerials); + CNullifiersMap &mapNullifiers); bool GetStats(CCoinsStats &stats) const; }; diff --git a/src/txmempool.cpp b/src/txmempool.cpp index 6f38c0e9f..373fd7a80 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -101,7 +101,7 @@ bool CTxMemPool::addUnchecked(const uint256& hash, const CTxMemPoolEntry &entry, mapNextTx[tx.vin[i].prevout] = CInPoint(&tx, i); BOOST_FOREACH(const JSDescription &pour, tx.vjoinsplit) { BOOST_FOREACH(const uint256 &serial, pour.nullifiers) { - mapSerials[serial] = &tx; + mapNullifiers[serial] = &tx; } } nTransactionsUpdated++; @@ -150,7 +150,7 @@ void CTxMemPool::remove(const CTransaction &origTx, std::list& rem mapNextTx.erase(txin.prevout); BOOST_FOREACH(const JSDescription& pour, tx.vjoinsplit) { BOOST_FOREACH(const uint256& serial, pour.nullifiers) { - mapSerials.erase(serial); + mapNullifiers.erase(serial); } } @@ -232,8 +232,8 @@ void CTxMemPool::removeConflicts(const CTransaction &tx, std::list BOOST_FOREACH(const JSDescription &pour, tx.vjoinsplit) { BOOST_FOREACH(const uint256 &serial, pour.nullifiers) { - std::map::iterator it = mapSerials.find(serial); - if (it != mapSerials.end()) { + std::map::iterator it = mapNullifiers.find(serial); + if (it != mapNullifiers.end()) { const CTransaction &txConflict = *it->second; if (txConflict != tx) { @@ -370,7 +370,7 @@ void CTxMemPool::check(const CCoinsViewCache *pcoins) const assert(it->first == it->second.ptx->vin[it->second.n].prevout); } - for (std::map::const_iterator it = mapSerials.begin(); it != mapSerials.end(); it++) { + for (std::map::const_iterator it = mapNullifiers.begin(); it != mapNullifiers.end(); it++) { uint256 hash = it->second->GetHash(); map::const_iterator it2 = mapTx.find(hash); const CTransaction& tx = it2->second.GetTx(); @@ -485,7 +485,7 @@ bool CTxMemPool::HasNoInputsOf(const CTransaction &tx) const CCoinsViewMemPool::CCoinsViewMemPool(CCoinsView *baseIn, CTxMemPool &mempoolIn) : CCoinsViewBacked(baseIn), mempool(mempoolIn) { } bool CCoinsViewMemPool::GetNullifier(const uint256 &serial) const { - if (mempool.mapSerials.count(serial)) + if (mempool.mapNullifiers.count(serial)) return true; return base->GetNullifier(serial); diff --git a/src/txmempool.h b/src/txmempool.h index f2ff7ffd2..a6901fde6 100644 --- a/src/txmempool.h +++ b/src/txmempool.h @@ -98,7 +98,7 @@ public: mutable CCriticalSection cs; std::map mapTx; std::map mapNextTx; - std::map mapSerials; + std::map mapNullifiers; std::map > mapDeltas; CTxMemPool(const CFeeRate& _minRelayFee);