diff --git a/src/txmempool.h b/src/txmempool.h --- a/src/txmempool.h +++ b/src/txmempool.h @@ -278,13 +278,16 @@ /** \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 = b.GetTxSize() * (a.GetModifiedFee() / SATOSHI); - double f2 = a.GetTxSize() * (b.GetModifiedFee() / SATOSHI); + double f1 = b.GetTxSize() * (a.GetFee() / SATOSHI); + double f2 = a.GetTxSize() * (b.GetFee() / SATOSHI); if (f1 == f2) { return b.GetTx().GetId() < a.GetTx().GetId(); } @@ -415,8 +418,11 @@ * * 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