0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-08 10:31:50 -05:00

[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.
This commit is contained in:
glozow 2024-05-17 11:04:18 +01:00
parent 3abee5eceb
commit d578e2e354

View file

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