Commit 223b6047 authored by lbrynaut's avatar lbrynaut Committed by Brannon King
Browse files

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)
parent 3edbb262
......@@ -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);
......
......@@ -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;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment