Changeset View
Changeset View
Standalone View
Standalone View
src/coins.h
Show First 20 Lines • Show All 411 Lines • ▼ Show 20 Lines | public: | ||||
//! The passed mapCoins can be modified. | //! The passed mapCoins can be modified. | ||||
virtual bool BatchWrite(CCoinsMap &mapCoins, const uint256 &hashBlock); | virtual bool BatchWrite(CCoinsMap &mapCoins, const uint256 &hashBlock); | ||||
//! Get a cursor to iterate over the whole state | //! Get a cursor to iterate over the whole state | ||||
virtual CCoinsViewCursor *Cursor() const; | virtual CCoinsViewCursor *Cursor() const; | ||||
//! As we use CCoinsViews polymorphically, have a virtual destructor | //! As we use CCoinsViews polymorphically, have a virtual destructor | ||||
virtual ~CCoinsView() {} | virtual ~CCoinsView() {} | ||||
//! Estimate database size (0 if not implemented) | |||||
virtual size_t EstimateSize() const { return 0; } | |||||
}; | }; | ||||
/** CCoinsView backed by another CCoinsView */ | /** CCoinsView backed by another CCoinsView */ | ||||
class CCoinsViewBacked : public CCoinsView { | class CCoinsViewBacked : public CCoinsView { | ||||
protected: | protected: | ||||
CCoinsView *base; | CCoinsView *base; | ||||
bool GetCoins(const uint256 &txid, CCoins &coins) const; | bool GetCoins(const uint256 &txid, CCoins &coins) const; | ||||
bool HaveCoins(const uint256 &txid) const; | bool HaveCoins(const uint256 &txid) const; | ||||
public: | public: | ||||
CCoinsViewBacked(CCoinsView *viewIn); | CCoinsViewBacked(CCoinsView *viewIn); | ||||
uint256 GetBestBlock() const; | uint256 GetBestBlock() const; | ||||
void SetBackend(CCoinsView &viewIn); | void SetBackend(CCoinsView &viewIn); | ||||
bool BatchWrite(CCoinsMap &mapCoins, const uint256 &hashBlock); | bool BatchWrite(CCoinsMap &mapCoins, const uint256 &hashBlock); | ||||
CCoinsViewCursor *Cursor() const; | CCoinsViewCursor *Cursor() const; | ||||
size_t EstimateSize() const override; | |||||
}; | }; | ||||
/** | /** | ||||
* CCoinsView that adds a memory cache for transactions to another CCoinsView | * CCoinsView that adds a memory cache for transactions to another CCoinsView | ||||
*/ | */ | ||||
class CCoinsViewCache : public CCoinsViewBacked { | class CCoinsViewCache : public CCoinsViewBacked { | ||||
protected: | protected: | ||||
/** | /** | ||||
▲ Show 20 Lines • Show All 128 Lines • Show Last 20 Lines |