[#CCoinsCacheEntry]
= CCoinsCacheEntry
:mrdocs:

A Coin in one level of the coins database caching hierarchy&period;

== Synopsis

Declared in `&lt;coins&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
struct CCoinsCacheEntry;
----

== Description

A coin can either be&colon;

* unspent or spent (in which case the Coin object will be nulled out &hyphen; see Coin&period;Clear())
* DIRTY or not DIRTY
* FRESH or not FRESH

Out of these 2&circ;3 &equals; 8 states, only some combinations are valid&colon;

* unspent, FRESH, DIRTY (e&period;g&period; a new coin created in the cache)
* unspent, not FRESH, DIRTY (e&period;g&period; a coin changed in the cache during a reorg)
* unspent, not FRESH, not DIRTY (e&period;g&period; an unspent coin fetched from the parent cache)
* spent, not FRESH, DIRTY (e&period;g&period; a coin is spent and spentness needs to be flushed to the parent)

== Enums

[cols="1,4"]
|===
| Name| Description
| xref:CCoinsCacheEntry/Flags.adoc[`Flags`] 
| Per&hyphen;entry state flags controlling how an entry is flushed to the parent cache&period;
|===


== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:CCoinsCacheEntry/2constructor-00.adoc[`CCoinsCacheEntry`]         [.small]#[constructor]#
| Constructors
| xref:CCoinsCacheEntry/2destructor.adoc[`&#126;CCoinsCacheEntry`] [.small]#[destructor]#
| Remove the entry from the flagged linked list before it is destroyed&period;
| xref:CCoinsCacheEntry/IsDirty.adoc[`IsDirty`] 
| Report whether the entry is marked DIRTY&period;
| xref:CCoinsCacheEntry/IsFresh.adoc[`IsFresh`] 
| Report whether the entry is marked FRESH&period;
| xref:CCoinsCacheEntry/Next.adoc[`Next`] 
| Only call Next when this entry is DIRTY, FRESH, or both
| xref:CCoinsCacheEntry/Prev.adoc[`Prev`] 
| Only call Prev when this entry is DIRTY, FRESH, or both
| xref:CCoinsCacheEntry/SelfRef.adoc[`SelfRef`] 
| Only use this for initializing the linked list sentinel
| xref:CCoinsCacheEntry/SetClean.adoc[`SetClean`] 
| Clear all flags and unlink the entry from the flagged linked list&period;
|===


== Static Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:CCoinsCacheEntry/SetDirty.adoc[`SetDirty`] 
| Mark an entry DIRTY, adding it to the flagged linked list if needed&period;
| xref:CCoinsCacheEntry/SetFresh.adoc[`SetFresh`] 
| Mark an entry FRESH, adding it to the flagged linked list if needed&period;
|===


== Data Members

[cols="1,4"]
|===
| Name| Description
| xref:CCoinsCacheEntry/coin.adoc[`coin`] 
| The actual cached coin data&period;
|===



[.small]#Created with https://www.mrdocs.com[MrDocs]#
