@@ -51,7 +51,7 @@ CCoinsMap::iterator CCoinsViewCache::FetchCoin(const COutPoint &outpoint) const
51
51
if (ret->second .coin .IsSpent ()) {
52
52
// The parent only has an empty entry for this outpoint; we can consider our
53
53
// version as fresh.
54
- ret->second .flags = CCoinsCacheEntry::FRESH;
54
+ ret->second .AddFlags ( CCoinsCacheEntry::FRESH) ;
55
55
}
56
56
cachedCoinsUsage += ret->second .coin .DynamicMemoryUsage ();
57
57
return ret;
@@ -96,7 +96,7 @@ void CCoinsViewCache::AddCoin(const COutPoint &outpoint, Coin&& coin, bool possi
96
96
fresh = !it->second .IsDirty ();
97
97
}
98
98
it->second .coin = std::move (coin);
99
- it->second .flags |= CCoinsCacheEntry::DIRTY | (fresh ? CCoinsCacheEntry::FRESH : 0 );
99
+ it->second .AddFlags ( CCoinsCacheEntry::DIRTY | (fresh ? CCoinsCacheEntry::FRESH : 0 ) );
100
100
cachedCoinsUsage += it->second .coin .DynamicMemoryUsage ();
101
101
TRACE5 (utxocache, add,
102
102
outpoint.hash .data (),
@@ -141,7 +141,7 @@ bool CCoinsViewCache::SpendCoin(const COutPoint &outpoint, Coin* moveout) {
141
141
if (it->second .IsFresh ()) {
142
142
cacheCoins.erase (it);
143
143
} else {
144
- it->second .flags |= CCoinsCacheEntry::DIRTY;
144
+ it->second .AddFlags ( CCoinsCacheEntry::DIRTY) ;
145
145
it->second .coin .Clear ();
146
146
}
147
147
return true ;
@@ -203,12 +203,12 @@ bool CCoinsViewCache::BatchWrite(CCoinsMap &mapCoins, const uint256 &hashBlockIn
203
203
entry.coin = it->second .coin ;
204
204
}
205
205
cachedCoinsUsage += entry.coin .DynamicMemoryUsage ();
206
- entry.flags = CCoinsCacheEntry::DIRTY;
206
+ entry.AddFlags ( CCoinsCacheEntry::DIRTY) ;
207
207
// We can mark it FRESH in the parent if it was FRESH in the child
208
208
// Otherwise it might have just been flushed from the parent's cache
209
209
// and already exist in the grandparent
210
210
if (it->second .IsFresh ()) {
211
- entry.flags |= CCoinsCacheEntry::FRESH;
211
+ entry.AddFlags ( CCoinsCacheEntry::FRESH) ;
212
212
}
213
213
}
214
214
} else {
@@ -238,7 +238,7 @@ bool CCoinsViewCache::BatchWrite(CCoinsMap &mapCoins, const uint256 &hashBlockIn
238
238
itUs->second .coin = it->second .coin ;
239
239
}
240
240
cachedCoinsUsage += itUs->second .coin .DynamicMemoryUsage ();
241
- itUs->second .flags |= CCoinsCacheEntry::DIRTY;
241
+ itUs->second .AddFlags ( CCoinsCacheEntry::DIRTY) ;
242
242
// NOTE: It isn't safe to mark the coin as FRESH in the parent
243
243
// cache. If it already existed and was spent in the parent
244
244
// cache then marking it FRESH would prevent that spentness
@@ -273,7 +273,7 @@ bool CCoinsViewCache::Sync()
273
273
cachedCoinsUsage -= it->second .coin .DynamicMemoryUsage ();
274
274
it = cacheCoins.erase (it);
275
275
} else {
276
- it->second .flags = 0 ;
276
+ it->second .ClearFlags () ;
277
277
++it;
278
278
}
279
279
}
0 commit comments