Skip to content

Commit bd1f849

Browse files
committed
fixup! Exclude RBF txs from fee estimation
1 parent 20418bd commit bd1f849

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/validation.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -788,15 +788,14 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState& state, const C
788788
size_t nConflictingSize = 0;
789789
uint64_t nConflictingCount = 0;
790790
CTxMemPool::setEntries allConflicting;
791-
bool fReplacementTransaction = false;
792791

793792
// If we don't hold the lock allConflicting might be incomplete; the
794793
// subsequent RemoveStaged() and addUnchecked() calls don't guarantee
795794
// mempool consistency for us.
796795
LOCK(pool.cs);
797-
if (setConflicts.size())
796+
const bool fReplacementTransaction = setConflicts.size();
797+
if (fReplacementTransaction)
798798
{
799-
fReplacementTransaction = true;
800799
CFeeRate newFeeRate(nModifiedFees, nSize);
801800
set<uint256> setConflictsParents;
802801
const int maxDescendantsToVisit = 100;
@@ -956,11 +955,11 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState& state, const C
956955
}
957956
pool.RemoveStaged(allConflicting, false);
958957

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

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

0 commit comments

Comments
 (0)