refactor: encapsulate flags setting with AddFlags and ClearFlags

No behavior change. This prepares moving the cache entry
flags field to private access.
This commit is contained in:
Andrew Toth
2024-06-28 16:27:48 -04:00
parent 9715d3bf1e
commit 8737c0cefa
4 changed files with 14 additions and 9 deletions

View File

@@ -584,7 +584,7 @@ static size_t InsertCoinsMapEntry(CCoinsMap& map, CAmount value, char flags)
}
assert(flags != NO_ENTRY);
CCoinsCacheEntry entry;
entry.flags = flags;
entry.AddFlags(flags);
SetCoinsValue(value, entry.coin);
auto inserted = map.emplace(OUTPOINT, std::move(entry));
assert(inserted.second);

View File

@@ -125,7 +125,7 @@ FUZZ_TARGET(coins_view, .init = initialize_coins_view)
LIMITED_WHILE(good_data && fuzzed_data_provider.ConsumeBool(), 10'000)
{
CCoinsCacheEntry coins_cache_entry;
coins_cache_entry.flags = fuzzed_data_provider.ConsumeIntegral<unsigned char>();
coins_cache_entry.AddFlags(fuzzed_data_provider.ConsumeIntegral<unsigned char>());
if (fuzzed_data_provider.ConsumeBool()) {
coins_cache_entry.coin = random_coin;
} else {