CCoinsViewMemPool

CCoinsView that brings transactions from a mempool into view. It does not check for spendings by memory pool transactions. 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. This allows transaction replacement to work as expected, as you want to have all inputs "available" to check signatures, and any cycles in the dependency graph are checked directly in AcceptToMemoryPool. It also allows you to sign a double-spend directly in signrawtransactionwithkey and signrawtransactionwithwallet, as long as the conflicting transaction is not yet confirmed.

Synopsis

Declared in <txmempool.h>

class CCoinsViewMemPool
    : public CCoinsViewBacked

Base Classes

NameDescription
CCoinsViewBackedCCoinsView backed by another CCoinsView

Member Functions

NameDescription
CCoinsViewMemPool [constructor]Construct a mempool-backed coins view over the given base view and mempool.
BatchWrite [virtual]Forward the bulk write to the backing view.
EstimateSize [virtual]Forward the size estimate to the backing view.
GetBestBlock [virtual]Forward the best-block query to the backing view.
GetCoin [virtual]GetCoin, returning whether it exists and is not spent. Also updates m_non_base_coins if the coin is not fetched from base. May populate the base view on cache misses.
GetHeadBlocks [virtual]Forward the head-blocks query to the backing view.
GetNonBaseCoins Get all coins in m_non_base_coins.
HaveCoin [virtual]Forward the unspent check to the backing view.
PackageAddTransaction Add the coins created by this transaction. These coins are only temporarily stored in m_temp_added and cannot be flushed to the back end. Only used for package validation.
PeekCoin [virtual]Forward the non-caching lookup to the backing view.
Reset Clear m_temp_added and m_non_base_coins.
SetBackend Replace the backing view.

Protected Data Members

NameDescription
base The underlying view that all calls are forwarded to.
mempool The mempool whose transaction outputs are brought into view.