Ensure cache contains valid entry when anchor is popped.
This commit is contained in:
parent
08de001a25
commit
ebd9aa11b1
|
@ -176,11 +176,20 @@ void CCoinsViewCache::PopAnchor(const uint256 &newrt) {
|
||||||
// case restoring the "old" anchor during a reorg must
|
// case restoring the "old" anchor during a reorg must
|
||||||
// have no effect.
|
// have no effect.
|
||||||
if (currentRoot != newrt) {
|
if (currentRoot != newrt) {
|
||||||
CAnchorsMap::iterator ret = cacheAnchors.insert(std::make_pair(currentRoot, CAnchorsCacheEntry())).first;
|
// Bring the current best anchor into our local cache
|
||||||
|
// so that its tree exists in memory.
|
||||||
|
{
|
||||||
|
ZCIncrementalMerkleTree tree;
|
||||||
|
assert(GetAnchorAt(currentRoot, tree));
|
||||||
|
}
|
||||||
|
|
||||||
ret->second.entered = false;
|
// Mark the anchor as unentered, removing it from view
|
||||||
ret->second.flags = CAnchorsCacheEntry::DIRTY;
|
cacheAnchors[currentRoot].entered = false;
|
||||||
|
|
||||||
|
// Mark the cache entry as dirty so it's propagated
|
||||||
|
cacheAnchors[currentRoot].flags = CAnchorsCacheEntry::DIRTY;
|
||||||
|
|
||||||
|
// Mark the new root as the best anchor
|
||||||
hashAnchor = newrt;
|
hashAnchor = newrt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue