Skip to content

Commit 0d8e68d

Browse files
committed
refactor: move DEFAULT_*_LIMIT assertions from validation to policy
1 parent 9c94f3b commit 0d8e68d

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/policy/packages.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@ static constexpr uint32_t MAX_PACKAGE_COUNT{25};
1919
static constexpr uint32_t MAX_PACKAGE_SIZE{101};
2020
static_assert(MAX_PACKAGE_SIZE * WITNESS_SCALE_FACTOR * 1000 >= MAX_STANDARD_TX_WEIGHT);
2121

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
24+
// of the child), package limits are ultimately bounded by mempool package limits. Ensure that the
25+
// defaults reflect this constraint.
26+
static_assert(DEFAULT_DESCENDANT_LIMIT >= MAX_PACKAGE_COUNT);
27+
static_assert(DEFAULT_ANCESTOR_LIMIT >= MAX_PACKAGE_COUNT);
28+
static_assert(DEFAULT_ANCESTOR_SIZE_LIMIT >= MAX_PACKAGE_SIZE);
29+
static_assert(DEFAULT_DESCENDANT_SIZE_LIMIT >= MAX_PACKAGE_SIZE);
30+
2231
/** A "reason" why a package was invalid. It may be that one or more of the included
2332
* transactions is invalid or the package itself violates our rules.
2433
* We don't distinguish between consensus and policy violations right now.

src/validation.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,6 @@ namespace Consensus {
5959
struct Params;
6060
} // namespace Consensus
6161

62-
// If a package is submitted, it must be within the mempool's ancestor/descendant limits. Since a
63-
// submitted package must be child-with-unconfirmed-parents (all of the transactions are an ancestor
64-
// of the child), package limits are ultimately bounded by mempool package limits. Ensure that the
65-
// defaults reflect this constraint.
66-
static_assert(DEFAULT_DESCENDANT_LIMIT >= MAX_PACKAGE_COUNT);
67-
static_assert(DEFAULT_ANCESTOR_LIMIT >= MAX_PACKAGE_COUNT);
68-
static_assert(DEFAULT_ANCESTOR_SIZE_LIMIT >= MAX_PACKAGE_SIZE);
69-
static_assert(DEFAULT_DESCENDANT_SIZE_LIMIT >= MAX_PACKAGE_SIZE);
70-
7162
/** Default for -mempoolexpiry, expiration time for mempool transactions in hours */
7263
static const unsigned int DEFAULT_MEMPOOL_EXPIRY = 336;
7364
/** Maximum number of dedicated script-checking threads allowed */

0 commit comments

Comments
 (0)