[#SingleTRUCChecks]
= SingleTRUCChecks
:mrdocs:

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

== Synopsis

Declared in `&lt;policy&sol;truc&lowbar;policy&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
&lsqb;&lsqb;requires&lowbar;capability(0x7f2e281b8c60)&rsqb;&rsqb;
std::optional&lt;std::pair&lt;std::string, CTransactionRef&gt;&gt;
SingleTRUCChecks(
    xref:CTxMemPool.adoc[CTxMemPool] const& pool,
    xref:CTransactionRef.adoc[CTransactionRef] const& ptx,
    std::vector&lt;CTxMemPoolEntry::CTxMemPoolEntryRef&gt; const& mempool&lowbar;parents,
    std::set&lt;Txid&gt; const& direct&lowbar;conflicts,
    int64&lowbar;t vsize);
----

== Description

Checks the following rules&colon; 1&period; A TRUC tx must only have TRUC unconfirmed ancestors&period; 2&period; A non&hyphen;TRUC tx must only have non&hyphen;TRUC unconfirmed ancestors&period; 3&period; A TRUC&apos;s ancestor set, including itself, must be within TRUC&lowbar;ANCESTOR&lowbar;LIMIT&period; 4&period; A TRUC&apos;s descendant set, including itself, must be within TRUC&lowbar;DESCENDANT&lowbar;LIMIT&period; 5&period; If a TRUC tx has any unconfirmed ancestors, the tx&apos;s sigop&hyphen;adjusted vsize must be within TRUC&lowbar;CHILD&lowbar;MAX&lowbar;VSIZE&period; 6&period; A TRUC tx must be within TRUC&lowbar;MAX&lowbar;VSIZE&period;

== Return Value

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

== Parameters

[cols="1,4"]
|===
| Name| Description
| *pool* [in]
| A reference to the mempool&period;
| *ptx* [in]
| The transaction being checked&period;
| *mempool&lowbar;parents* [in]
| The in&hyphen;mempool ancestors of ptx&period;
| *direct&lowbar;conflicts* [in]
| In&hyphen;mempool transactions this tx conflicts with&period; These conflicts are used to more accurately calculate the resulting descendant count of in&hyphen;mempool ancestors&period;
| *vsize* [in]
| The sigop&hyphen;adjusted virtual size of ptx&period;
|===


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