[#PackageTRUCChecks]
= PackageTRUCChecks
:mrdocs:

Must be called for every transaction that is submitted within a package, even if not TRUC&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(0x7f2e281b9650)&rsqb;&rsqb;
std::optional&lt;std::string&gt;
PackageTRUCChecks(
    xref:CTxMemPool.adoc[CTxMemPool] const& pool,
    xref:CTransactionRef.adoc[CTransactionRef] const& ptx,
    int64&lowbar;t vsize,
    xref:Package.adoc[Package] const& package,
    std::vector&lt;CTxMemPoolEntry::CTxMemPoolEntryRef&gt; const& mempool&lowbar;parents);
----

== Description

For each transaction in a package&colon; If it&apos;s not a TRUC transaction, verify it has no direct TRUC parents in the mempool or the package&period;

If it is a TRUC transaction, verify that any direct parents in the mempool or the package are TRUC&period; If such a parent exists, verify that parent has no other children in the package or the mempool, and that the transaction itself has no children in the package&period;

If any TRUC violations in the package exist, this test will fail for one of them&colon;

* if a TRUC transaction T has a parent in the mempool and a child in the package, then PTRUCC(T) will fail
* if a TRUC transaction T has a parent in the package and a child in the package, then PTRUCC(T) will fail
* if a TRUC transaction T and a TRUC (sibling) transaction U have some parent in the mempool, then PTRUCC(T) and PTRUCC(U) will fail
* if a TRUC transaction T and a TRUC (sibling) transaction U have some parent in the package, then PTRUCC(T) and PTRUCC(U) will fail
* if a TRUC transaction T has a parent P and a grandparent G in the package, then PTRUCC(P) will fail (though PTRUCC(G) and PTRUCC(T) might succeed)&period;

== Return Value

debug string if an error occurs, std&colon;&colon;nullopt otherwise&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *pool* [in]
| A reference to the mempool&period;
| *ptx* [in]
| The transaction being checked&period;
| *vsize* [in]
| The sigop&hyphen;adjusted virtual size of ptx&period;
| *package* [in]
| The package that ptx belongs to&period;
| *mempool&lowbar;parents* [in]
| The in&hyphen;mempool ancestors of ptx&period;
|===


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