@ -15,18 +15,22 @@
/** Default maximum number of transactions in a package. */
static constexpr uint32_t MAX_PACKAGE_COUNT { 25 } ;
/** Default maximum total virtual size of transactions in a package in KvB. */
static constexpr uint32_t MAX_PACKAGE_SIZE { 101 } ;
static_assert ( MAX_PACKAGE_SIZE * WITNESS_SCALE_FACTOR * 1000 > = MAX_STANDARD_TX_WEIGHT ) ;
/** Default maximum total weight of transactions in a package in weight
to allow for context - less checks . This must allow a superset of sigops
weighted vsize limited transactions to not disallow transactions we would
have otherwise accepted individually . */
static constexpr uint32_t MAX_PACKAGE_WEIGHT = 404 ' 000 ;
static_assert ( MAX_PACKAGE_WEIGHT > = MAX_STANDARD_TX_WEIGHT ) ;
// If a package is submitted, it must be within the mempool's ancestor/descendant limits. Since a
// submitted package must be child-with-unconfirmed-parents (all of the transactions are an ancestor
// If a package is to be evaluated, it must be at least as large as the mempool's ancestor/descendant limits,
// otherwise transactions that would be individually accepted may be rejected in a package erroneously.
// Since a submitted package must be child-with-unconfirmed-parents (all of the transactions are an ancestor
// of the child), package limits are ultimately bounded by mempool package limits. Ensure that the
// defaults reflect this constraint.
static_assert ( DEFAULT_DESCENDANT_LIMIT > = MAX_PACKAGE_COUNT ) ;
static_assert ( DEFAULT_ANCESTOR_LIMIT > = MAX_PACKAGE_COUNT ) ;
static_assert ( DEFAULT_ANCESTOR_SIZE_LIMIT_KVB > = MAX_PACKAGE_SIZE ) ;
static_assert ( DEFAULT_DESCENDANT_SIZE_LIMIT_KVB > = MAX_PACKAGE_SIZE ) ;
static_assert ( MAX_PACKAGE_WEIGHT > = DEFAULT_ANCESTOR_SIZE_LIMIT_KVB * WITNESS_SCALE_FACTOR * 1000 ) ;
static_assert ( MAX_PACKAGE_WEIGHT > = DEFAULT_DESCENDANT_SIZE_LIMIT_KVB * WITNESS_SCALE_FACTOR * 1000 ) ;
/** A "reason" why a package was invalid. It may be that one or more of the included
* transactions is invalid or the package itself violates our rules .
@ -47,7 +51,7 @@ class PackageValidationState : public ValidationState<PackageValidationResult> {
/** Context-free package policy checks:
* 1. The number of transactions cannot exceed MAX_PACKAGE_COUNT .
* 2. The total virtual size cannot exceed MAX_PACKAGE_SIZE .
* 2. The total weight cannot exceed MAX_PACKAGE_WEIGHT .
* 3. If any dependencies exist between transactions , parents must appear before children .
* 4. Transactions cannot conflict , i . e . , spend the same inputs .
*/