69 std::unique_ptr<CDBWrapper>
m_db;
74 bool GetCoin(
const COutPoint &outpoint,
Coin &coin)
const override;
75 bool HaveCoin(
const COutPoint &outpoint)
const override;
79 bool erase =
true)
override;
100 bool GetKey(COutPoint &key)
const override;
104 bool Valid()
const override;
105 void Next()
override;
121 const std::vector<std::pair<int, const CBlockFileInfo *>> &fileInfo,
122 int nLastFile,
const std::vector<const CBlockIndex *> &blockinfo);
const CChainParams & Params()
Return the currently selected parameters.
The block chain is a tree shaped structure starting with the genesis block at the root,...
Access to the block database (blocks/index/)
bool ReadBlockFileInfo(int nFile, CBlockFileInfo &info)
bool Upgrade()
Attempt to update from an older database format.
bool WriteReindexing(bool fReindexing)
bool IsReindexing() const
bool WriteBatchSync(const std::vector< std::pair< int, const CBlockFileInfo * > > &fileInfo, int nLastFile, const std::vector< const CBlockIndex * > &blockinfo)
bool ReadFlag(const std::string &name, bool &fValue)
bool ReadLastBlockFile(int &nFile)
bool LoadBlockIndexGuts(const Consensus::Params ¶ms, std::function< CBlockIndex *(const BlockHash &)> insertBlockIndex) EXCLUSIVE_LOCKS_REQUIRED(
bool WriteFlag(const std::string &name, bool fValue)
Cursor for iterating over CoinsView state.
Specialization of CCoinsViewCursor to iterate over a CCoinsViewDB.
std::unique_ptr< CDBIterator > pcursor
bool GetKey(COutPoint &key) const override
bool GetValue(Coin &coin) const override
bool Valid() const override
CCoinsViewDBCursor(CDBIterator *pcursorIn, const BlockHash &hashBlockIn)
unsigned int GetValueSize() const override
std::pair< char, COutPoint > keyTmp
CCoinsView backed by the coin database (chainstate/)
BlockHash GetBestBlock() const override
Retrieve the block hash whose state this CCoinsView currently represents.
std::vector< BlockHash > GetHeadBlocks() const override
Retrieve the range of blocks that may have been only partially written.
bool GetCoin(const COutPoint &outpoint, Coin &coin) 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.
std::unique_ptr< CDBWrapper > m_db
bool Upgrade()
Attempt to update from an older database format.
CCoinsViewCursor * Cursor() const override
Get a cursor to iterate over the whole state.
CCoinsViewDB(DBParams db_params, CoinsViewOptions options)
bool BatchWrite(CCoinsMap &mapCoins, const BlockHash &hashBlock, bool erase=true) override
Do a bulk modification (multiple Coin changes + BestBlock change).
std::optional< fs::path > StoragePath()
void ResizeCache(size_t new_cache_size) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
Dynamically alter the underlying leveldb cache size.
CoinsViewOptions m_options
size_t EstimateSize() const override
Estimate database size (0 if not implemented)
Abstract view on the open txout dataset.
CDBWrapper(const DBParams ¶ms)
std::unordered_map< COutPoint, CCoinsCacheEntry, SaltedOutpointHasher, std::equal_to< COutPoint >, PoolAllocator< std::pair< const COutPoint, CCoinsCacheEntry >, sizeof(std::pair< const COutPoint, CCoinsCacheEntry >)+sizeof(void *) *4 > > CCoinsMap
PoolAllocator's MAX_BLOCK_SIZE_BYTES parameter here uses sizeof the data, and adds the size of 4 poin...
RecursiveMutex cs_main
Mutex to guard access to validation specific variables, such as reading or changing the chainstate.
A BlockHash is a unqiue identifier for a block.
User-controlled performance and debug options.
int simulate_crash_ratio
If non-zero, randomly exit when the database is flushed with (1/ratio) probability.
size_t batch_write_bytes
Maximum database write batch size in bytes.
Parameters that influence chain consensus.
Application-specific storage settings.
#define EXCLUSIVE_LOCKS_REQUIRED(...)
static constexpr int64_t MAX_TX_INDEX_CACHE_MB
Max memory allocated to block tree DB specific cache, if -txindex (MiB)
static constexpr int64_t MAX_DB_CACHE_MB
max. -dbcache (MiB)
static constexpr int64_t MAX_BLOCK_DB_CACHE_MB
Max memory allocated to block tree DB specific cache, if no -txindex (MiB)
static constexpr int64_t MIN_DB_CACHE_MB
min. -dbcache (MiB)
util::Result< void > CheckLegacyTxindex(CBlockTreeDB &block_tree_db)
static constexpr int64_t MAX_COINS_DB_CACHE_MB
Max memory allocated to coin DB specific cache (MiB)
static constexpr int64_t DEFAULT_DB_BATCH_SIZE
-dbbatchsize default (bytes)
static constexpr int64_t DEFAULT_DB_CACHE_MB
-dbcache default (MiB)
static constexpr int64_t MAX_FILTER_INDEX_CACHE_MB
Max memory allocated to all block filter index caches combined in MiB.