Skip to content

Commit d578e2e

Browse files
committed
[policy] explicitly require non-v3 for CPFP carve out
This carve out is intended to allow a second child under restricted circumstances, but this topology is not allowed for v3 transactions. As CPFP carve out does not explicitly require a second child to actually exist, it has the effect of granting a free +10KvB descendant size limit when a single child is enough to bust the descendant limit.
1 parent 3abee5e commit d578e2e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/validation.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -953,7 +953,8 @@ bool MemPoolAccept::PreChecks(ATMPArgs& args, Workspace& ws)
953953
// If the new transaction is relatively small (up to 40k weight)
954954
// and has at most one ancestor (ie ancestor limit of 2, including
955955
// the new transaction), allow it if its parent has exactly the
956-
// descendant limit descendants.
956+
// descendant limit descendants. The transaction also cannot be v3,
957+
// as its topology restrictions do not allow a second child.
957958
//
958959
// This allows protocols which rely on distrusting counterparties
959960
// being able to broadcast descendants of an unconfirmed transaction
@@ -967,7 +968,7 @@ bool MemPoolAccept::PreChecks(ATMPArgs& args, Workspace& ws)
967968
.descendant_size_vbytes = maybe_rbf_limits.descendant_size_vbytes + EXTRA_DESCENDANT_TX_SIZE_LIMIT,
968969
};
969970
const auto error_message{util::ErrorString(ancestors).original};
970-
if (ws.m_vsize > EXTRA_DESCENDANT_TX_SIZE_LIMIT) {
971+
if (ws.m_vsize > EXTRA_DESCENDANT_TX_SIZE_LIMIT || ws.m_ptx->nVersion == 3) {
971972
return state.Invalid(TxValidationResult::TX_MEMPOOL_POLICY, "too-long-mempool-chain", error_message);
972973
}
973974
ancestors = m_pool.CalculateMemPoolAncestors(*entry, cpfp_carve_out_limits);

0 commit comments

Comments
 (0)