aboutsummaryrefslogtreecommitdiff
path: root/src/validation.h
diff options
context:
space:
mode:
authorglozow <gloriajzhao@gmail.com>2021-09-07 14:08:32 +0100
committerglozow <gloriajzhao@gmail.com>2021-11-29 15:46:48 +0000
commit8310d942e046c5a9b6bd90afdcd3af68dd91e081 (patch)
tree71d05f6e3d9d314f37d02908216b12b1588e1c1a /src/validation.h
parentbe3ff151a1f9665720cdf70d072b098a2f9726a9 (diff)
downloadbitcoin-8310d942e046c5a9b6bd90afdcd3af68dd91e081.tar.xz
[packages] add sanity checks for package vs mempool limits
Diffstat (limited to 'src/validation.h')
-rw-r--r--src/validation.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/validation.h b/src/validation.h
index 4578a5e02e..e3ad5f2e9f 100644
--- a/src/validation.h
+++ b/src/validation.h
@@ -60,6 +60,16 @@ static const unsigned int DEFAULT_ANCESTOR_SIZE_LIMIT = 101;
static const unsigned int DEFAULT_DESCENDANT_LIMIT = 25;
/** Default for -limitdescendantsize, maximum kilobytes of in-mempool descendants */
static const unsigned int DEFAULT_DESCENDANT_SIZE_LIMIT = 101;
+
+// 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
+// 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 >= MAX_PACKAGE_SIZE);
+static_assert(DEFAULT_DESCENDANT_SIZE_LIMIT >= MAX_PACKAGE_SIZE);
+
/** Default for -mempoolexpiry, expiration time for mempool transactions in hours */
static const unsigned int DEFAULT_MEMPOOL_EXPIRY = 336;
/** Maximum number of dedicated script-checking threads allowed */