Implement a hard fork for extended/infinite claim expiration times #112
4 changed files with 88 additions and 41 deletions
|
@ -255,17 +255,17 @@ bool CClaimTrie::haveSupport(const std::string& name, const COutPoint& outPoint)
|
||||||
|
|
||||||
bool CClaimTrie::haveClaimInQueue(const std::string& name, const COutPoint& outPoint, int& nValidAtHeight) const
|
bool CClaimTrie::haveClaimInQueue(const std::string& name, const COutPoint& outPoint, int& nValidAtHeight) const
|
||||||
{
|
{
|
||||||
std::vector<claimQueueNamesEntryType> nameRow;
|
validHeightRowType nameRow;
|
||||||
if (!getQueueNameRow(name, nameRow))
|
if (!getQueueNameRow(name, nameRow))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
std::vector<claimQueueNamesEntryType>::const_iterator itNameRow;
|
validHeightRowType::const_iterator itNameRow;
|
||||||
for (itNameRow = nameRow.begin(); itNameRow != nameRow.end(); ++itNameRow)
|
for (itNameRow = nameRow.begin(); itNameRow != nameRow.end(); ++itNameRow)
|
||||||
{
|
{
|
||||||
if (itNameRow->first == outPoint)
|
if (itNameRow->outPoint == outPoint)
|
||||||
{
|
{
|
||||||
nValidAtHeight = itNameRow->second;
|
nValidAtHeight = itNameRow->nValidAtHeight;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -499,7 +499,7 @@ bool CClaimTrie::getQueueRow(int nHeight, claimQueueRowType& row) const
|
||||||
return db.Read(std::make_pair(CLAIM_QUEUE_ROW, nHeight), row);
|
return db.Read(std::make_pair(CLAIM_QUEUE_ROW, nHeight), row);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CClaimTrie::getQueueNameRow(const std::string& name, std::vector<claimQueueNamesEntryType>& row) const
|
bool CClaimTrie::getQueueNameRow(const std::string& name, validHeightRowType& row) const
|
||||||
{
|
{
|
||||||
claimQueueNamesType::const_iterator itQueueNameRow = dirtyQueueNameRows.find(name);
|
claimQueueNamesType::const_iterator itQueueNameRow = dirtyQueueNameRows.find(name);
|
||||||
if (itQueueNameRow != dirtyQueueNameRows.end())
|
if (itQueueNameRow != dirtyQueueNameRows.end())
|
||||||
|
@ -535,14 +535,14 @@ void CClaimTrie::updateQueueRow(int nHeight, claimQueueRowType& row)
|
||||||
itQueueRow->second.swap(row);
|
itQueueRow->second.swap(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CClaimTrie::updateQueueNameRow(const std::string& name, std::vector<claimQueueNamesEntryType>& row)
|
void CClaimTrie::updateQueueNameRow(const std::string& name, validHeightRowType& row)
|
||||||
{
|
{
|
||||||
claimQueueNamesType::iterator itQueueRow = dirtyQueueNameRows.find(name);
|
claimQueueNamesType::iterator itQueueRow = dirtyQueueNameRows.find(name);
|
||||||
if (itQueueRow == dirtyQueueNameRows.end())
|
if (itQueueRow == dirtyQueueNameRows.end())
|
||||||
{
|
{
|
||||||
std::vector<claimQueueNamesEntryType> newRow;
|
validHeightRowType newRow;
|
||||||
std::pair<claimQueueNamesType::iterator, bool> ret;
|
std::pair<claimQueueNamesType::iterator, bool> ret;
|
||||||
ret = dirtyQueueNameRows.insert(std::pair<std::string, std::vector<claimQueueNamesEntryType> >(name, newRow));
|
ret = dirtyQueueNameRows.insert(std::pair<std::string, validHeightRowType>(name, newRow));
|
||||||
assert(ret.second);
|
assert(ret.second);
|
||||||
itQueueRow = ret.first;
|
itQueueRow = ret.first;
|
||||||
}
|
}
|
||||||
|
@ -1389,7 +1389,7 @@ claimQueueNamesType::iterator CClaimTrieCache::getQueueCacheNameRow(const std::s
|
||||||
if (itQueueNameRow == claimQueueNameCache.end())
|
if (itQueueNameRow == claimQueueNameCache.end())
|
||||||
{
|
{
|
||||||
// Have to make a new name row and put it in the cache, if createIfNotExists is true
|
// Have to make a new name row and put it in the cache, if createIfNotExists is true
|
||||||
std::vector<claimQueueNamesEntryType> queueNameRow;
|
validHeightRowType queueNameRow;
|
||||||
// If the row exists in the base, copy its claims into the new row.
|
// If the row exists in the base, copy its claims into the new row.
|
||||||
bool exists = base->getQueueNameRow(name, queueNameRow);
|
bool exists = base->getQueueNameRow(name, queueNameRow);
|
||||||
if (!exists)
|
if (!exists)
|
||||||
|
@ -1397,7 +1397,7 @@ claimQueueNamesType::iterator CClaimTrieCache::getQueueCacheNameRow(const std::s
|
||||||
return itQueueNameRow;
|
return itQueueNameRow;
|
||||||
// Stick the new row in the cache
|
// Stick the new row in the cache
|
||||||
std::pair<claimQueueNamesType::iterator, bool> ret;
|
std::pair<claimQueueNamesType::iterator, bool> ret;
|
||||||
ret = claimQueueNameCache.insert(std::pair<std::string, std::vector<claimQueueNamesEntryType> >(name, queueNameRow));
|
ret = claimQueueNameCache.insert(std::pair<std::string, validHeightRowType>(name, queueNameRow));
|
||||||
assert(ret.second);
|
assert(ret.second);
|
||||||
itQueueNameRow = ret.first;
|
itQueueNameRow = ret.first;
|
||||||
}
|
}
|
||||||
|
@ -1446,7 +1446,7 @@ bool CClaimTrieCache::addClaimToQueues(const std::string& name, CClaimValue& cla
|
||||||
claimQueueType::iterator itQueueRow = getQueueCacheRow(claim.nValidAtHeight, true);
|
claimQueueType::iterator itQueueRow = getQueueCacheRow(claim.nValidAtHeight, true);
|
||||||
claimQueueNamesType::iterator itQueueNameRow = getQueueCacheNameRow(name, true);
|
claimQueueNamesType::iterator itQueueNameRow = getQueueCacheNameRow(name, true);
|
||||||
itQueueRow->second.push_back(entry);
|
itQueueRow->second.push_back(entry);
|
||||||
itQueueNameRow->second.push_back(std::make_pair(claim.outPoint, claim.nValidAtHeight));
|
itQueueNameRow->second.push_back(validHeightType(claim.outPoint, claim.nValidAtHeight));
|
||||||
addToExpirationQueue(entry);
|
addToExpirationQueue(entry);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1458,10 +1458,10 @@ bool CClaimTrieCache::removeClaimFromQueue(const std::string& name, const COutPo
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
std::vector<claimQueueNamesEntryType>::iterator itQueueName;
|
validHeightRowType::iterator itQueueName;
|
||||||
for (itQueueName = itQueueNameRow->second.begin(); itQueueName != itQueueNameRow->second.end(); ++itQueueName)
|
for (itQueueName = itQueueNameRow->second.begin(); itQueueName != itQueueNameRow->second.end(); ++itQueueName)
|
||||||
{
|
{
|
||||||
if (itQueueName->first == outPoint)
|
if (itQueueName->outPoint == outPoint)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1470,7 +1470,7 @@ bool CClaimTrieCache::removeClaimFromQueue(const std::string& name, const COutPo
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
claimQueueType::iterator itQueueRow = getQueueCacheRow(itQueueName->second, false);
|
claimQueueType::iterator itQueueRow = getQueueCacheRow(itQueueName->nValidAtHeight, false);
|
||||||
if (itQueueRow != claimQueueCache.end())
|
if (itQueueRow != claimQueueCache.end())
|
||||||
{
|
{
|
||||||
claimQueueRowType::iterator itQueue;
|
claimQueueRowType::iterator itQueue;
|
||||||
|
@ -1489,7 +1489,7 @@ bool CClaimTrieCache::removeClaimFromQueue(const std::string& name, const COutPo
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LogPrintf("%s: An inconsistency was found in the claim queue. Please report this to the developers:\nFound in named queue but not in height queue: name: %s, txid: %s, nOut: %d, nValidAtHeight: %d, current height: %d\n", __func__, name, outPoint.hash.GetHex(), outPoint.n, itQueueName->second, nCurrentHeight);
|
LogPrintf("%s: An inconsistency was found in the claim queue. Please report this to the developers:\nFound in named queue but not in height queue: name: %s, txid: %s, nOut: %d, nValidAtHeight: %d, current height: %d\n", __func__, name, outPoint.hash.GetHex(), outPoint.n, itQueueName->nValidAtHeight, nCurrentHeight);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1914,7 +1914,7 @@ bool CClaimTrieCache::spendSupport(const std::string& name, const COutPoint& out
|
||||||
return removeSupport(name, outPoint, nHeight, nValidAtHeight, true);
|
return removeSupport(name, outPoint, nHeight, nValidAtHeight, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CClaimTrieCache::incrementBlock(claimQueueRowType& insertUndo, claimQueueRowType& expireUndo, supportQueueRowType& insertSupportUndo, supportQueueRowType& expireSupportUndo, std::vector<std::pair<std::string, int> >& takeoverHeightUndo) const
|
bool CClaimTrieCache::incrementBlock(namedValidHeightRowType& insertUndo, claimQueueRowType& expireUndo, supportQueueRowType& insertSupportUndo, supportQueueRowType& expireSupportUndo, std::vector<std::pair<std::string, int> >& takeoverHeightUndo) const
|
||||||
{
|
{
|
||||||
LogPrintf("%s: nCurrentHeight (before increment): %d\n", __func__, nCurrentHeight);
|
LogPrintf("%s: nCurrentHeight (before increment): %d\n", __func__, nCurrentHeight);
|
||||||
claimQueueType::iterator itQueueRow = getQueueCacheRow(nCurrentHeight, false);
|
claimQueueType::iterator itQueueRow = getQueueCacheRow(nCurrentHeight, false);
|
||||||
|
@ -1926,9 +1926,9 @@ bool CClaimTrieCache::incrementBlock(claimQueueRowType& insertUndo, claimQueueRo
|
||||||
claimQueueNamesType::iterator itQueueNameRow = getQueueCacheNameRow(itEntry->first, false);
|
claimQueueNamesType::iterator itQueueNameRow = getQueueCacheNameRow(itEntry->first, false);
|
||||||
if (itQueueNameRow != claimQueueNameCache.end())
|
if (itQueueNameRow != claimQueueNameCache.end())
|
||||||
{
|
{
|
||||||
for (std::vector<claimQueueNamesEntryType>::iterator itQueueName = itQueueNameRow->second.begin(); itQueueName != itQueueNameRow->second.end(); ++itQueueName)
|
for (validHeightRowType::iterator itQueueName = itQueueNameRow->second.begin(); itQueueName != itQueueNameRow->second.end(); ++itQueueName)
|
||||||
{
|
{
|
||||||
if (itQueueName->first == itEntry->second.outPoint && itQueueName->second == nCurrentHeight)
|
if (itQueueName->outPoint == itEntry->second.outPoint && itQueueName->nValidAtHeight == nCurrentHeight)
|
||||||
{
|
{
|
||||||
found = true;
|
found = true;
|
||||||
itQueueNameRow->second.erase(itQueueName);
|
itQueueNameRow->second.erase(itQueueName);
|
||||||
|
@ -1942,9 +1942,9 @@ bool CClaimTrieCache::incrementBlock(claimQueueRowType& insertUndo, claimQueueRo
|
||||||
if (itQueueNameRow != claimQueueNameCache.end())
|
if (itQueueNameRow != claimQueueNameCache.end())
|
||||||
{
|
{
|
||||||
LogPrintf("Claims found for that name:\n");
|
LogPrintf("Claims found for that name:\n");
|
||||||
for (std::vector<claimQueueNamesEntryType>::iterator itQueueName = itQueueNameRow->second.begin(); itQueueName != itQueueNameRow->second.end(); ++itQueueName)
|
for (validHeightRowType::iterator itQueueName = itQueueNameRow->second.begin(); itQueueName != itQueueNameRow->second.end(); ++itQueueName)
|
||||||
{
|
{
|
||||||
LogPrintf("\ttxid: %s, nOut: %d, nValidAtHeight: %d\n", itQueueName->first.hash.GetHex(), itQueueName->first.n, itQueueName->second);
|
LogPrintf("\ttxid: %s, nOut: %d, nValidAtHeight: %d\n", itQueueName->outPoint.hash.GetHex(), itQueueName->outPoint.n, itQueueName->nValidAtHeight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1954,7 +1954,7 @@ bool CClaimTrieCache::incrementBlock(claimQueueRowType& insertUndo, claimQueueRo
|
||||||
}
|
}
|
||||||
assert(found);
|
assert(found);
|
||||||
insertClaimIntoTrie(itEntry->first, itEntry->second, true);
|
insertClaimIntoTrie(itEntry->first, itEntry->second, true);
|
||||||
insertUndo.push_back(*itEntry);
|
insertUndo.push_back(namedValidHeightType(itEntry->first, itEntry->second.outPoint, itEntry->second.nValidAtHeight));
|
||||||
}
|
}
|
||||||
itQueueRow->second.clear();
|
itQueueRow->second.clear();
|
||||||
}
|
}
|
||||||
|
@ -2076,17 +2076,17 @@ bool CClaimTrieCache::incrementBlock(claimQueueRowType& insertUndo, claimQueueRo
|
||||||
claimQueueNamesType::iterator itQueueNameRow = getQueueCacheNameRow(*itNamesToCheck, false);
|
claimQueueNamesType::iterator itQueueNameRow = getQueueCacheNameRow(*itNamesToCheck, false);
|
||||||
if (itQueueNameRow != claimQueueNameCache.end())
|
if (itQueueNameRow != claimQueueNameCache.end())
|
||||||
{
|
{
|
||||||
for (std::vector<claimQueueNamesEntryType>::iterator itQueueName = itQueueNameRow->second.begin(); itQueueName != itQueueNameRow->second.end(); ++itQueueName)
|
for (validHeightRowType::iterator itQueueName = itQueueNameRow->second.begin(); itQueueName != itQueueNameRow->second.end(); ++itQueueName)
|
||||||
{
|
{
|
||||||
bool found = false;
|
bool found = false;
|
||||||
// Pull those claims out of the height-based queue
|
// Pull those claims out of the height-based queue
|
||||||
claimQueueType::iterator itQueueRow = getQueueCacheRow(itQueueName->second, false);
|
claimQueueType::iterator itQueueRow = getQueueCacheRow(itQueueName->nValidAtHeight, false);
|
||||||
claimQueueRowType::iterator itQueue;
|
claimQueueRowType::iterator itQueue;
|
||||||
if (itQueueRow != claimQueueCache.end())
|
if (itQueueRow != claimQueueCache.end())
|
||||||
{
|
{
|
||||||
for (itQueue = itQueueRow->second.begin(); itQueue != itQueueRow->second.end(); ++itQueue)
|
for (itQueue = itQueueRow->second.begin(); itQueue != itQueueRow->second.end(); ++itQueue)
|
||||||
{
|
{
|
||||||
if (*itNamesToCheck == itQueue->first && itQueue->second.outPoint == itQueueName->first && itQueue->second.nValidAtHeight == itQueueName->second)
|
if (*itNamesToCheck == itQueue->first && itQueue->second.outPoint == itQueueName->outPoint && itQueue->second.nValidAtHeight == itQueueName->nValidAtHeight)
|
||||||
{
|
{
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
|
@ -2096,7 +2096,7 @@ bool CClaimTrieCache::incrementBlock(claimQueueRowType& insertUndo, claimQueueRo
|
||||||
if (found)
|
if (found)
|
||||||
{
|
{
|
||||||
// Insert them into the queue undo with their previous nValidAtHeight
|
// Insert them into the queue undo with their previous nValidAtHeight
|
||||||
insertUndo.push_back(*itQueue);
|
insertUndo.push_back(namedValidHeightType(itQueue->first, itQueue->second.outPoint, itQueue->second.nValidAtHeight));
|
||||||
// Insert them into the name trie with the new nValidAtHeight
|
// Insert them into the name trie with the new nValidAtHeight
|
||||||
itQueue->second.nValidAtHeight = nCurrentHeight;
|
itQueue->second.nValidAtHeight = nCurrentHeight;
|
||||||
insertClaimIntoTrie(itQueue->first, itQueue->second, false);
|
insertClaimIntoTrie(itQueue->first, itQueue->second, false);
|
||||||
|
@ -2105,7 +2105,7 @@ bool CClaimTrieCache::incrementBlock(claimQueueRowType& insertUndo, claimQueueRo
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LogPrintf("%s(): An inconsistency was found in the claim queue. Please report this to the developers:\nClaim found in name queue but not in height based queue:\nname: %s, txid: %s, nOut: %d, nValidAtHeight in name based queue: %d, current height: %d\n", __func__, *itNamesToCheck, itQueueName->first.hash.GetHex(), itQueueName->first.n, itQueueName->second, nCurrentHeight);
|
LogPrintf("%s(): An inconsistency was found in the claim queue. Please report this to the developers:\nClaim found in name queue but not in height based queue:\nname: %s, txid: %s, nOut: %d, nValidAtHeight in name based queue: %d, current height: %d\n", __func__, *itNamesToCheck, itQueueName->outPoint.hash.GetHex(), itQueueName->outPoint.n, itQueueName->nValidAtHeight, nCurrentHeight);
|
||||||
}
|
}
|
||||||
assert(found);
|
assert(found);
|
||||||
}
|
}
|
||||||
|
@ -2174,7 +2174,7 @@ bool CClaimTrieCache::incrementBlock(claimQueueRowType& insertUndo, claimQueueRo
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CClaimTrieCache::decrementBlock(claimQueueRowType& insertUndo, claimQueueRowType& expireUndo, supportQueueRowType& insertSupportUndo, supportQueueRowType& expireSupportUndo, std::vector<std::pair<std::string, int> >& takeoverHeightUndo) const
|
bool CClaimTrieCache::decrementBlock(namedValidHeightRowType& insertUndo, claimQueueRowType& expireUndo, supportQueueRowType& insertSupportUndo, supportQueueRowType& expireSupportUndo, std::vector<std::pair<std::string, int> >& takeoverHeightUndo) const
|
||||||
{
|
{
|
||||||
LogPrintf("%s: nCurrentHeight (before decrement): %d\n", __func__, nCurrentHeight);
|
LogPrintf("%s: nCurrentHeight (before decrement): %d\n", __func__, nCurrentHeight);
|
||||||
nCurrentHeight--;
|
nCurrentHeight--;
|
||||||
|
@ -2209,14 +2209,14 @@ bool CClaimTrieCache::decrementBlock(claimQueueRowType& insertUndo, claimQueueRo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (claimQueueRowType::iterator itInsertUndo = insertUndo.begin(); itInsertUndo != insertUndo.end(); ++itInsertUndo)
|
for (namedValidHeightRowType::iterator itInsertUndo = insertUndo.begin(); itInsertUndo != insertUndo.end(); ++itInsertUndo)
|
||||||
{
|
{
|
||||||
claimQueueType::iterator itQueueRow = getQueueCacheRow(itInsertUndo->second.nValidAtHeight, true);
|
claimQueueType::iterator itQueueRow = getQueueCacheRow(itInsertUndo->nValidAtHeight, true);
|
||||||
CClaimValue claim;
|
CClaimValue claim;
|
||||||
assert(removeClaimFromTrie(itInsertUndo->first, itInsertUndo->second.outPoint, claim, false));
|
assert(removeClaimFromTrie(itInsertUndo->name, itInsertUndo->outPoint, claim, false));
|
||||||
claimQueueNamesType::iterator itQueueNameRow = getQueueCacheNameRow(itInsertUndo->first, true);
|
claimQueueNamesType::iterator itQueueNameRow = getQueueCacheNameRow(itInsertUndo->name, true);
|
||||||
itQueueRow->second.push_back(std::make_pair(itInsertUndo->first, claim));
|
itQueueRow->second.push_back(std::make_pair(itInsertUndo->name, claim));
|
||||||
itQueueNameRow->second.push_back(std::make_pair(itInsertUndo->second.outPoint, itInsertUndo->second.nValidAtHeight));
|
itQueueNameRow->second.push_back(validHeightType(itInsertUndo->outPoint, itInsertUndo->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)
|
||||||
|
|
|
@ -178,16 +178,63 @@ struct nodenamecompare
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct validHeightType
|
||||||
|
{
|
||||||
|
COutPoint outPoint;
|
||||||
|
int nValidAtHeight;
|
||||||
|
|
||||||
|
validHeightType() {}
|
||||||
|
|
||||||
|
validHeightType(COutPoint outPoint, int nValidAtHeight)
|
||||||
|
: outPoint(outPoint), nValidAtHeight(nValidAtHeight) {}
|
||||||
|
|
||||||
|
ADD_SERIALIZE_METHODS;
|
||||||
|
|
||||||
|
template <typename Stream, typename Operation>
|
||||||
|
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion)
|
||||||
|
{
|
||||||
|
READWRITE(outPoint);
|
||||||
|
READWRITE(nValidAtHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
struct namedValidHeightType
|
||||||
|
{
|
||||||
|
std::string name;
|
||||||
|
COutPoint outPoint;
|
||||||
|
int nValidAtHeight;
|
||||||
|
|
||||||
|
namedValidHeightType() {}
|
||||||
|
|
||||||
|
namedValidHeightType(std::string name, COutPoint outPoint,
|
||||||
|
int nValidAtHeight)
|
||||||
|
: name(name), outPoint(outPoint), nValidAtHeight(nValidAtHeight) {}
|
||||||
|
|
||||||
|
ADD_SERIALIZE_METHODS;
|
||||||
|
|
||||||
|
template <typename Stream, typename Operation>
|
||||||
|
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion)
|
||||||
|
{
|
||||||
|
READWRITE(name);
|
||||||
|
READWRITE(outPoint);
|
||||||
|
READWRITE(nValidAtHeight);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
typedef std::pair<std::string, CClaimValue> claimQueueEntryType;
|
typedef std::pair<std::string, CClaimValue> claimQueueEntryType;
|
||||||
|
|
||||||
typedef std::pair<std::string, CSupportValue> supportQueueEntryType;
|
typedef std::pair<std::string, CSupportValue> supportQueueEntryType;
|
||||||
|
|
||||||
typedef std::map<std::string, supportMapEntryType> supportMapType;
|
typedef std::map<std::string, supportMapEntryType> supportMapType;
|
||||||
|
|
||||||
|
typedef std::vector<validHeightType> validHeightRowType;
|
||||||
|
|
||||||
|
typedef std::vector<namedValidHeightType> namedValidHeightRowType;
|
||||||
|
|
||||||
typedef std::vector<claimQueueEntryType> claimQueueRowType;
|
typedef std::vector<claimQueueEntryType> claimQueueRowType;
|
||||||
typedef std::map<int, claimQueueRowType> claimQueueType;
|
typedef std::map<int, claimQueueRowType> claimQueueType;
|
||||||
typedef std::pair<COutPoint, int> claimQueueNamesEntryType;
|
typedef std::map<std::string, validHeightRowType > claimQueueNamesType;
|
||||||
typedef std::map<std::string, std::vector<claimQueueNamesEntryType> > claimQueueNamesType;
|
|
||||||
|
|
||||||
typedef std::vector<supportQueueEntryType> supportQueueRowType;
|
typedef std::vector<supportQueueEntryType> supportQueueRowType;
|
||||||
typedef std::map<int, supportQueueRowType> supportQueueType;
|
typedef std::map<int, supportQueueRowType> supportQueueType;
|
||||||
|
@ -232,7 +279,7 @@ public:
|
||||||
void setExpirationTime(int t);
|
void setExpirationTime(int t);
|
||||||
|
|
||||||
bool getQueueRow(int nHeight, claimQueueRowType& row) const;
|
bool getQueueRow(int nHeight, claimQueueRowType& row) const;
|
||||||
bool getQueueNameRow(const std::string& name, std::vector<claimQueueNamesEntryType>& row) const;
|
bool getQueueNameRow(const std::string& name, validHeightRowType& row) const;
|
||||||
bool getExpirationQueueRow(int nHeight, claimQueueRowType& row) const;
|
bool getExpirationQueueRow(int nHeight, claimQueueRowType& row) const;
|
||||||
bool getSupportNode(std::string name, supportMapEntryType& node) const;
|
bool getSupportNode(std::string name, supportMapEntryType& node) const;
|
||||||
bool getSupportQueueRow(int nHeight, supportQueueRowType& row) const;
|
bool getSupportQueueRow(int nHeight, supportQueueRowType& row) const;
|
||||||
|
@ -291,7 +338,7 @@ private:
|
||||||
void markNodeDirty(const std::string& name, CClaimTrieNode* node);
|
void markNodeDirty(const std::string& name, CClaimTrieNode* node);
|
||||||
void updateQueueRow(int nHeight, claimQueueRowType& row);
|
void updateQueueRow(int nHeight, claimQueueRowType& row);
|
||||||
void updateQueueNameRow(const std::string& name,
|
void updateQueueNameRow(const std::string& name,
|
||||||
std::vector<claimQueueNamesEntryType>& row);
|
validHeightRowType& row);
|
||||||
void updateExpirationRow(int nHeight, claimQueueRowType& row);
|
void updateExpirationRow(int nHeight, claimQueueRowType& row);
|
||||||
void updateSupportMap(const std::string& name, supportMapEntryType& node);
|
void updateSupportMap(const std::string& name, supportMapEntryType& node);
|
||||||
void updateSupportQueue(int nHeight, supportQueueRowType& row);
|
void updateSupportQueue(int nHeight, supportQueueRowType& row);
|
||||||
|
@ -367,12 +414,12 @@ public:
|
||||||
uint256 getBestBlock();
|
uint256 getBestBlock();
|
||||||
void setBestBlock(const uint256& hashBlock);
|
void setBestBlock(const uint256& hashBlock);
|
||||||
|
|
||||||
bool incrementBlock(claimQueueRowType& insertUndo,
|
bool incrementBlock(namedValidHeightRowType& insertUndo,
|
||||||
claimQueueRowType& expireUndo,
|
claimQueueRowType& expireUndo,
|
||||||
supportQueueRowType& insertSupportUndo,
|
supportQueueRowType& insertSupportUndo,
|
||||||
supportQueueRowType& expireSupportUndo,
|
supportQueueRowType& expireSupportUndo,
|
||||||
std::vector<std::pair<std::string, int> >& takeoverHeightUndo) const;
|
std::vector<std::pair<std::string, int> >& takeoverHeightUndo) const;
|
||||||
bool decrementBlock(claimQueueRowType& insertUndo,
|
bool decrementBlock(namedValidHeightRowType& insertUndo,
|
||||||
claimQueueRowType& expireUndo,
|
claimQueueRowType& expireUndo,
|
||||||
supportQueueRowType& insertSupportUndo,
|
supportQueueRowType& insertSupportUndo,
|
||||||
supportQueueRowType& expireSupportUndo,
|
supportQueueRowType& expireSupportUndo,
|
||||||
|
|
|
@ -464,7 +464,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
|
||||||
pblock->nBits = GetNextWorkRequired(pindexPrev, pblock, Params().GetConsensus());
|
pblock->nBits = GetNextWorkRequired(pindexPrev, pblock, Params().GetConsensus());
|
||||||
pblock->nNonce = 0;
|
pblock->nNonce = 0;
|
||||||
pblocktemplate->vTxSigOps[0] = GetLegacySigOpCount(pblock->vtx[0]);
|
pblocktemplate->vTxSigOps[0] = GetLegacySigOpCount(pblock->vtx[0]);
|
||||||
claimQueueRowType dummyInsertUndo;
|
namedValidHeightRowType dummyInsertUndo;
|
||||||
claimQueueRowType dummyExpireUndo;
|
claimQueueRowType dummyExpireUndo;
|
||||||
supportQueueRowType dummyInsertSupportUndo;
|
supportQueueRowType dummyInsertSupportUndo;
|
||||||
supportQueueRowType dummyExpireSupportUndo;
|
supportQueueRowType dummyExpireSupportUndo;
|
||||||
|
|
|
@ -84,7 +84,7 @@ class CBlockUndo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
std::vector<CTxUndo> vtxundo; // for all but the coinbase
|
std::vector<CTxUndo> vtxundo; // for all but the coinbase
|
||||||
claimQueueRowType insertUndo; // any claims that went from the queue to the trie
|
namedValidHeightRowType insertUndo; // any claims that went from the queue to the trie
|
||||||
claimQueueRowType expireUndo; // any claims that expired
|
claimQueueRowType expireUndo; // any claims that expired
|
||||||
supportQueueRowType insertSupportUndo; // any supports that went from the support queue to the support map
|
supportQueueRowType insertSupportUndo; // any supports that went from the support queue to the support map
|
||||||
supportQueueRowType expireSupportUndo; // any supports that expired
|
supportQueueRowType expireSupportUndo; // any supports that expired
|
||||||
|
|
Loading…
Reference in a new issue