Bitcoin ABC 0.26.3
P2P Digital Currency
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | List of all members
CCoinsCacheEntry Struct Reference

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

#include <coins.h>

Collaboration diagram for CCoinsCacheEntry:
[legend]

Public Types

enum  Flags { DIRTY = (1 << 0) , FRESH = (1 << 1) }
 

Public Member Functions

 CCoinsCacheEntry ()
 
 CCoinsCacheEntry (Coin coinIn)
 
 CCoinsCacheEntry (Coin &&coin_, uint8_t flag)
 

Public Attributes

Coin coin
 
uint8_t flags
 

Detailed Description

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

A coin can either be:

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

Definition at line 91 of file coins.h.

Member Enumeration Documentation

◆ Flags

Enumerator
DIRTY 

DIRTY means the CCoinsCacheEntry is potentially different from the version in the parent cache.

Failure to mark a coin as DIRTY when it is potentially different from the parent cache will cause a consensus failure, since the coin's state won't get written to the parent when the cache is flushed.

FRESH 

FRESH means the parent cache does not have this coin or that it is a spent coin in the parent cache.

If a FRESH coin in the cache is later spent, it can be deleted entirely and doesn't ever need to be flushed to the parent. This is a performance optimization. Marking a coin as FRESH when it exists unspent in the parent cache will cause a consensus failure, since it might not be deleted from the parent when this cache is flushed.

Definition at line 96 of file coins.h.

Constructor & Destructor Documentation

◆ CCoinsCacheEntry() [1/3]

CCoinsCacheEntry::CCoinsCacheEntry ( )
inline

Definition at line 117 of file coins.h.

◆ CCoinsCacheEntry() [2/3]

CCoinsCacheEntry::CCoinsCacheEntry ( Coin  coinIn)
inlineexplicit

Definition at line 118 of file coins.h.

◆ CCoinsCacheEntry() [3/3]

CCoinsCacheEntry::CCoinsCacheEntry ( Coin &&  coin_,
uint8_t  flag 
)
inline

Definition at line 120 of file coins.h.

Member Data Documentation

◆ coin

Coin CCoinsCacheEntry::coin

Definition at line 93 of file coins.h.

◆ flags

uint8_t CCoinsCacheEntry::flags

Definition at line 94 of file coins.h.


The documentation for this struct was generated from the following file: