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