Skip to content

Commit d35a3cb

Browse files
glozowsdaftuar
andcommitted
[doc] clarify inaccurate comment about replacements paying higher feerate
Co-authored-by: Suhas Daftuar <[email protected]>
1 parent 5ae187f commit d35a3cb

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/validation.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -909,12 +909,15 @@ bool MemPoolAccept::ReplacementChecks(Workspace& ws)
909909
TxValidationState& state = ws.m_state;
910910

911911
CFeeRate newFeeRate(ws.m_modified_fees, ws.m_vsize);
912-
// It's possible that the replacement pays more fees than its direct conflicts but not more
913-
// than all conflicts (i.e. the direct conflicts have high-fee descendants). However, if the
914-
// replacement doesn't pay more fees than its direct conflicts, then we can be sure it's not
915-
// more economically rational to mine. Before we go digging through the mempool for all
916-
// transactions that would need to be removed (direct conflicts and all descendants), check
917-
// that the replacement transaction pays more than its direct conflicts.
912+
// The replacement transaction must have a higher feerate than its direct conflicts.
913+
// - The motivation for this check is to ensure that the replacement transaction is preferable for
914+
// block-inclusion, compared to what would be removed from the mempool.
915+
// - This logic predates ancestor feerate-based transaction selection, which is why it doesn't
916+
// consider feerates of descendants.
917+
// - Note: Ancestor feerate-based transaction selection has made this comparison insufficient to
918+
// guarantee that this is incentive-compatible for miners, because it is possible for a
919+
// descendant transaction of a direct conflict to pay a higher feerate than the transaction that
920+
// might replace them, under these rules.
918921
if (const auto err_string{PaysMoreThanConflicts(ws.m_iters_conflicting, newFeeRate, hash)}) {
919922
return state.Invalid(TxValidationResult::TX_MEMPOOL_POLICY, "insufficient fee", *err_string);
920923
}

0 commit comments

Comments
 (0)