Skip to content

Commit 9b4d267

Browse files
committed
Merge #9519: Exclude RBF replacement txs from fee estimation
de1ae32 Exclude RBF txs from fee estimation (Alex Morcos)
2 parents fd70211 + de1ae32 commit 9b4d267

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
@@ -827,7 +827,8 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState& state, const C
827827
// subsequent RemoveStaged() and addUnchecked() calls don't guarantee
828828
// mempool consistency for us.
829829
LOCK(pool.cs);
830-
if (setConflicts.size())
830+
const bool fReplacementTransaction = setConflicts.size();
831+
if (fReplacementTransaction)
831832
{
832833
CFeeRate newFeeRate(nModifiedFees, nSize);
833834
set<uint256> setConflictsParents;
@@ -991,10 +992,11 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState& state, const C
991992
}
992993
pool.RemoveStaged(allConflicting, false, MemPoolRemovalReason::REPLACED);
993994

994-
// This transaction should only count for fee estimation if
995-
// the node is not behind and it is not dependent on any other
996-
// transactions in the mempool
997-
bool validForFeeEstimation = IsCurrentForFeeEstimation() && pool.HasNoInputsOf(tx);
995+
// This transaction should only count for fee estimation if it isn't a
996+
// BIP 125 replacement transaction (may not be widely supported), the
997+
// node is not behind, and the transaction is not dependent on any other
998+
// transactions in the mempool.
999+
bool validForFeeEstimation = !fReplacementTransaction && IsCurrentForFeeEstimation() && pool.HasNoInputsOf(tx);
9981000

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

0 commit comments

Comments
 (0)