Migrate IncrementalMerkleTree memory usage calls
This commit is contained in:
@@ -124,7 +124,7 @@ bool CCoinsViewCache::GetAnchorAt(const uint256 &rt, ZCIncrementalMerkleTree &tr
|
|||||||
CAnchorsMap::iterator ret = cacheAnchors.insert(std::make_pair(rt, CAnchorsCacheEntry())).first;
|
CAnchorsMap::iterator ret = cacheAnchors.insert(std::make_pair(rt, CAnchorsCacheEntry())).first;
|
||||||
ret->second.entered = true;
|
ret->second.entered = true;
|
||||||
ret->second.tree = tree;
|
ret->second.tree = tree;
|
||||||
cachedCoinsUsage += memusage::DynamicUsage(ret->second.tree);
|
cachedCoinsUsage += ret->second.tree.DynamicMemoryUsage();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -163,7 +163,7 @@ void CCoinsViewCache::PushAnchor(const ZCIncrementalMerkleTree &tree) {
|
|||||||
|
|
||||||
if (insertRet.second) {
|
if (insertRet.second) {
|
||||||
// An insert took place
|
// An insert took place
|
||||||
cachedCoinsUsage += memusage::DynamicUsage(ret->second.tree);
|
cachedCoinsUsage += ret->second.tree.DynamicMemoryUsage();
|
||||||
}
|
}
|
||||||
|
|
||||||
hashAnchor = newrt;
|
hashAnchor = newrt;
|
||||||
@@ -318,7 +318,7 @@ bool CCoinsViewCache::BatchWrite(CCoinsMap &mapCoins,
|
|||||||
entry.tree = child_it->second.tree;
|
entry.tree = child_it->second.tree;
|
||||||
entry.flags = CAnchorsCacheEntry::DIRTY;
|
entry.flags = CAnchorsCacheEntry::DIRTY;
|
||||||
|
|
||||||
cachedCoinsUsage += memusage::DynamicUsage(entry.tree);
|
cachedCoinsUsage += entry.tree.DynamicMemoryUsage();
|
||||||
} else {
|
} else {
|
||||||
if (parent_it->second.entered != child_it->second.entered) {
|
if (parent_it->second.entered != child_it->second.entered) {
|
||||||
// The parent may have removed the entry.
|
// The parent may have removed the entry.
|
||||||
|
|||||||
Reference in New Issue
Block a user