From c9cedebfffbc09c4394bbbe74da4ba0666237504 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C5=91rinc?= Date: Wed, 22 Jul 2026 12:38:13 -0700 Subject: [PATCH] coins: group private cache helpers Move `FetchCoin()` and `ReallocateCache()` into the existing `private:` section. `ReallocateCache()` is only called internally by `Flush()`, and grouping both helpers removes the trailing access section. --- src/coins.h | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/coins.h b/src/coins.h index c854893bcbc..6fcf1092929 100644 --- a/src/coins.h +++ b/src/coins.h @@ -438,6 +438,19 @@ class CCoinsViewCache : public CCoinsViewBacked private: const bool m_deterministic; + //! Force a reallocation of the cache map. This is required when downsizing + //! the cache because the map's allocator may be hanging onto a lot of + //! memory despite having called .clear(). + //! + //! See: https://stackoverflow.com/questions/42114044/how-to-release-unordered-map-memory + void ReallocateCache(); + + /** + * @note this is marked const, but may actually append to `cacheCoins`, increasing + * memory usage. + */ + CCoinsMap::iterator FetchCoin(const COutPoint &outpoint) const; + protected: /** * Make mutable so that we can "fill the cache" even from Get-methods @@ -555,13 +568,6 @@ public: //! Check whether all prevouts of the transaction are present in the UTXO set represented by this view bool HaveInputs(const CTransaction& tx) const; - //! Force a reallocation of the cache map. This is required when downsizing - //! the cache because the map's allocator may be hanging onto a lot of - //! memory despite having called .clear(). - //! - //! See: https://stackoverflow.com/questions/42114044/how-to-release-unordered-map-memory - void ReallocateCache(); - //! Run an internal sanity check on the cache data structure. */ void SanityCheck() const; @@ -583,13 +589,6 @@ public: //! Create a scoped guard that will call `Reset()` on this cache when it goes out of scope. [[nodiscard]] ResetGuard CreateResetGuard() noexcept { return ResetGuard{*this}; } - -private: - /** - * @note this is marked const, but may actually append to `cacheCoins`, increasing - * memory usage. - */ - CCoinsMap::iterator FetchCoin(const COutPoint &outpoint) const; }; /**