Skip to content

Commit de1ae32

Browse files
committed
Exclude RBF txs from fee estimation
1 parent e2e624d commit de1ae32

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/validation.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,8 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState& state, const C
793793
// subsequent RemoveStaged() and addUnchecked() calls don't guarantee
794794
// mempool consistency for us.
795795
LOCK(pool.cs);
796-
if (setConflicts.size())
796+
const bool fReplacementTransaction = setConflicts.size();
797+
if (fReplacementTransaction)
797798
{
798799
CFeeRate newFeeRate(nModifiedFees, nSize);
799800
set<uint256> setConflictsParents;
@@ -954,10 +955,11 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState& state, const C
954955
}
955956
pool.RemoveStaged(allConflicting, false);
956957

957-
// This transaction should only count for fee estimation if
958-
// the node is not behind and it is not dependent on any other
959-
// transactions in the mempool
960-
bool validForFeeEstimation = IsCurrentForFeeEstimation() && pool.HasNoInputsOf(tx);
958+
// This transaction should only count for fee estimation if it isn't a
959+
// BIP 125 replacement transaction (may not be widely supported), the
960+
// node is not behind, and the transaction is not dependent on any other
961+
// transactions in the mempool.
962+
bool validForFeeEstimation = !fReplacementTransaction && IsCurrentForFeeEstimation() && pool.HasNoInputsOf(tx);
961963

962964
// Store transaction in memory
963965
pool.addUnchecked(hash, entry, setAncestors, validForFeeEstimation);

0 commit comments

Comments
 (0)