Changeset View
Changeset View
Standalone View
Standalone View
src/coins.h
Show First 20 Lines • Show All 198 Lines • ▼ Show 20 Lines | protected: | ||||
mutable CCoinsMap cacheCoins; | mutable CCoinsMap cacheCoins; | ||||
/* Cached dynamic memory usage for the inner Coin objects. */ | /* Cached dynamic memory usage for the inner Coin objects. */ | ||||
mutable size_t cachedCoinsUsage; | mutable size_t cachedCoinsUsage; | ||||
public: | public: | ||||
CCoinsViewCache(CCoinsView *baseIn); | CCoinsViewCache(CCoinsView *baseIn); | ||||
/** | |||||
* By deleting the copy constructor, we prevent accidentally using it when | |||||
* one intends to create a cache on top of a base cache. | |||||
*/ | |||||
CCoinsViewCache(const CCoinsViewCache &) = delete; | |||||
// Standard CCoinsView methods | // Standard CCoinsView methods | ||||
bool GetCoin(const COutPoint &outpoint, Coin &coin) const override; | bool GetCoin(const COutPoint &outpoint, Coin &coin) const override; | ||||
bool HaveCoin(const COutPoint &outpoint) const override; | bool HaveCoin(const COutPoint &outpoint) const override; | ||||
uint256 GetBestBlock() const override; | uint256 GetBestBlock() const override; | ||||
void SetBestBlock(const uint256 &hashBlock); | void SetBestBlock(const uint256 &hashBlock); | ||||
bool BatchWrite(CCoinsMap &mapCoins, const uint256 &hashBlock) override; | bool BatchWrite(CCoinsMap &mapCoins, const uint256 &hashBlock) override; | ||||
CCoinsViewCursor *Cursor() const override { | CCoinsViewCursor *Cursor() const override { | ||||
throw std::logic_error( | throw std::logic_error( | ||||
▲ Show 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | public: | ||||
*/ | */ | ||||
double GetPriority(const CTransaction &tx, int nHeight, | double GetPriority(const CTransaction &tx, int nHeight, | ||||
Amount &inChainInputValue) const; | Amount &inChainInputValue) const; | ||||
const CTxOut &GetOutputFor(const CTxIn &input) const; | const CTxOut &GetOutputFor(const CTxIn &input) const; | ||||
private: | private: | ||||
CCoinsMap::iterator FetchCoin(const COutPoint &outpoint) const; | CCoinsMap::iterator FetchCoin(const COutPoint &outpoint) const; | ||||
/** | |||||
* By making the copy constructor private, we prevent accidentally using it | |||||
* when one intends to create a cache on top of a base cache. | |||||
*/ | |||||
CCoinsViewCache(const CCoinsViewCache &); | |||||
}; | }; | ||||
//! Utility function to add all of a transaction's outputs to a cache. | //! Utility function to add all of a transaction's outputs to a cache. | ||||
// When check is false, this assumes that overwrites are only possible for | // When check is false, this assumes that overwrites are only possible for | ||||
// coinbase transactions. | // coinbase transactions. | ||||
// When check is true, the underlying view may be queried to determine whether | // When check is true, the underlying view may be queried to determine whether | ||||
// an addition is an overwrite. | // an addition is an overwrite. | ||||
// TODO: pass in a boolean to limit these possible overwrites to known | // TODO: pass in a boolean to limit these possible overwrites to known | ||||
Show All 11 Lines |