aboutsummaryrefslogtreecommitdiff
path: root/src/validation.cpp
diff options
context:
space:
mode:
authorglozow <gloriajzhao@gmail.com>2023-10-02 10:04:37 +0100
committerglozow <gloriajzhao@gmail.com>2023-10-02 10:13:38 +0100
commitb4f28cc345ef9c5261c4a8d743654a44784c7802 (patch)
tree381035ad4297d9c2146eb2528f9d8bd4e3e32493 /src/validation.cpp
parentf66af92f1a3e2ebbae8050e57a60e051f9bf5f39 (diff)
downloadbitcoin-b4f28cc345ef9c5261c4a8d743654a44784c7802.tar.xz
[doc] parent pay for child in aggregate CheckFeeRate
Diffstat (limited to 'src/validation.cpp')
-rw-r--r--src/validation.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/validation.cpp b/src/validation.cpp
index 357b4d422d..8166808c27 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -1285,6 +1285,12 @@ PackageMempoolAcceptResult MemPoolAccept::AcceptMultipleTransactions(const std::
// Transactions must meet two minimum feerates: the mempool minimum fee and min relay fee.
// For transactions consisting of exactly one child and its parents, it suffices to use the
// package feerate (total modified fees / total virtual size) to check this requirement.
+ // Note that this is an aggregate feerate; this function has not checked that there are transactions
+ // too low feerate to pay for themselves, or that the child transactions are higher feerate than
+ // their parents. Using aggregate feerate may allow "parents pay for child" behavior and permit
+ // a child that is below mempool minimum feerate. To avoid these behaviors, callers of
+ // AcceptMultipleTransactions need to restrict txns topology (e.g. to ancestor sets) and check
+ // the feerates of individuals and subsets.
const auto m_total_vsize = std::accumulate(workspaces.cbegin(), workspaces.cend(), int64_t{0},
[](int64_t sum, auto& ws) { return sum + ws.m_vsize; });
const auto m_total_modified_fees = std::accumulate(workspaces.cbegin(), workspaces.cend(), CAmount{0},