CoinsViews

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

Synopsis

Declared in <validation.h>

class CoinsViews;

Description

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.

Member Functions

NameDescription
CoinsViews [constructor]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.
InitCache Initialize the CCoinsViewCache member.

Data Members

NameDescription
m_cacheview This is the top layer of the cache hierarchy - it keeps as many coins in memory as can fit per the dbcache setting.
m_catcherview This view wraps access to the leveldb instance and handles read errors gracefully.
m_connect_block_view Reused CoinsViewOverlay layered on top of m_cacheview and passed to ConnectBlock(). Reset between calls and flushed only on success, so invalid blocks don't pollute the underlying cache.
m_dbview The lowest level of the CoinsViews cache hierarchy sits in a leveldb database on disk. All unspent coins reside in this store.