Skip to content

Commit 154b2b2

Browse files
committed
[fuzz] V3_MAX_VSIZE and effective ancestor/descendant size limits
1 parent a29f1df commit 154b2b2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/test/util/txmempool.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,15 @@ void CheckMempoolV3Invariants(const CTxMemPool& tx_pool)
125125
for (const auto& tx_info : tx_pool.infoAll()) {
126126
const auto& entry = *Assert(tx_pool.GetEntry(tx_info.tx->GetHash()));
127127
if (tx_info.tx->nVersion == 3) {
128+
// Check that special maximum virtual size is respected
129+
Assert(entry.GetTxSize() <= V3_MAX_VSIZE);
130+
128131
// Check that special v3 ancestor/descendant limits and rules are always respected
129132
Assert(entry.GetCountWithDescendants() <= V3_DESCENDANT_LIMIT);
130133
Assert(entry.GetCountWithAncestors() <= V3_ANCESTOR_LIMIT);
134+
Assert(entry.GetSizeWithDescendants() <= V3_MAX_VSIZE + V3_CHILD_MAX_VSIZE);
135+
Assert(entry.GetSizeWithAncestors() <= V3_MAX_VSIZE + V3_CHILD_MAX_VSIZE);
136+
131137
// If this transaction has at least 1 ancestor, it's a "child" and has restricted weight.
132138
if (entry.GetCountWithAncestors() > 1) {
133139
Assert(entry.GetTxSize() <= V3_CHILD_MAX_VSIZE);

0 commit comments

Comments
 (0)