SingleTRUCChecks

Must be called for every transaction, even if not TRUC. Not strictly necessary for transactions accepted through AcceptMultipleTransactions.

Synopsis

Declared in <policy/truc_policy.h>

[[requires_capability(0x7f2e281b8c60)]]
std::optional<std::pair<std::string, CTransactionRef>>
SingleTRUCChecks(
    CTxMemPool const& pool,
    CTransactionRef const& ptx,
    std::vector<CTxMemPoolEntry::CTxMemPoolEntryRef> const& mempool_parents,
    std::set<Txid> const& direct_conflicts,
    int64_t vsize);

Description

Checks the following rules: 1. A TRUC tx must only have TRUC unconfirmed ancestors. 2. A non-TRUC tx must only have non-TRUC unconfirmed ancestors. 3. A TRUC's ancestor set, including itself, must be within TRUC_ANCESTOR_LIMIT. 4. A TRUC's descendant set, including itself, must be within TRUC_DESCENDANT_LIMIT. 5. If a TRUC tx has any unconfirmed ancestors, the tx's sigop-adjusted vsize must be within TRUC_CHILD_MAX_VSIZE. 6. A TRUC tx must be within TRUC_MAX_VSIZE.

Return Value

3 possibilities: - std::nullopt if all TRUC checks were applied successfully - debug string + pointer to a mempool sibling if this transaction would be the second child in a 1-parent-1-child cluster; the caller may consider evicting the specified sibling or return an error with the debug string. - debug string + nullptr if this transaction violates some TRUC rule and sibling eviction is not applicable.

Parameters

NameDescription
pool [in]A reference to the mempool.
ptx [in]The transaction being checked.
mempool_parents [in]The in-mempool ancestors of ptx.
direct_conflicts [in]In-mempool transactions this tx conflicts with. These conflicts are used to more accurately calculate the resulting descendant count of in-mempool ancestors.
vsize [in]The sigop-adjusted virtual size of ptx.