[#AddCoins]
= AddCoins
:mrdocs:

Utility function to add all of a transaction&apos;s outputs to a cache&period; When check is false, this assumes that overwrites are only possible for coinbase transactions&period; When check is true, the underlying view may be queried to determine whether an addition is an overwrite&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
void
AddCoins(
    xref:CCoinsViewCache.adoc[CCoinsViewCache]& cache,
    xref:CTransaction.adoc[CTransaction] const& tx,
    int nHeight,
    bool check = false);
----

== Parameters

[cols="1,4"]
|===
| Name| Description
| *cache*
| Cache to add the transaction&apos;s outputs to&period;
| *tx*
| Transaction whose outputs are added&period;
| *nHeight*
| Height of the block that includes the transaction&period;
| *check*
| When true, query the underlying view to detect overwrites&period;
|===


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