aboutsummaryrefslogtreecommitdiff
path: root/src/txmempool.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/txmempool.h')
-rw-r--r--src/txmempool.h18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/txmempool.h b/src/txmempool.h
index d6f8e7094b..a1cde6f779 100644
--- a/src/txmempool.h
+++ b/src/txmempool.h
@@ -241,15 +241,18 @@ public:
/** \class CompareTxMemPoolEntryByScore
*
- * Sort by score of entry ((fee+delta)/size) in descending order
+ * Sort by feerate of entry (fee/size) in descending order
+ * This is only used for transaction relay, so we use GetFee()
+ * instead of GetModifiedFee() to avoid leaking prioritization
+ * information via the sort order.
*/
class CompareTxMemPoolEntryByScore
{
public:
bool operator()(const CTxMemPoolEntry& a, const CTxMemPoolEntry& b) const
{
- double f1 = (double)a.GetModifiedFee() * b.GetTxSize();
- double f2 = (double)b.GetModifiedFee() * a.GetTxSize();
+ double f1 = (double)a.GetFee() * b.GetTxSize();
+ double f2 = (double)b.GetFee() * a.GetTxSize();
if (f1 == f2) {
return b.GetTx().GetHash() < a.GetTx().GetHash();
}
@@ -379,8 +382,9 @@ public:
*
* mapTx is a boost::multi_index that sorts the mempool on 4 criteria:
* - transaction hash
- * - feerate [we use max(feerate of tx, feerate of tx with all descendants)]
+ * - descendant feerate [we use max(feerate of tx, feerate of tx with all descendants)]
* - time in mempool
+ * - ancestor feerate [we use min(feerate of tx, feerate of tx with all unconfirmed ancestors)]
*
* Note: the term "descendant" refers to in-mempool transactions that depend on
* this one, while "ancestor" refers to in-mempool transactions that a given
@@ -546,7 +550,7 @@ public:
void _clear(); //lock free
bool CompareDepthAndScore(const uint256& hasha, const uint256& hashb);
void queryHashes(std::vector<uint256>& vtxid);
- bool isSpent(const COutPoint& outpoint);
+ bool isSpent(const COutPoint& outpoint) const;
unsigned int GetTransactionsUpdated() const;
void AddTransactionsUpdated(unsigned int n);
/**
@@ -596,7 +600,7 @@ public:
/** Populate setDescendants with all in-mempool descendants of hash.
* Assumes that setDescendants includes all in-mempool descendants of anything
* already in it. */
- void CalculateDescendants(txiter it, setEntries &setDescendants);
+ void CalculateDescendants(txiter it, setEntries& setDescendants) const;
/** The minimum fee to get into the mempool, which may itself not be enough
* for larger-sized transactions.
@@ -685,7 +689,7 @@ private:
};
/**
- * CCoinsView that brings transactions from a memorypool into view.
+ * CCoinsView that brings transactions from a mempool into view.
* It does not check for spendings by memory pool transactions.
* Instead, it provides access to all Coins which are either unspent in the
* base CCoinsView, or are outputs from any mempool transaction!