CCoinsCacheEntry

A Coin in one level of the coins database caching hierarchy.

Synopsis

Declared in <coins.h>

struct CCoinsCacheEntry;

Description

A coin can either be:

  • unspent or spent (in which case the Coin object will be nulled out - see Coin.Clear())

  • DIRTY or not DIRTY

  • FRESH or not FRESH

Out of these 2^3 = 8 states, only some combinations are valid:

  • unspent, FRESH, DIRTY (e.g. a new coin created in the cache)

  • unspent, not FRESH, DIRTY (e.g. a coin changed in the cache during a reorg)

  • unspent, not FRESH, not DIRTY (e.g. an unspent coin fetched from the parent cache)

  • spent, not FRESH, DIRTY (e.g. a coin is spent and spentness needs to be flushed to the parent)

Enums

NameDescription
Flags Per-entry state flags controlling how an entry is flushed to the parent cache.

Member Functions

NameDescription
CCoinsCacheEntry [constructor]Constructors
~CCoinsCacheEntry [destructor]Remove the entry from the flagged linked list before it is destroyed.
IsDirty Report whether the entry is marked DIRTY.
IsFresh Report whether the entry is marked FRESH.
Next Only call Next when this entry is DIRTY, FRESH, or both
Prev Only call Prev when this entry is DIRTY, FRESH, or both
SelfRef Only use this for initializing the linked list sentinel
SetClean Clear all flags and unlink the entry from the flagged linked list.

Static Member Functions

NameDescription
SetDirty Mark an entry DIRTY, adding it to the flagged linked list if needed.
SetFresh Mark an entry FRESH, adding it to the flagged linked list if needed.

Data Members

NameDescription
coin The actual cached coin data.