[#CCoinsViewMemPool]
= CCoinsViewMemPool
:mrdocs:

CCoinsView that brings transactions from a mempool into view&period; It does not check for spendings by memory pool transactions&period; Instead, it provides access to all Coins which are either unspent in the base CCoinsView, are outputs from any mempool transaction, or are tracked temporarily to allow transaction dependencies in package validation&period; This allows transaction replacement to work as expected, as you want to have all inputs &quot;available&quot; to check signatures, and any cycles in the dependency graph are checked directly in AcceptToMemoryPool&period; It also allows you to sign a double&hyphen;spend directly in signrawtransactionwithkey and signrawtransactionwithwallet, as long as the conflicting transaction is not yet confirmed&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
class CCoinsViewMemPool
    : public xref:CCoinsViewBacked.adoc[CCoinsViewBacked]
----

== Base Classes

[cols="1,4"]
|===
| Name| Description
| `xref:CCoinsViewBacked.adoc[CCoinsViewBacked]`
| CCoinsView backed by another CCoinsView
|===

== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:CCoinsViewMemPool/2constructor.adoc[`CCoinsViewMemPool`]         [.small]#[constructor]#
| Construct a mempool&hyphen;backed coins view over the given base view and mempool&period;
| xref:CCoinsViewBacked/BatchWrite.adoc[`BatchWrite`]  [.small]#[virtual]#
| Forward the bulk write to the backing view&period;
| xref:CCoinsViewBacked/EstimateSize.adoc[`EstimateSize`]  [.small]#[virtual]#
| Forward the size estimate to the backing view&period;
| xref:CCoinsViewBacked/GetBestBlock.adoc[`GetBestBlock`]  [.small]#[virtual]#
| Forward the best&hyphen;block query to the backing view&period;
| xref:CCoinsViewMemPool/GetCoin.adoc[`GetCoin`]  [.small]#[virtual]#
| GetCoin, returning whether it exists and is not spent&period; Also updates m&lowbar;non&lowbar;base&lowbar;coins if the coin is not fetched from base&period; May populate the base view on cache misses&period;
| xref:CCoinsViewBacked/GetHeadBlocks.adoc[`GetHeadBlocks`]  [.small]#[virtual]#
| Forward the head&hyphen;blocks query to the backing view&period;
| xref:CCoinsViewMemPool/GetNonBaseCoins.adoc[`GetNonBaseCoins`] 
| Get all coins in m&lowbar;non&lowbar;base&lowbar;coins&period;
| xref:CCoinsViewBacked/HaveCoin.adoc[`HaveCoin`]  [.small]#[virtual]#
| Forward the unspent check to the backing view&period;
| xref:CCoinsViewMemPool/PackageAddTransaction.adoc[`PackageAddTransaction`] 
| Add the coins created by this transaction&period; These coins are only temporarily stored in m&lowbar;temp&lowbar;added and cannot be flushed to the back end&period; Only used for package validation&period;
| xref:CCoinsViewBacked/PeekCoin.adoc[`PeekCoin`]  [.small]#[virtual]#
| Forward the non&hyphen;caching lookup to the backing view&period;
| xref:CCoinsViewMemPool/Reset.adoc[`Reset`] 
| Clear m&lowbar;temp&lowbar;added and m&lowbar;non&lowbar;base&lowbar;coins&period;
| xref:CCoinsViewBacked/SetBackend.adoc[`SetBackend`] 
| Replace the backing view&period;
|===


== Protected Data Members

[cols="1,4"]
|===
| Name| Description
| xref:CCoinsViewBacked/base.adoc[`base`] 
| The underlying view that all calls are forwarded to&period;
| xref:CCoinsViewMemPool/mempool.adoc[`mempool`] 
| The mempool whose transaction outputs are brought into view&period;
|===



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