No longer abort on removal from claimtrie in the case of expiration

where normalization is enabled and the claim no longer exists (due to
normalization related narrowing)
This commit is contained in:
lbrynaut 2018-10-08 14:00:26 -05:00 committed by Brannon King
parent 3edbb2627e
commit 223b6047cd
2 changed files with 7 additions and 7 deletions

View file

@ -1532,7 +1532,7 @@ bool CClaimTrieCache::removeClaimFromTrie(const std::string& name, const COutPoi
if (!success)
{
LogPrintf("%s: Removing a claim was unsuccessful. name = %s, txhash = %s, nOut = %d", __func__, newName.c_str(), outPoint.hash.GetHex(), outPoint.n);
LogPrintf("%s: Removing a claim was unsuccessful. name = %s, txhash = %s, nOut = %d\n", __func__, newName.c_str(), outPoint.hash.GetHex(), outPoint.n);
return false;
}
@ -2278,7 +2278,12 @@ bool CClaimTrieCache::incrementBlock(insertUndoType& insertUndo, claimQueueRowTy
{
CClaimValue claim;
const std::string& name = (base->shouldNormalize() ? normalizeClaimName(itEntry->name) : itEntry->name);
assert(removeClaimFromTrie(name, itEntry->outPoint, claim, true));
// Normalization may have pruned this claim already, so
// expiring it is now impossible. Assert that
// normalization is enabled and the claim no longer exists
// in the claimtrie OR that the removal is successful.
assert((base->shouldNormalize() && !base->haveClaim(name, itEntry->outPoint)) ||
removeClaimFromTrie(name, itEntry->outPoint, claim, true));
claimsToDelete.insert(claim);
expireUndo.push_back(std::make_pair(name, claim));
LogPrintf("Expiring claim %s: %s, nHeight: %d, nValidAtHeight: %d\n", claim.claimId.GetHex(), name, claim.nHeight, claim.nValidAtHeight);

View file

@ -17,7 +17,6 @@
#include <boost/locale/conversion.hpp>
#include <boost/locale/localization_backend.hpp>
#include <boost/locale.hpp>
#include <boost/ptr_container/ptr_vector.hpp>
// leveldb keys
#define HASH_BLOCK 'h'
@ -215,8 +214,6 @@ public:
newNode->claims.push_back(*cit);
}
children[sPos[sPos.size() - 1]] = newNode;
claimTrieNodeList.push_back(newNode);
}
return *this;
}
@ -247,8 +244,6 @@ public:
newNode->claims.push_back(*cit);
}
children[sPos[sPos.size() - 1]] = newNode;
claimTrieNodeList.push_back(newNode);
}
return *this;
}