Changeset View
Changeset View
Standalone View
Standalone View
src/coins.h
Show All 9 Lines | |||||
#include "core_memusage.h" | #include "core_memusage.h" | ||||
#include "hash.h" | #include "hash.h" | ||||
#include "memusage.h" | #include "memusage.h" | ||||
#include "serialize.h" | #include "serialize.h" | ||||
#include "uint256.h" | #include "uint256.h" | ||||
#include <cassert> | #include <cassert> | ||||
#include <cstdint> | #include <cstdint> | ||||
#include <unordered_map> | #include <unordered_map> | ||||
/** | /** | ||||
* A UTXO entry. | * A UTXO entry. | ||||
* | * | ||||
* Serialized format: | * Serialized format: | ||||
* - VARINT((coinbase ? 1 : 0) | (height << 1)) | * - VARINT((coinbase ? 1 : 0) | (height << 1)) | ||||
* - the non-spent CTxOut (via CTxOutCompressor) | * - the non-spent CTxOut (via CTxOutCompressor) | ||||
▲ Show 20 Lines • Show All 166 Lines • ▼ Show 20 Lines | protected: | ||||
/* 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); | ||||
// Standard CCoinsView methods | // Standard CCoinsView methods | ||||
bool GetCoin(const COutPoint &outpoint, Coin &coin) const; | bool GetCoin(const COutPoint &outpoint, Coin &coin) const override; | ||||
bool HaveCoin(const COutPoint &outpoint) const; | bool HaveCoin(const COutPoint &outpoint) const override; | ||||
uint256 GetBestBlock() const; | uint256 GetBestBlock() const override; | ||||
void SetBestBlock(const uint256 &hashBlock); | void SetBestBlock(const uint256 &hashBlock); | ||||
bool BatchWrite(CCoinsMap &mapCoins, const uint256 &hashBlock); | bool BatchWrite(CCoinsMap &mapCoins, const uint256 &hashBlock) override; | ||||
/** | /** | ||||
* Check if we have the given utxo already loaded in this cache. | * Check if we have the given utxo already loaded in this cache. | ||||
* The semantics are the same as HaveCoin(), but no calls to the backing | * The semantics are the same as HaveCoin(), but no calls to the backing | ||||
* CCoinsView are made. | * CCoinsView are made. | ||||
*/ | */ | ||||
bool HaveCoinInCache(const COutPoint &outpoint) const; | bool HaveCoinInCache(const COutPoint &outpoint) const; | ||||
▲ Show 20 Lines • Show All 85 Lines • Show Last 20 Lines |