mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-08 19:53:27 +01:00
refactor: disallow setting flags in CCoinsCacheEntry constructors
No behavior change because any entries that are added in EmplaceCoinInternalDANGER have DIRTY assigned to them after, and if they are not inserted then they will not be modified as before. This prepares moving the cache entry flags field to private access. Co-Authored-By: Martin Leitner-Ankerl <martin.ankerl@gmail.com>
This commit is contained in:
@@ -108,10 +108,13 @@ void CCoinsViewCache::AddCoin(const COutPoint &outpoint, Coin&& coin, bool possi
|
||||
|
||||
void CCoinsViewCache::EmplaceCoinInternalDANGER(COutPoint&& outpoint, Coin&& coin) {
|
||||
cachedCoinsUsage += coin.DynamicMemoryUsage();
|
||||
cacheCoins.emplace(
|
||||
auto [it, inserted] = cacheCoins.emplace(
|
||||
std::piecewise_construct,
|
||||
std::forward_as_tuple(std::move(outpoint)),
|
||||
std::forward_as_tuple(std::move(coin), CCoinsCacheEntry::DIRTY));
|
||||
std::forward_as_tuple(std::move(coin)));
|
||||
if (inserted) {
|
||||
it->second.AddFlags(CCoinsCacheEntry::DIRTY);
|
||||
}
|
||||
}
|
||||
|
||||
void AddCoins(CCoinsViewCache& cache, const CTransaction &tx, int nHeight, bool check_for_overwrite) {
|
||||
|
||||
Reference in New Issue
Block a user