Rename mapSerials to mapNullifiers.
This commit is contained in:
@@ -50,7 +50,7 @@ bool CCoinsView::BatchWrite(CCoinsMap &mapCoins,
|
|||||||
const uint256 &hashBlock,
|
const uint256 &hashBlock,
|
||||||
const uint256 &hashAnchor,
|
const uint256 &hashAnchor,
|
||||||
CAnchorsMap &mapAnchors,
|
CAnchorsMap &mapAnchors,
|
||||||
CNullifiersMap &mapSerials) { return false; }
|
CNullifiersMap &mapNullifiers) { return false; }
|
||||||
bool CCoinsView::GetStats(CCoinsStats &stats) const { return false; }
|
bool CCoinsView::GetStats(CCoinsStats &stats) const { return false; }
|
||||||
|
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ bool CCoinsViewBacked::BatchWrite(CCoinsMap &mapCoins,
|
|||||||
const uint256 &hashBlock,
|
const uint256 &hashBlock,
|
||||||
const uint256 &hashAnchor,
|
const uint256 &hashAnchor,
|
||||||
CAnchorsMap &mapAnchors,
|
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); }
|
bool CCoinsViewBacked::GetStats(CCoinsStats &stats) const { return base->GetStats(stats); }
|
||||||
|
|
||||||
CCoinsKeyHasher::CCoinsKeyHasher() : salt(GetRandHash()) {}
|
CCoinsKeyHasher::CCoinsKeyHasher() : salt(GetRandHash()) {}
|
||||||
@@ -260,7 +260,7 @@ bool CCoinsViewCache::BatchWrite(CCoinsMap &mapCoins,
|
|||||||
const uint256 &hashBlockIn,
|
const uint256 &hashBlockIn,
|
||||||
const uint256 &hashAnchorIn,
|
const uint256 &hashAnchorIn,
|
||||||
CAnchorsMap &mapAnchors,
|
CAnchorsMap &mapAnchors,
|
||||||
CNullifiersMap &mapSerials) {
|
CNullifiersMap &mapNullifiers) {
|
||||||
assert(!hasModifier);
|
assert(!hasModifier);
|
||||||
for (CCoinsMap::iterator it = mapCoins.begin(); it != mapCoins.end();) {
|
for (CCoinsMap::iterator it = mapCoins.begin(); it != mapCoins.end();) {
|
||||||
if (it->second.flags & CCoinsCacheEntry::DIRTY) { // Ignore non-dirty entries (optimization).
|
if (it->second.flags & CCoinsCacheEntry::DIRTY) { // Ignore non-dirty entries (optimization).
|
||||||
@@ -326,7 +326,7 @@ bool CCoinsViewCache::BatchWrite(CCoinsMap &mapCoins,
|
|||||||
mapAnchors.erase(itOld);
|
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).
|
if (child_it->second.flags & CSerialsCacheEntry::DIRTY) { // Ignore non-dirty entries (optimization).
|
||||||
CNullifiersMap::iterator parent_it = cacheSerials.find(child_it->first);
|
CNullifiersMap::iterator parent_it = cacheSerials.find(child_it->first);
|
||||||
@@ -348,7 +348,7 @@ bool CCoinsViewCache::BatchWrite(CCoinsMap &mapCoins,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
CNullifiersMap::iterator itOld = child_it++;
|
CNullifiersMap::iterator itOld = child_it++;
|
||||||
mapSerials.erase(itOld);
|
mapNullifiers.erase(itOld);
|
||||||
}
|
}
|
||||||
|
|
||||||
hashAnchor = hashAnchorIn;
|
hashAnchor = hashAnchorIn;
|
||||||
|
|||||||
@@ -368,7 +368,7 @@ public:
|
|||||||
const uint256 &hashBlock,
|
const uint256 &hashBlock,
|
||||||
const uint256 &hashAnchor,
|
const uint256 &hashAnchor,
|
||||||
CAnchorsMap &mapAnchors,
|
CAnchorsMap &mapAnchors,
|
||||||
CNullifiersMap &mapSerials);
|
CNullifiersMap &mapNullifiers);
|
||||||
|
|
||||||
//! Calculate statistics about the unspent transaction output set
|
//! Calculate statistics about the unspent transaction output set
|
||||||
virtual bool GetStats(CCoinsStats &stats) const;
|
virtual bool GetStats(CCoinsStats &stats) const;
|
||||||
@@ -397,7 +397,7 @@ public:
|
|||||||
const uint256 &hashBlock,
|
const uint256 &hashBlock,
|
||||||
const uint256 &hashAnchor,
|
const uint256 &hashAnchor,
|
||||||
CAnchorsMap &mapAnchors,
|
CAnchorsMap &mapAnchors,
|
||||||
CNullifiersMap &mapSerials);
|
CNullifiersMap &mapNullifiers);
|
||||||
bool GetStats(CCoinsStats &stats) const;
|
bool GetStats(CCoinsStats &stats) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -461,7 +461,7 @@ public:
|
|||||||
const uint256 &hashBlock,
|
const uint256 &hashBlock,
|
||||||
const uint256 &hashAnchor,
|
const uint256 &hashAnchor,
|
||||||
CAnchorsMap &mapAnchors,
|
CAnchorsMap &mapAnchors,
|
||||||
CNullifiersMap &mapSerials);
|
CNullifiersMap &mapNullifiers);
|
||||||
|
|
||||||
|
|
||||||
// Adds the tree to mapAnchors and sets the current commitment
|
// 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 JSDescription &pour, tx.vjoinsplit) {
|
||||||
BOOST_FOREACH(const uint256 &serial, pour.nullifiers) {
|
BOOST_FOREACH(const uint256 &serial, pour.nullifiers) {
|
||||||
if (pool.mapSerials.count(serial))
|
if (pool.mapNullifiers.count(serial))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class CCoinsViewTest : public CCoinsView
|
|||||||
uint256 hashBestAnchor_;
|
uint256 hashBestAnchor_;
|
||||||
std::map<uint256, CCoins> map_;
|
std::map<uint256, CCoins> map_;
|
||||||
std::map<uint256, ZCIncrementalMerkleTree> mapAnchors_;
|
std::map<uint256, ZCIncrementalMerkleTree> mapAnchors_;
|
||||||
std::map<uint256, bool> mapSerials_;
|
std::map<uint256, bool> mapNullifiers_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CCoinsViewTest() {
|
CCoinsViewTest() {
|
||||||
@@ -49,9 +49,9 @@ public:
|
|||||||
|
|
||||||
bool GetNullifier(const uint256 &serial) const
|
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;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
// The map shouldn't contain any false entries.
|
// The map shouldn't contain any false entries.
|
||||||
@@ -88,7 +88,7 @@ public:
|
|||||||
const uint256& hashBlock,
|
const uint256& hashBlock,
|
||||||
const uint256& hashAnchor,
|
const uint256& hashAnchor,
|
||||||
CAnchorsMap& mapAnchors,
|
CAnchorsMap& mapAnchors,
|
||||||
CNullifiersMap& mapSerials)
|
CNullifiersMap& mapNullifiers)
|
||||||
{
|
{
|
||||||
for (CCoinsMap::iterator it = mapCoins.begin(); it != mapCoins.end(); ) {
|
for (CCoinsMap::iterator it = mapCoins.begin(); it != mapCoins.end(); ) {
|
||||||
map_[it->first] = it->second.coins;
|
map_[it->first] = it->second.coins;
|
||||||
@@ -109,17 +109,17 @@ public:
|
|||||||
}
|
}
|
||||||
mapAnchors.erase(it++);
|
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) {
|
if (it->second.entered) {
|
||||||
mapSerials_[it->first] = true;
|
mapNullifiers_[it->first] = true;
|
||||||
} else {
|
} else {
|
||||||
mapSerials_.erase(it->first);
|
mapNullifiers_.erase(it->first);
|
||||||
}
|
}
|
||||||
mapSerials.erase(it++);
|
mapNullifiers.erase(it++);
|
||||||
}
|
}
|
||||||
mapCoins.clear();
|
mapCoins.clear();
|
||||||
mapAnchors.clear();
|
mapAnchors.clear();
|
||||||
mapSerials.clear();
|
mapNullifiers.clear();
|
||||||
hashBestBlock_ = hashBlock;
|
hashBestBlock_ = hashBlock;
|
||||||
hashBestAnchor_ = hashAnchor;
|
hashBestAnchor_ = hashAnchor;
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ bool CCoinsViewDB::BatchWrite(CCoinsMap &mapCoins,
|
|||||||
const uint256 &hashBlock,
|
const uint256 &hashBlock,
|
||||||
const uint256 &hashAnchor,
|
const uint256 &hashAnchor,
|
||||||
CAnchorsMap &mapAnchors,
|
CAnchorsMap &mapAnchors,
|
||||||
CNullifiersMap &mapSerials) {
|
CNullifiersMap &mapNullifiers) {
|
||||||
CLevelDBBatch batch;
|
CLevelDBBatch batch;
|
||||||
size_t count = 0;
|
size_t count = 0;
|
||||||
size_t changed = 0;
|
size_t changed = 0;
|
||||||
@@ -137,13 +137,13 @@ bool CCoinsViewDB::BatchWrite(CCoinsMap &mapCoins,
|
|||||||
mapAnchors.erase(itOld);
|
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) {
|
if (it->second.flags & CSerialsCacheEntry::DIRTY) {
|
||||||
BatchWriteSerial(batch, it->first, it->second.entered);
|
BatchWriteSerial(batch, it->first, it->second.entered);
|
||||||
// TODO: changed++?
|
// TODO: changed++?
|
||||||
}
|
}
|
||||||
CNullifiersMap::iterator itOld = it++;
|
CNullifiersMap::iterator itOld = it++;
|
||||||
mapSerials.erase(itOld);
|
mapNullifiers.erase(itOld);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hashBlock.IsNull())
|
if (!hashBlock.IsNull())
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public:
|
|||||||
const uint256 &hashBlock,
|
const uint256 &hashBlock,
|
||||||
const uint256 &hashAnchor,
|
const uint256 &hashAnchor,
|
||||||
CAnchorsMap &mapAnchors,
|
CAnchorsMap &mapAnchors,
|
||||||
CNullifiersMap &mapSerials);
|
CNullifiersMap &mapNullifiers);
|
||||||
bool GetStats(CCoinsStats &stats) const;
|
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);
|
mapNextTx[tx.vin[i].prevout] = CInPoint(&tx, i);
|
||||||
BOOST_FOREACH(const JSDescription &pour, tx.vjoinsplit) {
|
BOOST_FOREACH(const JSDescription &pour, tx.vjoinsplit) {
|
||||||
BOOST_FOREACH(const uint256 &serial, pour.nullifiers) {
|
BOOST_FOREACH(const uint256 &serial, pour.nullifiers) {
|
||||||
mapSerials[serial] = &tx;
|
mapNullifiers[serial] = &tx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nTransactionsUpdated++;
|
nTransactionsUpdated++;
|
||||||
@@ -150,7 +150,7 @@ void CTxMemPool::remove(const CTransaction &origTx, std::list<CTransaction>& rem
|
|||||||
mapNextTx.erase(txin.prevout);
|
mapNextTx.erase(txin.prevout);
|
||||||
BOOST_FOREACH(const JSDescription& pour, tx.vjoinsplit) {
|
BOOST_FOREACH(const JSDescription& pour, tx.vjoinsplit) {
|
||||||
BOOST_FOREACH(const uint256& serial, pour.nullifiers) {
|
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 JSDescription &pour, tx.vjoinsplit) {
|
||||||
BOOST_FOREACH(const uint256 &serial, pour.nullifiers) {
|
BOOST_FOREACH(const uint256 &serial, pour.nullifiers) {
|
||||||
std::map<uint256, const CTransaction*>::iterator it = mapSerials.find(serial);
|
std::map<uint256, const CTransaction*>::iterator it = mapNullifiers.find(serial);
|
||||||
if (it != mapSerials.end()) {
|
if (it != mapNullifiers.end()) {
|
||||||
const CTransaction &txConflict = *it->second;
|
const CTransaction &txConflict = *it->second;
|
||||||
if (txConflict != tx)
|
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);
|
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();
|
uint256 hash = it->second->GetHash();
|
||||||
map<uint256, CTxMemPoolEntry>::const_iterator it2 = mapTx.find(hash);
|
map<uint256, CTxMemPoolEntry>::const_iterator it2 = mapTx.find(hash);
|
||||||
const CTransaction& tx = it2->second.GetTx();
|
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) { }
|
CCoinsViewMemPool::CCoinsViewMemPool(CCoinsView *baseIn, CTxMemPool &mempoolIn) : CCoinsViewBacked(baseIn), mempool(mempoolIn) { }
|
||||||
|
|
||||||
bool CCoinsViewMemPool::GetNullifier(const uint256 &serial) const {
|
bool CCoinsViewMemPool::GetNullifier(const uint256 &serial) const {
|
||||||
if (mempool.mapSerials.count(serial))
|
if (mempool.mapNullifiers.count(serial))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return base->GetNullifier(serial);
|
return base->GetNullifier(serial);
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ public:
|
|||||||
mutable CCriticalSection cs;
|
mutable CCriticalSection cs;
|
||||||
std::map<uint256, CTxMemPoolEntry> mapTx;
|
std::map<uint256, CTxMemPoolEntry> mapTx;
|
||||||
std::map<COutPoint, CInPoint> mapNextTx;
|
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;
|
std::map<uint256, std::pair<double, CAmount> > mapDeltas;
|
||||||
|
|
||||||
CTxMemPool(const CFeeRate& _minRelayFee);
|
CTxMemPool(const CFeeRate& _minRelayFee);
|
||||||
|
|||||||
Reference in New Issue
Block a user