Skip to content

Commit 82858ba

Browse files
committed
[doc] CPFP carve out and single-conflict RBF exemption
1 parent 1fd49eb commit 82858ba

File tree

2 files changed

+66
-1
lines changed

2 files changed

+66
-1
lines changed

doc/policy/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ contents. Policy is *not* applied to transactions in blocks.
99

1010
This documentation is not an exhaustive list of all policy rules.
1111

12+
- [Mempool Limits](mempool-limits.md)
1213
- [Mempool Replacements](mempool-replacements.md)
1314
- [Packages](packages.md)
1415

15-

doc/policy/mempool-limits.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Mempool Limits
2+
3+
## Definitions
4+
5+
Given any two transactions Tx0 and Tx1 where Tx1 spends an output of Tx0,
6+
Tx0 is a *parent* of Tx1 and Tx1 is a *child* of Tx0.
7+
8+
A transaction's *ancestors* include, recursively, its parents, the parents of its parents, etc.
9+
A transaction's *descendants* include, recursively, its children, the children of its children, etc.
10+
11+
A mempool entry's *ancestor count* is the total number of in-mempool (unconfirmed) transactions in
12+
its ancestor set, including itself.
13+
A mempool entry's *descendant count* is the total number of in-mempool (unconfirmed) transactions in
14+
its descendant set, including itself.
15+
16+
A mempool entry's *ancestor size* is the aggregated virtual size of in-mempool (unconfirmed)
17+
transactions in its ancestor set, including itself.
18+
A mempool entry's *descendant size* is the aggregated virtual size of in-mempool (unconfirmed)
19+
transactions in its descendant set, including itself.
20+
21+
Transactions submitted to the mempool must not exceed the ancestor and descendant limits (aka
22+
mempool *package limits*) set by the node (see `-limitancestorcount`, `-limitancestorsize`,
23+
`-limitdescendantcount`, `-limitdescendantsize`).
24+
25+
## Exemptions
26+
27+
### CPFP Carve Out
28+
29+
**CPFP Carve Out** if a transaction candidate for submission to the
30+
mempool would cause some mempool entry to exceed its descendant limits, an exemption is made if all
31+
of the following conditions are met:
32+
33+
1. The candidate transaction is no more than 10,000 virtual bytes.
34+
35+
2. The candidate transaction has an ancestor count of 2 (itself and exactly 1 ancestor).
36+
37+
3. The in-mempool transaction's descendant count, including the candidate transaction, would only
38+
exceed the limit by 1.
39+
40+
*Rationale*: this rule was introduced to prevent pinning by domination of a transaction's descendant
41+
limits in two-party contract protocols such as LN. Also see the [mailing list
42+
post](https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2018-November/016518.html).
43+
44+
This rule was introduced in [PR #15681](https://github.com/bitcoin/bitcoin/pull/15681).
45+
46+
### Single-Conflict RBF Carve Out
47+
48+
When a candidate transaction for submission to the mempool would replace mempool entries, it may
49+
also decrease the descendant count of other mempool entries. Since ancestor/descendant limits are
50+
calculated prior to removing the would-be-replaced transactions, they may be overestimated.
51+
52+
An exemption is given for a candidate transaction that would replace mempool transactions and meets
53+
all of the following conditions:
54+
55+
1. The candidate transaction has exactly 1 directly conflicting transaction.
56+
57+
2. The candidate transaction does not spend any unconfirmed inputs that are not also spent by the
58+
directly conflicting transaction.
59+
60+
The following discounts are given to account for the would-be-replaced transaction(s):
61+
62+
1. The descendant count limit is temporarily increased by 1.
63+
64+
2. The descendant size limit temporarily is increased by the virtual size of the to-be-replaced
65+
directly conflicting transaction.

0 commit comments

Comments
 (0)