|
| | CCoinsViewCache (CCoinsView *baseIn, bool deterministic=false) |
| |
| | CCoinsViewCache (const CCoinsViewCache &)=delete |
| | By deleting the copy constructor, we prevent accidentally using it when one intends to create a cache on top of a base cache.
|
| |
| std::optional< Coin > | GetCoin (const COutPoint &outpoint) const override |
| | Retrieve the Coin (unspent transaction output) for a given outpoint.
|
| |
| bool | HaveCoin (const COutPoint &outpoint) const override |
| | Just check whether a given outpoint is unspent.
|
| |
| BlockHash | GetBestBlock () const override |
| | Retrieve the block hash whose state this CCoinsView currently represents.
|
| |
| void | SetBestBlock (const BlockHash &hashBlock) |
| |
| void | BatchWrite (CoinsViewCacheCursor &cursor, const BlockHash &hashBlock) override |
| | Do a bulk modification (multiple Coin changes + BestBlock change).
|
| |
| CCoinsViewCursor * | Cursor () const override |
| | Get a cursor to iterate over the whole state.
|
| |
| bool | HaveCoinInCache (const COutPoint &outpoint) const |
| | Check if we have the given utxo already loaded in this cache.
|
| |
| const Coin & | AccessCoin (const COutPoint &output) const |
| | Return a reference to Coin in the cache, or coinEmpty if not found.
|
| |
| void | AddCoin (const COutPoint &outpoint, Coin coin, bool possible_overwrite) |
| | Add a coin.
|
| |
| void | EmplaceCoinInternalDANGER (COutPoint &&outpoint, Coin &&coin) |
| | Emplace a coin into cacheCoins without performing any checks, marking the emplaced coin as dirty.
|
| |
| bool | SpendCoin (const COutPoint &outpoint, Coin *moveto=nullptr) |
| | Spend a coin.
|
| |
| void | Flush (bool reallocate_cache=true) |
| | Push the modifications applied to this cache to its base and wipe local state.
|
| |
| void | Sync () |
| | Push the modifications applied to this cache to its base while retaining the contents of this cache (except for spent coins, which we erase).
|
| |
| void | Uncache (const COutPoint &outpoint) |
| | Removes the UTXO with the given outpoint from the cache, if it is not modified.
|
| |
| unsigned int | GetCacheSize () const |
| | Size of the cache (in number of transaction outputs)
|
| |
| size_t | GetDirtyCount () const noexcept |
| | Number of dirty cache entries (transaction outputs)
|
| |
| size_t | DynamicMemoryUsage () const |
| | Calculate the size of the cache (in bytes)
|
| |
| bool | HaveInputs (const CTransaction &tx) const |
| | Check whether all prevouts of the transaction are present in the UTXO set represented by this view.
|
| |
| void | ReallocateCache () |
| | Force a reallocation of the cache map.
|
| |
| void | SanityCheck () const |
| | Run an internal sanity check on the cache data structure.
|
| |
| ResetGuard | CreateResetGuard () noexcept |
| | Create a scoped guard that will call Reset() on this cache when it goes out of scope.
|
| |
| | CCoinsViewBacked (CCoinsView *viewIn) |
| |
| std::vector< BlockHash > | GetHeadBlocks () const override |
| | Retrieve the range of blocks that may have been only partially written.
|
| |
| void | SetBackend (CCoinsView &viewIn) |
| |
| size_t | EstimateSize () const override |
| | Estimate database size (0 if not implemented)
|
| |
| virtual | ~CCoinsView ()=default |
| | As we use CCoinsViews polymorphically, have a virtual destructor.
|
| |
CCoinsView that adds a memory cache for transactions to another CCoinsView.
Definition at line 357 of file coins.h.
| const Coin & CCoinsViewCache::AccessCoin |
( |
const COutPoint & |
output | ) |
const |
Return a reference to Coin in the cache, or coinEmpty if not found.
This is more efficient than GetCoin.
Generally, do not hold the reference returned for more than a short scope. While the current implementation allows for modifications to the contents of the cache while holding the reference, this behavior should not be relied on! To be safe, best to not hold the returned reference through any other calls to this cache.
Definition at line 199 of file coins.cpp.
| void CCoinsViewCache::Flush |
( |
bool |
reallocate_cache = true | ) |
|
Push the modifications applied to this cache to its base and wipe local state.
Failure to call this method or Sync() before destruction will cause the changes to be forgotten. If reallocate_cache is false, the cache will retain the same memory footprint after flushing and should be destroyed to deallocate. If false is returned, the state of this cache (and its backing view) will be undefined.
Definition at line 307 of file coins.cpp.