![]() |
PRCYCoin
2.0.0.7rc1
P2P Digital Currency
|
CCoinsView that adds a memory cache for transactions to another CCoinsView. More...
#include <coins.h>
Public Member Functions | |
| CCoinsViewCache (CCoinsView *baseIn) | |
| ~CCoinsViewCache () | |
| bool | GetCoins (const uint256 &txid, CCoins &coins) const |
| Retrieve the CCoins (unspent transaction outputs) for a given txid. More... | |
| bool | HaveCoins (const uint256 &txid) const |
| Just check whether we have data for a given txid. More... | |
| uint256 | GetBestBlock () const |
| Retrieve the block hash whose state this CCoinsView currently represents. More... | |
| void | SetBestBlock (const uint256 &hashBlock) |
| bool | BatchWrite (CCoinsMap &mapCoins, const uint256 &hashBlock) |
| Do a bulk modification (multiple CCoins changes + BestBlock change). More... | |
| const CCoins * | AccessCoins (const uint256 &txid) const |
| Return a pointer to CCoins in the cache, or NULL if not found. More... | |
| CCoinsModifier | ModifyCoins (const uint256 &txid) |
| Return a modifiable reference to a CCoins. More... | |
| bool | Flush () |
| Push the modifications applied to this cache to its base. More... | |
| unsigned int | GetCacheSize () const |
| Calculate the size of the cache (in number of transactions) More... | |
| size_t | DynamicMemoryUsage () const |
| Calculate the size of the cache (in bytes) More... | |
| bool | HaveInputs (const CTransaction &tx) const |
| Check whether all prevouts of the transaction are present in the UTXO set represented by this view. More... | |
| const CTxOut & | GetOutputFor (const CTxIn &input) const |
Public Member Functions inherited from CCoinsViewBacked | |
| CCoinsViewBacked (CCoinsView *viewIn) | |
| void | SetBackend (CCoinsView &viewIn) |
| bool | GetStats (CCoinsStats &stats) const |
| Calculate statistics about the unspent transaction output set. More... | |
Public Member Functions inherited from CCoinsView | |
| virtual | ~CCoinsView () |
| As we use CCoinsViews polymorphically, have a virtual destructor. More... | |
Protected Attributes | |
| bool | hasModifier |
| uint256 | hashBlock |
| Make mutable so that we can "fill the cache" even from Get-methods declared as "const". More... | |
| CCoinsMap | cacheCoins |
| size_t | cachedCoinsUsage |
Protected Attributes inherited from CCoinsViewBacked | |
| CCoinsView * | base |
Private Member Functions | |
| CCoinsMap::iterator | FetchCoins (const uint256 &txid) |
| CCoinsMap::const_iterator | FetchCoins (const uint256 &txid) const |
Friends | |
| class | CCoinsModifier |
CCoinsView that adds a memory cache for transactions to another CCoinsView.
| CCoinsViewCache::CCoinsViewCache | ( | CCoinsView * | baseIn | ) |
Return a pointer to CCoins in the cache, or NULL if not found.
This is more efficient than GetCoins. Modifications to other cache entries are allowed while accessing the returned pointer.
Definition at line 145 of file coins.cpp.
Do a bulk modification (multiple CCoins changes + BestBlock change).
The passed mapCoins can be modified.
Reimplemented from CCoinsViewBacked.
Definition at line 177 of file coins.cpp.
| size_t CCoinsViewCache::DynamicMemoryUsage | ( | ) | const |
|
private |
|
private |
| bool CCoinsViewCache::Flush | ( | ) |
Push the modifications applied to this cache to its base.
Failure to call this method before destruction will cause the changes to be forgotten. If false is returned, the state of this cache (and its backing view) will be undefined.
Definition at line 223 of file coins.cpp.
|
virtual |
Retrieve the block hash whose state this CCoinsView currently represents.
Reimplemented from CCoinsViewBacked.
Definition at line 165 of file coins.cpp.
| unsigned int CCoinsViewCache::GetCacheSize | ( | ) | const |
Retrieve the CCoins (unspent transaction outputs) for a given txid.
Reimplemented from CCoinsViewBacked.
Definition at line 113 of file coins.cpp.
|
virtual |
Just check whether we have data for a given txid.
This may (but cannot always) return true for fully spent transactions
Reimplemented from CCoinsViewBacked.
Definition at line 155 of file coins.cpp.
| bool CCoinsViewCache::HaveInputs | ( | const CTransaction & | tx | ) | const |
| CCoinsModifier CCoinsViewCache::ModifyCoins | ( | const uint256 & | txid | ) |
| void CCoinsViewCache::SetBestBlock | ( | const uint256 & | hashBlock | ) |
|
friend |
|
mutableprotected |
1.8.17