Bitcoin Core  27.99.0
P2P Digital Currency
Public Member Functions | List of all members
CoinsViews Class Reference

A convenience class for constructing the CCoinsView* hierarchy used to facilitate access to the UTXO set. More...

#include <validation.h>

Public Member Functions

CCoinsViewDB m_dbview GUARDED_BY (cs_main)
 The lowest level of the CoinsViews cache hierarchy sits in a leveldb database on disk. More...
 
CCoinsViewErrorCatcher m_catcherview GUARDED_BY (cs_main)
 This view wraps access to the leveldb instance and handles read errors gracefully. More...
 
std::unique_ptr< CCoinsViewCache > m_cacheview GUARDED_BY (cs_main)
 This is the top layer of the cache hierarchy - it keeps as many coins in memory as can fit per the dbcache setting. More...
 
 CoinsViews (DBParams db_params, CoinsViewOptions options)
 This constructor initializes CCoinsViewDB and CCoinsViewErrorCatcher instances, but it does not create a CCoinsViewCache instance by default. More...
 

Detailed Description

A convenience class for constructing the CCoinsView* hierarchy used to facilitate access to the UTXO set.

This class consists of an arrangement of layered CCoinsView objects, preferring to store and retrieve coins in memory via m_cacheview but ultimately falling back on cache misses to the canonical store of UTXOs on disk, m_dbview.

Definition at line 441 of file validation.h.

Constructor & Destructor Documentation

◆ CoinsViews()

CoinsViews::CoinsViews ( DBParams  db_params,
CoinsViewOptions  options 
)

This constructor initializes CCoinsViewDB and CCoinsViewErrorCatcher instances, but it does not create a CCoinsViewCache instance by default.

This is done separately because the presence of the cache has implications on whether or not we're allowed to flush the cache's state to disk, which should not be done until the health of the database is verified.

All arguments forwarded onto CCoinsViewDB.

Definition at line 1763 of file validation.cpp.

Member Function Documentation

◆ GUARDED_BY() [1/3]

CCoinsViewDB m_dbview CoinsViews::GUARDED_BY ( cs_main  )

The lowest level of the CoinsViews cache hierarchy sits in a leveldb database on disk.

All unspent coins reside in this store.

◆ GUARDED_BY() [2/3]

CCoinsViewErrorCatcher m_catcherview CoinsViews::GUARDED_BY ( cs_main  )

This view wraps access to the leveldb instance and handles read errors gracefully.

◆ GUARDED_BY() [3/3]

std::unique_ptr<CCoinsViewCache> m_cacheview CoinsViews::GUARDED_BY ( cs_main  )

This is the top layer of the cache hierarchy - it keeps as many coins in memory as can fit per the dbcache setting.


The documentation for this class was generated from the following files: