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