Rename mapSerials to mapNullifiers.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ class CCoinsViewTest : public CCoinsView
|
||||
uint256 hashBestAnchor_;
|
||||
std::map<uint256, CCoins> map_;
|
||||
std::map<uint256, ZCIncrementalMerkleTree> mapAnchors_;
|
||||
std::map<uint256, bool> mapSerials_;
|
||||
std::map<uint256, bool> mapNullifiers_;
|
||||
|
||||
public:
|
||||
CCoinsViewTest() {
|
||||
@@ -49,9 +49,9 @@ public:
|
||||
|
||||
bool GetNullifier(const uint256 &serial) const
|
||||
{
|
||||
std::map<uint256, bool>::const_iterator it = mapSerials_.find(serial);
|
||||
std::map<uint256, bool>::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;
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
const uint256 &hashBlock,
|
||||
const uint256 &hashAnchor,
|
||||
CAnchorsMap &mapAnchors,
|
||||
CNullifiersMap &mapSerials);
|
||||
CNullifiersMap &mapNullifiers);
|
||||
bool GetStats(CCoinsStats &stats) const;
|
||||
};
|
||||
|
||||
|
||||
@@ -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<CTransaction>& 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<CTransaction>
|
||||
|
||||
BOOST_FOREACH(const JSDescription &pour, tx.vjoinsplit) {
|
||||
BOOST_FOREACH(const uint256 &serial, pour.nullifiers) {
|
||||
std::map<uint256, const CTransaction*>::iterator it = mapSerials.find(serial);
|
||||
if (it != mapSerials.end()) {
|
||||
std::map<uint256, const CTransaction*>::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<uint256, const CTransaction*>::const_iterator it = mapSerials.begin(); it != mapSerials.end(); it++) {
|
||||
for (std::map<uint256, const CTransaction*>::const_iterator it = mapNullifiers.begin(); it != mapNullifiers.end(); it++) {
|
||||
uint256 hash = it->second->GetHash();
|
||||
map<uint256, CTxMemPoolEntry>::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);
|
||||
|
||||
@@ -98,7 +98,7 @@ public:
|
||||
mutable CCriticalSection cs;
|
||||
std::map<uint256, CTxMemPoolEntry> mapTx;
|
||||
std::map<COutPoint, CInPoint> mapNextTx;
|
||||
std::map<uint256, const CTransaction*> mapSerials;
|
||||
std::map<uint256, const CTransaction*> mapNullifiers;
|
||||
std::map<uint256, std::pair<double, CAmount> > mapDeltas;
|
||||
|
||||
CTxMemPool(const CFeeRate& _minRelayFee);
|
||||
|
||||
Reference in New Issue
Block a user