hacktober fest #214

Closed
Z3N00 wants to merge 304 commits from zeno into master
Showing only changes of commit 76d4b51843 - Show all commits

View file

@ -2178,24 +2178,17 @@ bool CClaimTrieCache::decrementBlock(claimQueueRowType& insertUndo, claimQueueRo
{ {
LogPrintf("%s: nCurrentHeight (before decrement): %d\n", __func__, nCurrentHeight); LogPrintf("%s: nCurrentHeight (before decrement): %d\n", __func__, nCurrentHeight);
nCurrentHeight--; nCurrentHeight--;
for (claimQueueRowType::iterator itInsertUndo = insertUndo.begin(); itInsertUndo != insertUndo.end(); ++itInsertUndo)
if (expireSupportUndo.begin() != expireSupportUndo.end())
{ {
claimQueueType::iterator itQueueRow = getQueueCacheRow(itInsertUndo->second.nValidAtHeight, true); supportQueueType::iterator itSupportExpireRow = getSupportExpirationQueueCacheRow(nCurrentHeight, true);
CClaimValue claim; for (supportQueueRowType::iterator itSupportExpireUndo = expireSupportUndo.begin(); itSupportExpireUndo != expireSupportUndo.end(); ++itSupportExpireUndo)
assert(removeClaimFromTrie(itInsertUndo->first, itInsertUndo->second.outPoint, claim, false));
claimQueueNamesType::iterator itQueueNameRow = getQueueCacheNameRow(itInsertUndo->first, true);
itQueueRow->second.push_back(std::make_pair(itInsertUndo->first, claim));
itQueueNameRow->second.push_back(std::make_pair(itInsertUndo->second.outPoint, itInsertUndo->second.nValidAtHeight));
}
if (expireUndo.begin() != expireUndo.end())
{ {
claimQueueType::iterator itExpireRow = getExpirationQueueCacheRow(nCurrentHeight, true); insertSupportIntoMap(itSupportExpireUndo->first, itSupportExpireUndo->second, false);
for (claimQueueRowType::iterator itExpireUndo = expireUndo.begin(); itExpireUndo != expireUndo.end(); ++itExpireUndo) itSupportExpireRow->second.push_back(*itSupportExpireUndo);
{
insertClaimIntoTrie(itExpireUndo->first, itExpireUndo->second, false);
itExpireRow->second.push_back(*itExpireUndo);
} }
} }
for (supportQueueRowType::iterator itSupportUndo = insertSupportUndo.begin(); itSupportUndo != insertSupportUndo.end(); ++itSupportUndo) for (supportQueueRowType::iterator itSupportUndo = insertSupportUndo.begin(); itSupportUndo != insertSupportUndo.end(); ++itSupportUndo)
{ {
supportQueueType::iterator itSupportRow = getSupportQueueCacheRow(itSupportUndo->second.nValidAtHeight, true); supportQueueType::iterator itSupportRow = getSupportQueueCacheRow(itSupportUndo->second.nValidAtHeight, true);
@ -2205,16 +2198,27 @@ bool CClaimTrieCache::decrementBlock(claimQueueRowType& insertUndo, claimQueueRo
itSupportRow->second.push_back(*itSupportUndo); itSupportRow->second.push_back(*itSupportUndo);
itSupportNameRow->second.push_back(itSupportUndo->second); itSupportNameRow->second.push_back(itSupportUndo->second);
} }
if (expireSupportUndo.begin() != expireSupportUndo.end())
if (expireUndo.begin() != expireUndo.end())
{ {
supportQueueType::iterator itSupportExpireRow = getSupportExpirationQueueCacheRow(nCurrentHeight, true); claimQueueType::iterator itExpireRow = getExpirationQueueCacheRow(nCurrentHeight, true);
for (supportQueueRowType::iterator itSupportExpireUndo = expireSupportUndo.begin(); itSupportExpireUndo != expireSupportUndo.end(); ++itSupportExpireUndo) for (claimQueueRowType::iterator itExpireUndo = expireUndo.begin(); itExpireUndo != expireUndo.end(); ++itExpireUndo)
{ {
insertSupportIntoMap(itSupportExpireUndo->first, itSupportExpireUndo->second, false); insertClaimIntoTrie(itExpireUndo->first, itExpireUndo->second, false);
itSupportExpireRow->second.push_back(*itSupportExpireUndo); itExpireRow->second.push_back(*itExpireUndo);
} }
} }
for (claimQueueRowType::iterator itInsertUndo = insertUndo.begin(); itInsertUndo != insertUndo.end(); ++itInsertUndo)
{
claimQueueType::iterator itQueueRow = getQueueCacheRow(itInsertUndo->second.nValidAtHeight, true);
CClaimValue claim;
assert(removeClaimFromTrie(itInsertUndo->first, itInsertUndo->second.outPoint, claim, false));
claimQueueNamesType::iterator itQueueNameRow = getQueueCacheNameRow(itInsertUndo->first, true);
itQueueRow->second.push_back(std::make_pair(itInsertUndo->first, claim));
itQueueNameRow->second.push_back(std::make_pair(itInsertUndo->second.outPoint, itInsertUndo->second.nValidAtHeight));
}
for (std::vector<std::pair<std::string, int> >::iterator itTakeoverHeightUndo = takeoverHeightUndo.begin(); itTakeoverHeightUndo != takeoverHeightUndo.end(); ++itTakeoverHeightUndo) for (std::vector<std::pair<std::string, int> >::iterator itTakeoverHeightUndo = takeoverHeightUndo.begin(); itTakeoverHeightUndo != takeoverHeightUndo.end(); ++itTakeoverHeightUndo)
{ {
cacheTakeoverHeights[itTakeoverHeightUndo->first] = itTakeoverHeightUndo->second; cacheTakeoverHeights[itTakeoverHeightUndo->first] = itTakeoverHeightUndo->second;