From 05293f3cb75ad08ca23cba8e795e27d4d5e4d690 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Tue, 25 Apr 2017 11:29:36 -0700 Subject: Remove ModifyCoins/ModifyNewCoins --- src/coins.h | 47 ----------------------------------------------- 1 file changed, 47 deletions(-) (limited to 'src/coins.h') diff --git a/src/coins.h b/src/coins.h index 5879530f95..fcf7c47a56 100644 --- a/src/coins.h +++ b/src/coins.h @@ -405,36 +405,10 @@ public: }; -class CCoinsViewCache; - -/** - * A reference to a mutable cache entry. Encapsulating it allows us to run - * cleanup code after the modification is finished, and keeping track of - * concurrent modifications. - */ -class CCoinsModifier -{ -private: - CCoinsViewCache& cache; - CCoinsMap::iterator it; - size_t cachedCoinUsage; // Cached memory usage of the CCoins object before modification - CCoinsModifier(CCoinsViewCache& cache_, CCoinsMap::iterator it_, size_t usage); - -public: - CCoins* operator->() { return &it->second.coins; } - CCoins& operator*() { return it->second.coins; } - ~CCoinsModifier(); - friend class CCoinsViewCache; -}; - /** CCoinsView that adds a memory cache for transactions to another CCoinsView */ class CCoinsViewCache : public CCoinsViewBacked { protected: - /* Whether this cache has an active modifier. */ - bool hasModifier; - - /** * Make mutable so that we can "fill the cache" even from Get-methods * declared as "const". @@ -447,7 +421,6 @@ protected: public: CCoinsViewCache(CCoinsView *baseIn); - ~CCoinsViewCache(); // Standard CCoinsView methods bool GetCoins(const uint256 &txid, CCoins &coins) const; @@ -479,24 +452,6 @@ public: */ const Coin AccessCoin(const COutPoint &output) const; - /** - * Return a modifiable reference to a CCoins. If no entry with the given - * txid exists, a new one is created. Simultaneous modifications are not - * allowed. - */ - CCoinsModifier ModifyCoins(const uint256 &txid); - - /** - * Return a modifiable reference to a CCoins. Assumes that no entry with the given - * txid exists and creates a new one. This saves a database access in the case where - * the coins were to be wiped out by FromTx anyway. This should not be called with - * the 2 historical coinbase duplicate pairs because the new coins are marked fresh, and - * in the event the duplicate coinbase was spent before a flush, the now pruned coins - * would not properly overwrite the first coinbase of the pair. Simultaneous modifications - * are not allowed. - */ - CCoinsModifier ModifyNewCoins(const uint256 &txid, bool coinbase); - /** * Add a coin. Set potential_overwrite to true if a non-pruned version may * already exist. @@ -544,8 +499,6 @@ public: const CTxOut &GetOutputFor(const CTxIn& input) const; - friend class CCoinsModifier; - private: CCoinsMap::iterator FetchCoins(const uint256 &txid) const; -- cgit v1.2.3