From 5a170adab8d890514235bdd28329086c89597b98 Mon Sep 17 00:00:00 2001 From: Jimmy Kiselak Date: Mon, 4 Jan 2016 19:04:55 -0500 Subject: [PATCH] change type of expiration queue --- src/claimtrie.cpp | 234 +++++++++++++++++++++++----------------------- src/claimtrie.h | 96 ++++++++++++------- src/miner.cpp | 4 +- src/undo.h | 4 +- 4 files changed, 181 insertions(+), 157 deletions(-) diff --git a/src/claimtrie.cpp b/src/claimtrie.cpp index 021561987..e080d7147 100644 --- a/src/claimtrie.cpp +++ b/src/claimtrie.cpp @@ -175,7 +175,7 @@ bool CClaimTrie::queueEmpty() const bool CClaimTrie::expirationQueueEmpty() const { - for (claimQueueType::const_iterator itRow = dirtyExpirationQueueRows.begin(); itRow != dirtyExpirationQueueRows.end(); ++itRow) + for (expirationQueueType::const_iterator itRow = dirtyExpirationQueueRows.begin(); itRow != dirtyExpirationQueueRows.end(); ++itRow) { if (!itRow->second.empty()) return false; @@ -255,12 +255,12 @@ bool CClaimTrie::haveSupport(const std::string& name, const COutPoint& outPoint) bool CClaimTrie::haveClaimInQueue(const std::string& name, const COutPoint& outPoint, int& nValidAtHeight) const { - outPointHeightRowType nameRow; + queueNameRowType nameRow; if (!getQueueNameRow(name, nameRow)) { return false; } - outPointHeightRowType::const_iterator itNameRow; + queueNameRowType::const_iterator itNameRow; for (itNameRow = nameRow.begin(); itNameRow != nameRow.end(); ++itNameRow) { if (itNameRow->outPoint == outPoint) @@ -294,12 +294,12 @@ bool CClaimTrie::haveClaimInQueue(const std::string& name, const COutPoint& outP bool CClaimTrie::haveSupportInQueue(const std::string& name, const COutPoint& outPoint, int& nValidAtHeight) const { - outPointHeightRowType nameRow; + queueNameRowType nameRow; if (!getSupportQueueNameRow(name, nameRow)) { return false; } - outPointHeightRowType::const_iterator itNameRow; + queueNameRowType::const_iterator itNameRow; for (itNameRow = nameRow.begin(); itNameRow != nameRow.end(); ++itNameRow) { if (itNameRow->outPoint == outPoint) @@ -499,9 +499,9 @@ bool CClaimTrie::getQueueRow(int nHeight, claimQueueRowType& row) const return db.Read(std::make_pair(CLAIM_QUEUE_ROW, nHeight), row); } -bool CClaimTrie::getQueueNameRow(const std::string& name, outPointHeightRowType& row) const +bool CClaimTrie::getQueueNameRow(const std::string& name, queueNameRowType& row) const { - nameOutPointHeightMapType::const_iterator itQueueNameRow = dirtyQueueNameRows.find(name); + queueNameType::const_iterator itQueueNameRow = dirtyQueueNameRows.find(name); if (itQueueNameRow != dirtyQueueNameRows.end()) { row = itQueueNameRow->second; @@ -510,9 +510,9 @@ bool CClaimTrie::getQueueNameRow(const std::string& name, outPointHeightRowType& return db.Read(std::make_pair(CLAIM_QUEUE_NAME_ROW, name), row); } -bool CClaimTrie::getExpirationQueueRow(int nHeight, claimQueueRowType& row) const +bool CClaimTrie::getExpirationQueueRow(int nHeight, expirationQueueRowType& row) const { - claimQueueType::const_iterator itQueueRow = dirtyExpirationQueueRows.find(nHeight); + expirationQueueType::const_iterator itQueueRow = dirtyExpirationQueueRows.find(nHeight); if (itQueueRow != dirtyExpirationQueueRows.end()) { row = itQueueRow->second; @@ -535,28 +535,28 @@ void CClaimTrie::updateQueueRow(int nHeight, claimQueueRowType& row) itQueueRow->second.swap(row); } -void CClaimTrie::updateQueueNameRow(const std::string& name, outPointHeightRowType& row) +void CClaimTrie::updateQueueNameRow(const std::string& name, queueNameRowType& row) { - nameOutPointHeightMapType::iterator itQueueRow = dirtyQueueNameRows.find(name); + queueNameType::iterator itQueueRow = dirtyQueueNameRows.find(name); if (itQueueRow == dirtyQueueNameRows.end()) { - outPointHeightRowType newRow; - std::pair ret; - ret = dirtyQueueNameRows.insert(std::pair(name, newRow)); + queueNameRowType newRow; + std::pair ret; + ret = dirtyQueueNameRows.insert(std::pair(name, newRow)); assert(ret.second); itQueueRow = ret.first; } itQueueRow->second.swap(row); } -void CClaimTrie::updateExpirationRow(int nHeight, claimQueueRowType& row) +void CClaimTrie::updateExpirationRow(int nHeight, expirationQueueRowType& row) { - claimQueueType::iterator itQueueRow = dirtyExpirationQueueRows.find(nHeight); + expirationQueueType::iterator itQueueRow = dirtyExpirationQueueRows.find(nHeight); if (itQueueRow == dirtyExpirationQueueRows.end()) { - claimQueueRowType newRow; - std::pair ret; - ret = dirtyExpirationQueueRows.insert(std::pair(nHeight, newRow)); + expirationQueueRowType newRow; + std::pair ret; + ret = dirtyExpirationQueueRows.insert(std::pair(nHeight, newRow)); assert(ret.second); itQueueRow = ret.first; } @@ -591,28 +591,28 @@ void CClaimTrie::updateSupportQueue(int nHeight, supportQueueRowType& row) itQueueRow->second.swap(row); } -void CClaimTrie::updateSupportNameQueue(const std::string& name, outPointHeightRowType& row) +void CClaimTrie::updateSupportNameQueue(const std::string& name, queueNameRowType& row) { - nameOutPointHeightMapType::iterator itQueueRow = dirtySupportQueueNameRows.find(name); + queueNameType::iterator itQueueRow = dirtySupportQueueNameRows.find(name); if (itQueueRow == dirtySupportQueueNameRows.end()) { - outPointHeightRowType newRow; - std::pair ret; - ret = dirtySupportQueueNameRows.insert(std::pair(name, newRow)); + queueNameRowType newRow; + std::pair ret; + ret = dirtySupportQueueNameRows.insert(std::pair(name, newRow)); assert(ret.second); itQueueRow = ret.first; } itQueueRow->second.swap(row); } -void CClaimTrie::updateSupportExpirationQueue(int nHeight, supportQueueRowType& row) +void CClaimTrie::updateSupportExpirationQueue(int nHeight, expirationQueueRowType& row) { - supportQueueType::iterator itQueueRow = dirtySupportExpirationQueueRows.find(nHeight); + expirationQueueType::iterator itQueueRow = dirtySupportExpirationQueueRows.find(nHeight); if (itQueueRow == dirtySupportExpirationQueueRows.end()) { - supportQueueRowType newRow; - std::pair ret; - ret = dirtySupportExpirationQueueRows.insert(std::pair(nHeight, newRow)); + expirationQueueRowType newRow; + std::pair ret; + ret = dirtySupportExpirationQueueRows.insert(std::pair(nHeight, newRow)); assert(ret.second); itQueueRow = ret.first; } @@ -641,9 +641,9 @@ bool CClaimTrie::getSupportQueueRow(int nHeight, supportQueueRowType& row) const return db.Read(std::make_pair(SUPPORT_QUEUE_ROW, nHeight), row); } -bool CClaimTrie::getSupportQueueNameRow(const std::string& name, outPointHeightRowType& row) const +bool CClaimTrie::getSupportQueueNameRow(const std::string& name, queueNameRowType& row) const { - nameOutPointHeightMapType::const_iterator itQueueNameRow = dirtySupportQueueNameRows.find(name); + queueNameType::const_iterator itQueueNameRow = dirtySupportQueueNameRows.find(name); if (itQueueNameRow != dirtySupportQueueNameRows.end()) { row = itQueueNameRow->second; @@ -652,9 +652,9 @@ bool CClaimTrie::getSupportQueueNameRow(const std::string& name, outPointHeightR return db.Read(std::make_pair(SUPPORT_QUEUE_NAME_ROW, name), row); } -bool CClaimTrie::getSupportExpirationQueueRow(int nHeight, supportQueueRowType& row) const +bool CClaimTrie::getSupportExpirationQueueRow(int nHeight, expirationQueueRowType& row) const { - supportQueueType::const_iterator itQueueRow = dirtySupportExpirationQueueRows.find(nHeight); + expirationQueueType::const_iterator itQueueRow = dirtySupportExpirationQueueRows.find(nHeight); if (itQueueRow != dirtySupportExpirationQueueRows.end()) { row = itQueueRow->second; @@ -663,7 +663,7 @@ bool CClaimTrie::getSupportExpirationQueueRow(int nHeight, supportQueueRowType& return db.Read(std::make_pair(SUPPORT_EXP_QUEUE_ROW, nHeight), row); } -bool CClaimTrie::update(nodeCacheType& cache, hashMapType& hashes, std::map& takeoverHeights, const uint256& hashBlockIn, claimQueueType& queueCache, nameOutPointHeightMapType& queueNameCache, claimQueueType& expirationQueueCache, int nNewHeight, supportMapType& supportCache, supportQueueType& supportQueueCache, nameOutPointHeightMapType& supportQueueNameCache, supportQueueType& supportExpirationQueueCache) +bool CClaimTrie::update(nodeCacheType& cache, hashMapType& hashes, std::map& takeoverHeights, const uint256& hashBlockIn, claimQueueType& queueCache, queueNameType& queueNameCache, expirationQueueType& expirationQueueCache, int nNewHeight, supportMapType& supportCache, supportQueueType& supportQueueCache, queueNameType& supportQueueNameCache, expirationQueueType& supportExpirationQueueCache) { for (nodeCacheType::iterator itcache = cache.begin(); itcache != cache.end(); ++itcache) { @@ -684,11 +684,11 @@ bool CClaimTrie::update(nodeCacheType& cache, hashMapType& hashes, std::mapfirst, itQueueCacheRow->second); } - for (nameOutPointHeightMapType::iterator itQueueNameCacheRow = queueNameCache.begin(); itQueueNameCacheRow != queueNameCache.end(); ++itQueueNameCacheRow) + for (queueNameType::iterator itQueueNameCacheRow = queueNameCache.begin(); itQueueNameCacheRow != queueNameCache.end(); ++itQueueNameCacheRow) { updateQueueNameRow(itQueueNameCacheRow->first, itQueueNameCacheRow->second); } - for (claimQueueType::iterator itExpirationRow = expirationQueueCache.begin(); itExpirationRow != expirationQueueCache.end(); ++itExpirationRow) + for (expirationQueueType::iterator itExpirationRow = expirationQueueCache.begin(); itExpirationRow != expirationQueueCache.end(); ++itExpirationRow) { updateExpirationRow(itExpirationRow->first, itExpirationRow->second); } @@ -700,11 +700,11 @@ bool CClaimTrie::update(nodeCacheType& cache, hashMapType& hashes, std::mapfirst, itSupportQueue->second); } - for (nameOutPointHeightMapType::iterator itSupportNameQueue = supportQueueNameCache.begin(); itSupportNameQueue != supportQueueNameCache.end(); ++itSupportNameQueue) + for (queueNameType::iterator itSupportNameQueue = supportQueueNameCache.begin(); itSupportNameQueue != supportQueueNameCache.end(); ++itSupportNameQueue) { updateSupportNameQueue(itSupportNameQueue->first, itSupportNameQueue->second); } - for (supportQueueType::iterator itSupportExpirationQueue = supportExpirationQueueCache.begin(); itSupportExpirationQueue != supportExpirationQueueCache.end(); ++itSupportExpirationQueue) + for (expirationQueueType::iterator itSupportExpirationQueue = supportExpirationQueueCache.begin(); itSupportExpirationQueue != supportExpirationQueueCache.end(); ++itSupportExpirationQueue) { updateSupportExpirationQueue(itSupportExpirationQueue->first, itSupportExpirationQueue->second); } @@ -844,7 +844,7 @@ void CClaimTrie::BatchWriteQueueRows(CLevelDBBatch& batch) void CClaimTrie::BatchWriteQueueNameRows(CLevelDBBatch& batch) { - for (nameOutPointHeightMapType::iterator itQueue = dirtyQueueNameRows.begin(); itQueue != dirtyQueueNameRows.end(); ++itQueue) + for (queueNameType::iterator itQueue = dirtyQueueNameRows.begin(); itQueue != dirtyQueueNameRows.end(); ++itQueue) { if (itQueue->second.empty()) { @@ -859,7 +859,7 @@ void CClaimTrie::BatchWriteQueueNameRows(CLevelDBBatch& batch) void CClaimTrie::BatchWriteExpirationQueueRows(CLevelDBBatch& batch) { - for (claimQueueType::iterator itQueue = dirtyExpirationQueueRows.begin(); itQueue != dirtyExpirationQueueRows.end(); ++itQueue) + for (expirationQueueType::iterator itQueue = dirtyExpirationQueueRows.begin(); itQueue != dirtyExpirationQueueRows.end(); ++itQueue) { if (itQueue->second.empty()) { @@ -904,7 +904,7 @@ void CClaimTrie::BatchWriteSupportQueueRows(CLevelDBBatch& batch) void CClaimTrie::BatchWriteSupportQueueNameRows(CLevelDBBatch& batch) { - for (nameOutPointHeightMapType::iterator itQueue = dirtySupportQueueNameRows.begin(); itQueue != dirtySupportQueueNameRows.end(); ++itQueue) + for (queueNameType::iterator itQueue = dirtySupportQueueNameRows.begin(); itQueue != dirtySupportQueueNameRows.end(); ++itQueue) { if (itQueue->second.empty()) { @@ -919,7 +919,7 @@ void CClaimTrie::BatchWriteSupportQueueNameRows(CLevelDBBatch& batch) void CClaimTrie::BatchWriteSupportExpirationQueueRows(CLevelDBBatch& batch) { - for (supportQueueType::iterator itQueue = dirtySupportExpirationQueueRows.begin(); itQueue != dirtySupportExpirationQueueRows.end(); ++itQueue) + for (expirationQueueType::iterator itQueue = dirtySupportExpirationQueueRows.begin(); itQueue != dirtySupportExpirationQueueRows.end(); ++itQueue) { if (itQueue->second.empty()) { @@ -950,6 +950,8 @@ bool CClaimTrie::WriteToDisk() dirtySupportQueueRows.clear(); BatchWriteSupportQueueNameRows(batch); dirtySupportQueueNameRows.clear(); + BatchWriteSupportExpirationQueueRows(batch); + dirtySupportExpirationQueueRows.clear(); batch.Write(HASH_BLOCK, hashBlock); batch.Write(CURRENT_HEIGHT, nCurrentHeight); return db.WriteBatch(batch); @@ -1383,21 +1385,21 @@ claimQueueType::iterator CClaimTrieCache::getQueueCacheRow(int nHeight, bool cre return itQueueRow; } -nameOutPointHeightMapType::iterator CClaimTrieCache::getQueueCacheNameRow(const std::string& name, bool createIfNotExists) const +queueNameType::iterator CClaimTrieCache::getQueueCacheNameRow(const std::string& name, bool createIfNotExists) const { - nameOutPointHeightMapType::iterator itQueueNameRow = claimQueueNameCache.find(name); + queueNameType::iterator itQueueNameRow = claimQueueNameCache.find(name); if (itQueueNameRow == claimQueueNameCache.end()) { // Have to make a new name row and put it in the cache, if createIfNotExists is true - outPointHeightRowType queueNameRow; + queueNameRowType queueNameRow; // If the row exists in the base, copy its claims into the new row. bool exists = base->getQueueNameRow(name, queueNameRow); if (!exists) if (!createIfNotExists) return itQueueNameRow; // Stick the new row in the cache - std::pair ret; - ret = claimQueueNameCache.insert(std::pair(name, queueNameRow)); + std::pair ret; + ret = claimQueueNameCache.insert(std::pair(name, queueNameRow)); assert(ret.second); itQueueNameRow = ret.first; } @@ -1429,8 +1431,8 @@ bool CClaimTrieCache::undoSpendClaim(const std::string& name, const COutPoint& o CClaimValue claim(outPoint, claimId, nAmount, nHeight, nValidAtHeight); if (nValidAtHeight < nCurrentHeight) { - claimQueueEntryType entry(name, claim); - addToExpirationQueue(entry); + nameOutPointType entry(name, claim.outPoint); + addToExpirationQueue(claim.nHeight + base->nExpirationTime, entry); return insertClaimIntoTrie(name, claim, false); } else @@ -1444,21 +1446,22 @@ bool CClaimTrieCache::addClaimToQueues(const std::string& name, CClaimValue& cla LogPrintf("%s: nValidAtHeight: %d\n", __func__, claim.nValidAtHeight); claimQueueEntryType entry(name, claim); claimQueueType::iterator itQueueRow = getQueueCacheRow(claim.nValidAtHeight, true); - nameOutPointHeightMapType::iterator itQueueNameRow = getQueueCacheNameRow(name, true); + queueNameType::iterator itQueueNameRow = getQueueCacheNameRow(name, true); itQueueRow->second.push_back(entry); itQueueNameRow->second.push_back(outPointHeightType(claim.outPoint, claim.nValidAtHeight)); - addToExpirationQueue(entry); + nameOutPointType expireEntry(name, claim.outPoint); + addToExpirationQueue(claim.nHeight + base->nExpirationTime, expireEntry); return true; } bool CClaimTrieCache::removeClaimFromQueue(const std::string& name, const COutPoint& outPoint, CClaimValue& claim) const { - nameOutPointHeightMapType::iterator itQueueNameRow = getQueueCacheNameRow(name, false); + queueNameType::iterator itQueueNameRow = getQueueCacheNameRow(name, false); if (itQueueNameRow == claimQueueNameCache.end()) { return false; } - outPointHeightRowType::iterator itQueueName; + queueNameRowType::iterator itQueueName; for (itQueueName = itQueueNameRow->second.begin(); itQueueName != itQueueNameRow->second.end(); ++itQueueName) { if (itQueueName->outPoint == outPoint) @@ -1525,24 +1528,22 @@ bool CClaimTrieCache::removeClaim(const std::string& name, const COutPoint& outP return removed; } -void CClaimTrieCache::addToExpirationQueue(claimQueueEntryType& entry) const +void CClaimTrieCache::addToExpirationQueue(int nExpirationHeight, nameOutPointType& entry) const { - int expirationHeight = entry.second.nHeight + base->nExpirationTime; - claimQueueType::iterator itQueueRow = getExpirationQueueCacheRow(expirationHeight, true); + expirationQueueType::iterator itQueueRow = getExpirationQueueCacheRow(nExpirationHeight, true); itQueueRow->second.push_back(entry); } void CClaimTrieCache::removeFromExpirationQueue(const std::string& name, const COutPoint& outPoint, int nHeight) const { int expirationHeight = nHeight + base->nExpirationTime; - claimQueueType::iterator itQueueRow = getExpirationQueueCacheRow(expirationHeight, false); - claimQueueRowType::iterator itQueue; - if (itQueueRow != claimQueueCache.end()) + expirationQueueType::iterator itQueueRow = getExpirationQueueCacheRow(expirationHeight, false); + expirationQueueRowType::iterator itQueue; + if (itQueueRow != expirationQueueCache.end()) { for (itQueue = itQueueRow->second.begin(); itQueue != itQueueRow->second.end(); ++itQueue) { - CClaimValue& claim = itQueue->second; - if (name == itQueue->first && claim.outPoint == outPoint) + if (name == itQueue->name && outPoint == itQueue->outPoint) break; } } @@ -1552,21 +1553,21 @@ void CClaimTrieCache::removeFromExpirationQueue(const std::string& name, const C } } -claimQueueType::iterator CClaimTrieCache::getExpirationQueueCacheRow(int nHeight, bool createIfNotExists) const +expirationQueueType::iterator CClaimTrieCache::getExpirationQueueCacheRow(int nHeight, bool createIfNotExists) const { - claimQueueType::iterator itQueueRow = expirationQueueCache.find(nHeight); + expirationQueueType::iterator itQueueRow = expirationQueueCache.find(nHeight); if (itQueueRow == expirationQueueCache.end()) { // Have to make a new row it put in the cache, if createIfNotExists is true - claimQueueRowType queueRow; + expirationQueueRowType queueRow; // If the row exists in the base, copy its claims into the new row. bool exists = base->getExpirationQueueRow(nHeight, queueRow); if (!exists) if (!createIfNotExists) return itQueueRow; // Stick the new row in the cache - std::pair ret; - ret = expirationQueueCache.insert(std::pair(nHeight, queueRow)); + std::pair ret; + ret = expirationQueueCache.insert(std::pair(nHeight, queueRow)); assert(ret.second); itQueueRow = ret.first; } @@ -1728,19 +1729,19 @@ supportQueueType::iterator CClaimTrieCache::getSupportQueueCacheRow(int nHeight, return itQueueRow; } -nameOutPointHeightMapType::iterator CClaimTrieCache::getSupportQueueCacheNameRow(const std::string& name, bool createIfNotExists) const +queueNameType::iterator CClaimTrieCache::getSupportQueueCacheNameRow(const std::string& name, bool createIfNotExists) const { - nameOutPointHeightMapType::iterator itQueueNameRow = supportQueueNameCache.find(name); + queueNameType::iterator itQueueNameRow = supportQueueNameCache.find(name); if (itQueueNameRow == supportQueueNameCache.end()) { - outPointHeightRowType queueNameRow; + queueNameRowType queueNameRow; bool exists = base->getSupportQueueNameRow(name, queueNameRow); if (!exists) if (!createIfNotExists) return itQueueNameRow; // Stick the new row in the name cache - std::pair ret; - ret = supportQueueNameCache.insert(std::pair(name, queueNameRow)); + std::pair ret; + ret = supportQueueNameCache.insert(std::pair(name, queueNameRow)); assert(ret.second); itQueueNameRow = ret.first; } @@ -1752,21 +1753,22 @@ bool CClaimTrieCache::addSupportToQueues(const std::string& name, CSupportValue& LogPrintf("%s: nValidAtHeight: %d\n", __func__, support.nValidAtHeight); supportQueueEntryType entry(name, support); supportQueueType::iterator itQueueRow = getSupportQueueCacheRow(support.nValidAtHeight, true); - nameOutPointHeightMapType::iterator itQueueNameRow = getSupportQueueCacheNameRow(name, true); + queueNameType::iterator itQueueNameRow = getSupportQueueCacheNameRow(name, true); itQueueRow->second.push_back(entry); itQueueNameRow->second.push_back(outPointHeightType(support.outPoint, support.nValidAtHeight)); - addSupportToExpirationQueue(entry); + nameOutPointType expireEntry(name, support.outPoint); + addSupportToExpirationQueue(support.nHeight + base->nExpirationTime, expireEntry); return true; } bool CClaimTrieCache::removeSupportFromQueue(const std::string& name, const COutPoint& outPoint, CSupportValue& support) const { - nameOutPointHeightMapType::iterator itQueueNameRow = getSupportQueueCacheNameRow(name, false); + queueNameType::iterator itQueueNameRow = getSupportQueueCacheNameRow(name, false); if (itQueueNameRow == supportQueueNameCache.end()) { return false; } - outPointHeightRowType::iterator itQueueName; + queueNameRowType::iterator itQueueName; for (itQueueName = itQueueNameRow->second.begin(); itQueueName != itQueueNameRow->second.end(); ++itQueueName) { if (itQueueName->outPoint == outPoint) @@ -1827,8 +1829,8 @@ bool CClaimTrieCache::undoSpendSupport(const std::string& name, const COutPoint& CSupportValue support(outPoint, supportedClaimId, nAmount, nHeight, nValidAtHeight); if (nValidAtHeight < nCurrentHeight) { - supportQueueEntryType entry(name, support); - addSupportToExpirationQueue(entry); + nameOutPointType entry(name, support.outPoint); + addSupportToExpirationQueue(support.nHeight + base->nExpirationTime, entry); return insertSupportIntoMap(name, support, false); } else @@ -1853,24 +1855,22 @@ bool CClaimTrieCache::removeSupport(const std::string& name, const COutPoint& ou return removed; } -void CClaimTrieCache::addSupportToExpirationQueue(supportQueueEntryType& entry) const +void CClaimTrieCache::addSupportToExpirationQueue(int nExpirationHeight, nameOutPointType& entry) const { - int expirationHeight = entry.second.nHeight + base->nExpirationTime; - supportQueueType::iterator itQueueRow = getSupportExpirationQueueCacheRow(expirationHeight, true); + expirationQueueType::iterator itQueueRow = getSupportExpirationQueueCacheRow(nExpirationHeight, true); itQueueRow->second.push_back(entry); } void CClaimTrieCache::removeSupportFromExpirationQueue(const std::string& name, const COutPoint& outPoint, int nHeight) const { int expirationHeight = nHeight + base->nExpirationTime; - supportQueueType::iterator itQueueRow = getSupportExpirationQueueCacheRow(expirationHeight, false); - supportQueueRowType::iterator itQueue; + expirationQueueType::iterator itQueueRow = getSupportExpirationQueueCacheRow(expirationHeight, false); + expirationQueueRowType::iterator itQueue; if (itQueueRow != supportExpirationQueueCache.end()) { for (itQueue = itQueueRow->second.begin(); itQueue != itQueueRow->second.end(); ++itQueue) { - CSupportValue& support = itQueue->second; - if (name == itQueue->first && support.outPoint == outPoint) + if (name == itQueue->name && outPoint == itQueue->outPoint) break; } } @@ -1880,21 +1880,21 @@ void CClaimTrieCache::removeSupportFromExpirationQueue(const std::string& name, } } -supportQueueType::iterator CClaimTrieCache::getSupportExpirationQueueCacheRow(int nHeight, bool createIfNotExists) const +expirationQueueType::iterator CClaimTrieCache::getSupportExpirationQueueCacheRow(int nHeight, bool createIfNotExists) const { - supportQueueType::iterator itQueueRow = supportExpirationQueueCache.find(nHeight); + expirationQueueType::iterator itQueueRow = supportExpirationQueueCache.find(nHeight); if (itQueueRow == supportExpirationQueueCache.end()) { // Have to make a new row it put in the cache, if createIfNotExists is true - supportQueueRowType queueRow; + expirationQueueRowType queueRow; // If the row exists in the base, copy its claims into the new row. bool exists = base->getSupportExpirationQueueRow(nHeight, queueRow); if (!exists) if (!createIfNotExists) return itQueueRow; // Stick the new row in the cache - std::pair ret; - ret = supportExpirationQueueCache.insert(std::pair(nHeight, queueRow)); + std::pair ret; + ret = supportExpirationQueueCache.insert(std::pair(nHeight, queueRow)); assert(ret.second); itQueueRow = ret.first; } @@ -1914,7 +1914,7 @@ bool CClaimTrieCache::spendSupport(const std::string& name, const COutPoint& out return removeSupport(name, outPoint, nHeight, nValidAtHeight, true); } -bool CClaimTrieCache::incrementBlock(nameOutPointHeightRowType& insertUndo, claimQueueRowType& expireUndo, nameOutPointHeightRowType& insertSupportUndo, supportQueueRowType& expireSupportUndo, std::vector >& takeoverHeightUndo) const +bool CClaimTrieCache::incrementBlock(insertUndoType& insertUndo, claimQueueRowType& expireUndo, insertUndoType& insertSupportUndo, supportQueueRowType& expireSupportUndo, std::vector >& takeoverHeightUndo) const { LogPrintf("%s: nCurrentHeight (before increment): %d\n", __func__, nCurrentHeight); claimQueueType::iterator itQueueRow = getQueueCacheRow(nCurrentHeight, false); @@ -1923,10 +1923,10 @@ bool CClaimTrieCache::incrementBlock(nameOutPointHeightRowType& insertUndo, clai for (claimQueueRowType::iterator itEntry = itQueueRow->second.begin(); itEntry != itQueueRow->second.end(); ++itEntry) { bool found = false; - nameOutPointHeightMapType::iterator itQueueNameRow = getQueueCacheNameRow(itEntry->first, false); + queueNameType::iterator itQueueNameRow = getQueueCacheNameRow(itEntry->first, false); if (itQueueNameRow != claimQueueNameCache.end()) { - for (outPointHeightRowType::iterator itQueueName = itQueueNameRow->second.begin(); itQueueName != itQueueNameRow->second.end(); ++itQueueName) + for (queueNameRowType::iterator itQueueName = itQueueNameRow->second.begin(); itQueueName != itQueueNameRow->second.end(); ++itQueueName) { if (itQueueName->outPoint == itEntry->second.outPoint && itQueueName->nHeight == nCurrentHeight) { @@ -1942,7 +1942,7 @@ bool CClaimTrieCache::incrementBlock(nameOutPointHeightRowType& insertUndo, clai if (itQueueNameRow != claimQueueNameCache.end()) { LogPrintf("Claims found for that name:\n"); - for (outPointHeightRowType::iterator itQueueName = itQueueNameRow->second.begin(); itQueueName != itQueueNameRow->second.end(); ++itQueueName) + for (queueNameRowType::iterator itQueueName = itQueueNameRow->second.begin(); itQueueName != itQueueNameRow->second.end(); ++itQueueName) { LogPrintf("\ttxid: %s, nOut: %d, nValidAtHeight: %d\n", itQueueName->outPoint.hash.GetHex(), itQueueName->outPoint.n, itQueueName->nHeight); } @@ -1958,14 +1958,14 @@ bool CClaimTrieCache::incrementBlock(nameOutPointHeightRowType& insertUndo, clai } itQueueRow->second.clear(); } - claimQueueType::iterator itExpirationRow = getExpirationQueueCacheRow(nCurrentHeight, false); + expirationQueueType::iterator itExpirationRow = getExpirationQueueCacheRow(nCurrentHeight, false); if (itExpirationRow != expirationQueueCache.end()) { - for (claimQueueRowType::iterator itEntry = itExpirationRow->second.begin(); itEntry != itExpirationRow->second.end(); ++itEntry) + for (expirationQueueRowType::iterator itEntry = itExpirationRow->second.begin(); itEntry != itExpirationRow->second.end(); ++itEntry) { CClaimValue claim; - assert(removeClaimFromTrie(itEntry->first, itEntry->second.outPoint, claim, true)); - expireUndo.push_back(std::make_pair(itEntry->first, claim)); + assert(removeClaimFromTrie(itEntry->name, itEntry->outPoint, claim, true)); + expireUndo.push_back(std::make_pair(itEntry->name, claim)); } itExpirationRow->second.clear(); } @@ -1975,10 +1975,10 @@ bool CClaimTrieCache::incrementBlock(nameOutPointHeightRowType& insertUndo, clai for (supportQueueRowType::iterator itSupport = itSupportRow->second.begin(); itSupport != itSupportRow->second.end(); ++itSupport) { bool found = false; - nameOutPointHeightMapType::iterator itSupportNameRow = getSupportQueueCacheNameRow(itSupport->first, false); + queueNameType::iterator itSupportNameRow = getSupportQueueCacheNameRow(itSupport->first, false); if (itSupportNameRow != supportQueueNameCache.end()) { - for (outPointHeightRowType::iterator itSupportName = itSupportNameRow->second.begin(); itSupportName != itSupportNameRow->second.end(); ++itSupportName) + for (queueNameRowType::iterator itSupportName = itSupportNameRow->second.begin(); itSupportName != itSupportNameRow->second.end(); ++itSupportName) { if (itSupportName->outPoint == itSupport->second.outPoint && itSupportName->nHeight == itSupport->second.nValidAtHeight) { @@ -1994,7 +1994,7 @@ bool CClaimTrieCache::incrementBlock(nameOutPointHeightRowType& insertUndo, clai if (itSupportNameRow != supportQueueNameCache.end()) { LogPrintf("Supports found for that name:\n"); - for (outPointHeightRowType::iterator itSupportName = itSupportNameRow->second.begin(); itSupportName != itSupportNameRow->second.end(); ++itSupportName) + for (queueNameRowType::iterator itSupportName = itSupportNameRow->second.begin(); itSupportName != itSupportNameRow->second.end(); ++itSupportName) { LogPrintf("\ttxid: %s, nOut: %d, nValidAtHeight: %d\n", itSupportName->outPoint.hash.GetHex(), itSupportName->outPoint.n, itSupportName->nHeight); } @@ -2009,14 +2009,14 @@ bool CClaimTrieCache::incrementBlock(nameOutPointHeightRowType& insertUndo, clai } itSupportRow->second.clear(); } - supportQueueType::iterator itSupportExpirationRow = getSupportExpirationQueueCacheRow(nCurrentHeight, false); + expirationQueueType::iterator itSupportExpirationRow = getSupportExpirationQueueCacheRow(nCurrentHeight, false); if (itSupportExpirationRow != supportExpirationQueueCache.end()) { - for (supportQueueRowType::iterator itEntry = itSupportExpirationRow->second.begin(); itEntry != itSupportExpirationRow->second.end(); ++itEntry) + for (expirationQueueRowType::iterator itEntry = itSupportExpirationRow->second.begin(); itEntry != itSupportExpirationRow->second.end(); ++itEntry) { CSupportValue support; - assert(removeSupportFromMap(itEntry->first, itEntry->second.outPoint, support, true)); - expireSupportUndo.push_back(std::make_pair(itEntry->first, support)); + assert(removeSupportFromMap(itEntry->name, itEntry->outPoint, support, true)); + expireSupportUndo.push_back(std::make_pair(itEntry->name, support)); } itSupportExpirationRow->second.clear(); } @@ -2073,10 +2073,10 @@ bool CClaimTrieCache::incrementBlock(nameOutPointHeightRowType& insertUndo, clai if (takeoverHappened) { // Get all claims in the queue for that name - nameOutPointHeightMapType::iterator itQueueNameRow = getQueueCacheNameRow(*itNamesToCheck, false); + queueNameType::iterator itQueueNameRow = getQueueCacheNameRow(*itNamesToCheck, false); if (itQueueNameRow != claimQueueNameCache.end()) { - for (outPointHeightRowType::iterator itQueueName = itQueueNameRow->second.begin(); itQueueName != itQueueNameRow->second.end(); ++itQueueName) + for (queueNameRowType::iterator itQueueName = itQueueNameRow->second.begin(); itQueueName != itQueueNameRow->second.end(); ++itQueueName) { bool found = false; // Pull those claims out of the height-based queue @@ -2114,10 +2114,10 @@ bool CClaimTrieCache::incrementBlock(nameOutPointHeightRowType& insertUndo, clai } // // Then, get all supports in the queue for that name - nameOutPointHeightMapType::iterator itSupportQueueNameRow = getSupportQueueCacheNameRow(*itNamesToCheck, false); + queueNameType::iterator itSupportQueueNameRow = getSupportQueueCacheNameRow(*itNamesToCheck, false); if (itSupportQueueNameRow != supportQueueNameCache.end()) { - for (outPointHeightRowType::iterator itSupportQueueName = itSupportQueueNameRow->second.begin(); itSupportQueueName != itSupportQueueNameRow->second.end(); ++itSupportQueueName) + for (queueNameRowType::iterator itSupportQueueName = itSupportQueueNameRow->second.begin(); itSupportQueueName != itSupportQueueNameRow->second.end(); ++itSupportQueueName) { // Pull those supports out of the height-based queue supportQueueType::iterator itSupportQueueRow = getSupportQueueCacheRow(itSupportQueueName->nHeight, false); @@ -2174,47 +2174,47 @@ bool CClaimTrieCache::incrementBlock(nameOutPointHeightRowType& insertUndo, clai return true; } -bool CClaimTrieCache::decrementBlock(nameOutPointHeightRowType& insertUndo, claimQueueRowType& expireUndo, nameOutPointHeightRowType& insertSupportUndo, supportQueueRowType& expireSupportUndo, std::vector >& takeoverHeightUndo) const +bool CClaimTrieCache::decrementBlock(insertUndoType& insertUndo, claimQueueRowType& expireUndo, insertUndoType& insertSupportUndo, supportQueueRowType& expireSupportUndo, std::vector >& takeoverHeightUndo) const { LogPrintf("%s: nCurrentHeight (before decrement): %d\n", __func__, nCurrentHeight); nCurrentHeight--; if (expireSupportUndo.begin() != expireSupportUndo.end()) { - supportQueueType::iterator itSupportExpireRow = getSupportExpirationQueueCacheRow(nCurrentHeight, true); + expirationQueueType::iterator itSupportExpireRow = getSupportExpirationQueueCacheRow(nCurrentHeight, true); for (supportQueueRowType::iterator itSupportExpireUndo = expireSupportUndo.begin(); itSupportExpireUndo != expireSupportUndo.end(); ++itSupportExpireUndo) { insertSupportIntoMap(itSupportExpireUndo->first, itSupportExpireUndo->second, false); - itSupportExpireRow->second.push_back(*itSupportExpireUndo); + itSupportExpireRow->second.push_back(nameOutPointType(itSupportExpireUndo->first, itSupportExpireUndo->second.outPoint)); } } - for (nameOutPointHeightRowType::iterator itSupportUndo = insertSupportUndo.begin(); itSupportUndo != insertSupportUndo.end(); ++itSupportUndo) + for (insertUndoType::iterator itSupportUndo = insertSupportUndo.begin(); itSupportUndo != insertSupportUndo.end(); ++itSupportUndo) { supportQueueType::iterator itSupportRow = getSupportQueueCacheRow(itSupportUndo->nHeight, true); CSupportValue support; assert(removeSupportFromMap(itSupportUndo->name, itSupportUndo->outPoint, support, false)); - nameOutPointHeightMapType::iterator itSupportNameRow = getSupportQueueCacheNameRow(itSupportUndo->name, true); + queueNameType::iterator itSupportNameRow = getSupportQueueCacheNameRow(itSupportUndo->name, true); itSupportRow->second.push_back(std::make_pair(itSupportUndo->name, support)); itSupportNameRow->second.push_back(outPointHeightType(support.outPoint, support.nValidAtHeight)); } if (expireUndo.begin() != expireUndo.end()) { - claimQueueType::iterator itExpireRow = getExpirationQueueCacheRow(nCurrentHeight, true); + expirationQueueType::iterator itExpireRow = getExpirationQueueCacheRow(nCurrentHeight, true); for (claimQueueRowType::iterator itExpireUndo = expireUndo.begin(); itExpireUndo != expireUndo.end(); ++itExpireUndo) { insertClaimIntoTrie(itExpireUndo->first, itExpireUndo->second, false); - itExpireRow->second.push_back(*itExpireUndo); + itExpireRow->second.push_back(nameOutPointType(itExpireUndo->first, itExpireUndo->second.outPoint)); } } - for (nameOutPointHeightRowType::iterator itInsertUndo = insertUndo.begin(); itInsertUndo != insertUndo.end(); ++itInsertUndo) + for (insertUndoType::iterator itInsertUndo = insertUndo.begin(); itInsertUndo != insertUndo.end(); ++itInsertUndo) { claimQueueType::iterator itQueueRow = getQueueCacheRow(itInsertUndo->nHeight, true); CClaimValue claim; assert(removeClaimFromTrie(itInsertUndo->name, itInsertUndo->outPoint, claim, false)); - nameOutPointHeightMapType::iterator itQueueNameRow = getQueueCacheNameRow(itInsertUndo->name, true); + queueNameType::iterator itQueueNameRow = getQueueCacheNameRow(itInsertUndo->name, true); itQueueRow->second.push_back(std::make_pair(itInsertUndo->name, claim)); itQueueNameRow->second.push_back(outPointHeightType(itInsertUndo->outPoint, itInsertUndo->nHeight)); } diff --git a/src/claimtrie.h b/src/claimtrie.h index e1ee79004..f95a92c5e 100644 --- a/src/claimtrie.h +++ b/src/claimtrie.h @@ -221,16 +221,39 @@ struct nameOutPointHeightType } }; +struct nameOutPointType +{ + std::string name; + COutPoint outPoint; + + nameOutPointType() {} + + nameOutPointType(std::string name, COutPoint outPoint) + : name(name), outPoint(outPoint) {} + + ADD_SERIALIZE_METHODS; + + template + inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) + { + READWRITE(name); + READWRITE(outPoint); + } +}; + typedef std::pair claimQueueEntryType; typedef std::pair supportQueueEntryType; typedef std::map supportMapType; -typedef std::vector outPointHeightRowType; +typedef std::vector queueNameRowType; +typedef std::map queueNameType; -typedef std::vector nameOutPointHeightRowType; -typedef std::map nameOutPointHeightMapType; +typedef std::vector insertUndoType; + +typedef std::vector expirationQueueRowType; +typedef std::map expirationQueueType; typedef std::vector claimQueueRowType; typedef std::map claimQueueType; @@ -277,12 +300,12 @@ public: void setExpirationTime(int t); bool getQueueRow(int nHeight, claimQueueRowType& row) const; - bool getQueueNameRow(const std::string& name, outPointHeightRowType& row) const; - bool getExpirationQueueRow(int nHeight, claimQueueRowType& row) const; + bool getQueueNameRow(const std::string& name, queueNameRowType& row) const; + bool getExpirationQueueRow(int nHeight, expirationQueueRowType& row) const; bool getSupportNode(std::string name, supportMapEntryType& node) const; bool getSupportQueueRow(int nHeight, supportQueueRowType& row) const; - bool getSupportQueueNameRow(const std::string& name, outPointHeightRowType& row) const; - bool getSupportExpirationQueueRow(int nHeight, supportQueueRowType& row) const; + bool getSupportQueueNameRow(const std::string& name, queueNameRowType& row) const; + bool getSupportExpirationQueueRow(int nHeight, expirationQueueRowType& row) const; bool haveClaim(const std::string& name, const COutPoint& outPoint) const; bool haveClaimInQueue(const std::string& name, const COutPoint& outPoint, @@ -310,12 +333,12 @@ private: bool update(nodeCacheType& cache, hashMapType& hashes, std::map& takeoverHeights, const uint256& hashBlock, claimQueueType& queueCache, - nameOutPointHeightMapType& queueNameCache, - claimQueueType& expirationQueueCache, int nNewHeight, + queueNameType& queueNameCache, + expirationQueueType& expirationQueueCache, int nNewHeight, supportMapType& supportCache, supportQueueType& supportQueueCache, - nameOutPointHeightMapType& supportQueueNameCache, - supportQueueType& supportExpirationQueueCache); + queueNameType& supportQueueNameCache, + expirationQueueType& supportExpirationQueueCache); bool updateName(const std::string& name, CClaimTrieNode* updatedNode); bool updateHash(const std::string& name, uint256& hash); bool updateTakeoverHeight(const std::string& name, int nTakeoverHeight); @@ -336,13 +359,13 @@ private: void markNodeDirty(const std::string& name, CClaimTrieNode* node); void updateQueueRow(int nHeight, claimQueueRowType& row); void updateQueueNameRow(const std::string& name, - outPointHeightRowType& row); - void updateExpirationRow(int nHeight, claimQueueRowType& row); + queueNameRowType& row); + void updateExpirationRow(int nHeight, expirationQueueRowType& row); void updateSupportMap(const std::string& name, supportMapEntryType& node); void updateSupportQueue(int nHeight, supportQueueRowType& row); void updateSupportNameQueue(const std::string& name, - outPointHeightRowType& row); - void updateSupportExpirationQueue(int nHeight, supportQueueRowType& row); + queueNameRowType& row); + void updateSupportExpirationQueue(int nHeight, expirationQueueRowType& row); void BatchWriteNode(CLevelDBBatch& batch, const std::string& name, const CClaimTrieNode* pNode) const; @@ -360,12 +383,12 @@ private: uint256 hashBlock; claimQueueType dirtyQueueRows; - nameOutPointHeightMapType dirtyQueueNameRows; - claimQueueType dirtyExpirationQueueRows; + queueNameType dirtyQueueNameRows; + expirationQueueType dirtyExpirationQueueRows; supportQueueType dirtySupportQueueRows; - nameOutPointHeightMapType dirtySupportQueueNameRows; - supportQueueType dirtySupportExpirationQueueRows; + queueNameType dirtySupportQueueNameRows; + expirationQueueType dirtySupportExpirationQueueRows; nodeCacheType dirtyNodes; supportMapType dirtySupportNodes; @@ -412,14 +435,14 @@ public: uint256 getBestBlock(); void setBestBlock(const uint256& hashBlock); - bool incrementBlock(nameOutPointHeightRowType& insertUndo, + bool incrementBlock(insertUndoType& insertUndo, claimQueueRowType& expireUndo, - nameOutPointHeightRowType& insertSupportUndo, + insertUndoType& insertSupportUndo, supportQueueRowType& expireSupportUndo, std::vector >& takeoverHeightUndo) const; - bool decrementBlock(nameOutPointHeightRowType& insertUndo, + bool decrementBlock(insertUndoType& insertUndo, claimQueueRowType& expireUndo, - nameOutPointHeightRowType& insertSupportUndo, + insertUndoType& insertSupportUndo, supportQueueRowType& expireSupportUndo, std::vector >& takeoverHeightUndo) const; @@ -439,12 +462,12 @@ private: mutable std::set dirtyHashes; mutable hashMapType cacheHashes; mutable claimQueueType claimQueueCache; - mutable nameOutPointHeightMapType claimQueueNameCache; - mutable claimQueueType expirationQueueCache; + mutable queueNameType claimQueueNameCache; + mutable expirationQueueType expirationQueueCache; mutable supportMapType supportCache; mutable supportQueueType supportQueueCache; - mutable nameOutPointHeightMapType supportQueueNameCache; - mutable supportQueueType supportExpirationQueueCache; + mutable queueNameType supportQueueNameCache; + mutable expirationQueueType supportExpirationQueueCache; mutable std::set namesToCheckForTakeover; mutable std::map cacheTakeoverHeights; mutable int nCurrentHeight; // Height of the block that is being worked on, which is @@ -469,16 +492,16 @@ private: bool addClaimToQueues(const std::string& name, CClaimValue& claim) const; bool removeClaimFromQueue(const std::string& name, const COutPoint& outPoint, CClaimValue& claim) const; - void addToExpirationQueue(claimQueueEntryType& entry) const; + void addToExpirationQueue(int nExpirationHeight, nameOutPointType& entry) const; void removeFromExpirationQueue(const std::string& name, const COutPoint& outPoint, int nHeight) const; claimQueueType::iterator getQueueCacheRow(int nHeight, bool createIfNotExists) const; - nameOutPointHeightMapType::iterator getQueueCacheNameRow(const std::string& name, - bool createIfNotExists) const; - claimQueueType::iterator getExpirationQueueCacheRow(int nHeight, - bool createIfNotExists) const; + queueNameType::iterator getQueueCacheNameRow(const std::string& name, + bool createIfNotExists) const; + expirationQueueType::iterator getExpirationQueueCacheRow(int nHeight, + bool createIfNotExists) const; bool removeSupport(const std::string& name, const COutPoint& outPoint, int nHeight, int& nValidAtHeight, @@ -493,16 +516,17 @@ private: supportQueueType::iterator getSupportQueueCacheRow(int nHeight, bool createIfNotExists) const; - nameOutPointHeightMapType::iterator getSupportQueueCacheNameRow(const std::string& name, + queueNameType::iterator getSupportQueueCacheNameRow(const std::string& name, bool createIfNotExists) const; - supportQueueType::iterator getSupportExpirationQueueCacheRow(int nHeight, - bool createIfNotExists) const; + expirationQueueType::iterator getSupportExpirationQueueCacheRow(int nHeight, + bool createIfNotExists) const; bool addSupportToQueues(const std::string& name, CSupportValue& support) const; bool removeSupportFromQueue(const std::string& name, const COutPoint& outPoint, CSupportValue& support) const; - void addSupportToExpirationQueue(supportQueueEntryType& entry) const; + void addSupportToExpirationQueue(int nExpirationHeight, + nameOutPointType& entry) const; void removeSupportFromExpirationQueue(const std::string& name, const COutPoint& outPoint, int nHeight) const; diff --git a/src/miner.cpp b/src/miner.cpp index fd022b726..7ccfd5ff2 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -464,9 +464,9 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) pblock->nBits = GetNextWorkRequired(pindexPrev, pblock, Params().GetConsensus()); pblock->nNonce = 0; pblocktemplate->vTxSigOps[0] = GetLegacySigOpCount(pblock->vtx[0]); - nameOutPointHeightRowType dummyInsertUndo; + insertUndoType dummyInsertUndo; claimQueueRowType dummyExpireUndo; - nameOutPointHeightRowType dummyInsertSupportUndo; + insertUndoType dummyInsertSupportUndo; supportQueueRowType dummyExpireSupportUndo; std::vector > dummyTakeoverHeightUndo; trieCache.incrementBlock(dummyInsertUndo, dummyExpireUndo, dummyInsertSupportUndo, dummyExpireSupportUndo, dummyTakeoverHeightUndo); diff --git a/src/undo.h b/src/undo.h index 78aa3dc59..b8171245e 100644 --- a/src/undo.h +++ b/src/undo.h @@ -84,9 +84,9 @@ class CBlockUndo { public: std::vector vtxundo; // for all but the coinbase - nameOutPointHeightRowType insertUndo; // any claims that went from the queue to the trie + insertUndoType insertUndo; // any claims that went from the queue to the trie claimQueueRowType expireUndo; // any claims that expired - nameOutPointHeightRowType insertSupportUndo; // any supports that went from the support queue to the support map + insertUndoType insertSupportUndo; // any supports that went from the support queue to the support map supportQueueRowType expireSupportUndo; // any supports that expired std::vector > takeoverHeightUndo; // for any name that was taken over, the previous time that name was taken over