aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorglozow <gloriajzhao@gmail.com>2022-02-10 11:22:18 +0000
committerglozow <gloriajzhao@gmail.com>2022-02-14 10:04:51 +0000
commitd35a3cb3968d7584c7d5c42b121a80f34ea656bf (patch)
treed5a7f4c1a87136e0a0c9e3b1c8c2b6ade896b6bb /src
parent5ae187f8761f5f85a1ef41d24f75afb7eecf366f (diff)
downloadbitcoin-d35a3cb3968d7584c7d5c42b121a80f34ea656bf.tar.xz
[doc] clarify inaccurate comment about replacements paying higher feerate
Co-authored-by: Suhas Daftuar <sdaftuar@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/validation.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/validation.cpp b/src/validation.cpp
index 5241b1a2c6..69d37c0323 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -909,12 +909,15 @@ bool MemPoolAccept::ReplacementChecks(Workspace& ws)
TxValidationState& state = ws.m_state;
CFeeRate newFeeRate(ws.m_modified_fees, ws.m_vsize);
- // It's possible that the replacement pays more fees than its direct conflicts but not more
- // than all conflicts (i.e. the direct conflicts have high-fee descendants). However, if the
- // replacement doesn't pay more fees than its direct conflicts, then we can be sure it's not
- // more economically rational to mine. Before we go digging through the mempool for all
- // transactions that would need to be removed (direct conflicts and all descendants), check
- // that the replacement transaction pays more than its direct conflicts.
+ // The replacement transaction must have a higher feerate than its direct conflicts.
+ // - The motivation for this check is to ensure that the replacement transaction is preferable for
+ // block-inclusion, compared to what would be removed from the mempool.
+ // - This logic predates ancestor feerate-based transaction selection, which is why it doesn't
+ // consider feerates of descendants.
+ // - Note: Ancestor feerate-based transaction selection has made this comparison insufficient to
+ // guarantee that this is incentive-compatible for miners, because it is possible for a
+ // descendant transaction of a direct conflict to pay a higher feerate than the transaction that
+ // might replace them, under these rules.
if (const auto err_string{PaysMoreThanConflicts(ws.m_iters_conflicting, newFeeRate, hash)}) {
return state.Invalid(TxValidationResult::TX_MEMPOOL_POLICY, "insufficient fee", *err_string);
}