Skip to content

Commit

Permalink
Merge #9519: Exclude RBF replacement txs from fee estimation
Browse files Browse the repository at this point in the history
de1ae32 Exclude RBF txs from fee estimation (Alex Morcos)
  • Loading branch information
laanwj committed Jan 26, 2017
2 parents fd70211 + de1ae32 commit 9b4d267
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,8 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState& state, const C
// subsequent RemoveStaged() and addUnchecked() calls don't guarantee
// mempool consistency for us.
LOCK(pool.cs);
if (setConflicts.size())
const bool fReplacementTransaction = setConflicts.size();
if (fReplacementTransaction)
{
CFeeRate newFeeRate(nModifiedFees, nSize);
set<uint256> setConflictsParents;
Expand Down Expand Up @@ -991,10 +992,11 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState& state, const C
}
pool.RemoveStaged(allConflicting, false, MemPoolRemovalReason::REPLACED);

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

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

0 comments on commit 9b4d267

Please sign in to comment.