From 1557f866c7cf74f134c56312c1d234314ec8488e Mon Sep 17 00:00:00 2001 From: Hodlinator <172445034+hodlinator@users.noreply.github.com> Date: Fri, 13 Dec 2024 23:14:20 +0100 Subject: [PATCH] refactor: Make CCoinsCacheEntry::Flags private --- src/coins.h | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/coins.h b/src/coins.h index 61fb4af6420d10..28cf9e9a2f5726 100644 --- a/src/coins.h +++ b/src/coins.h @@ -108,6 +108,27 @@ using CoinsCachePair = std::pair; struct CCoinsCacheEntry { private: + enum Flags { + /** + * DIRTY means the CCoinsCacheEntry is potentially different from the + * version in the parent cache. Failure to mark a coin as DIRTY when + * it is potentially different from the parent cache will cause a + * consensus failure, since the coin's state won't get written to the + * parent when the cache is flushed. + */ + DIRTY = (1 << 0), + /** + * FRESH means the parent cache does not have this coin or that it is a + * spent coin in the parent cache. If a FRESH coin in the cache is + * later spent, it can be deleted entirely and doesn't ever need to be + * flushed to the parent. This is a performance optimization. Marking a + * coin as FRESH when it exists unspent in the parent cache will cause a + * consensus failure, since it might not be deleted from the parent + * when this cache is flushed. + */ + FRESH = (1 << 1), + }; + /** * These are used to create a doubly linked list of flagged entries. * They are set in SetDirty, SetFresh, and unset in SetClean. @@ -146,27 +167,6 @@ struct CCoinsCacheEntry public: Coin coin; // The actual cached data. - enum Flags { - /** - * DIRTY means the CCoinsCacheEntry is potentially different from the - * version in the parent cache. Failure to mark a coin as DIRTY when - * it is potentially different from the parent cache will cause a - * consensus failure, since the coin's state won't get written to the - * parent when the cache is flushed. - */ - DIRTY = (1 << 0), - /** - * FRESH means the parent cache does not have this coin or that it is a - * spent coin in the parent cache. If a FRESH coin in the cache is - * later spent, it can be deleted entirely and doesn't ever need to be - * flushed to the parent. This is a performance optimization. Marking a - * coin as FRESH when it exists unspent in the parent cache will cause a - * consensus failure, since it might not be deleted from the parent - * when this cache is flushed. - */ - FRESH = (1 << 1), - }; - CCoinsCacheEntry() noexcept = default; explicit CCoinsCacheEntry(Coin&& coin_) noexcept : coin(std::move(coin_)) {} ~CCoinsCacheEntry()