Bitcoin Core 28.99.0
P2P Digital Currency
|
#include <policy/truc_policy.h>
#include <coins.h>
#include <consensus/amount.h>
#include <logging.h>
#include <tinyformat.h>
#include <util/check.h>
#include <algorithm>
#include <numeric>
#include <vector>
Go to the source code of this file.
Classes | |
struct | ParentInfo |
Helper for PackageTRUCChecks, storing info for a mempool or package parent. More... | |
Functions | |
std::vector< size_t > | FindInPackageParents (const Package &package, const CTransactionRef &ptx) |
Helper for PackageTRUCChecks: Returns a vector containing the indices of transactions (within package) that are direct parents of ptx. More... | |
std::optional< std::string > | PackageTRUCChecks (const CTransactionRef &ptx, int64_t vsize, const Package &package, const CTxMemPool::setEntries &mempool_ancestors) |
Must be called for every transaction that is submitted within a package, even if not TRUC. More... | |
std::optional< std::pair< std::string, CTransactionRef > > | SingleTRUCChecks (const CTransactionRef &ptx, const CTxMemPool::setEntries &mempool_ancestors, const std::set< Txid > &direct_conflicts, int64_t vsize) |
Must be called for every transaction, even if not TRUC. More... | |
std::vector< size_t > FindInPackageParents | ( | const Package & | package, |
const CTransactionRef & | ptx | ||
) |
Helper for PackageTRUCChecks: Returns a vector containing the indices of transactions (within package) that are direct parents of ptx.
Definition at line 19 of file truc_policy.cpp.
std::optional< std::string > PackageTRUCChecks | ( | const CTransactionRef & | ptx, |
int64_t | vsize, | ||
const Package & | package, | ||
const CTxMemPool::setEntries & | mempool_ancestors | ||
) |
Must be called for every transaction that is submitted within a package, even if not TRUC.
For each transaction in a package: If it's not a TRUC transaction, verify it has no direct TRUC parents in the mempool or the package.
If it is a TRUC transaction, verify that any direct parents in the mempool or the package are TRUC. 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.
If any TRUC violations in the package exist, this test will fail for one of them:
Definition at line 58 of file truc_policy.cpp.
std::optional< std::pair< std::string, CTransactionRef > > SingleTRUCChecks | ( | const CTransactionRef & | ptx, |
const CTxMemPool::setEntries & | mempool_ancestors, | ||
const std::set< Txid > & | direct_conflicts, | ||
int64_t | vsize | ||
) |
Must be called for every transaction, even if not TRUC.
Not strictly necessary for transactions accepted through AcceptMultipleTransactions.
Checks the following rules:
[in] | mempool_ancestors | The in-mempool ancestors of ptx. |
[in] | direct_conflicts | In-mempool transactions this tx conflicts with. These conflicts are used to more accurately calculate the resulting descendant count of in-mempool ancestors. |
[in] | vsize | The sigop-adjusted virtual size of ptx. |
Definition at line 164 of file truc_policy.cpp.