Skip to content

Commit 669c943

Browse files
committed
Avoid leaking prioritization information when relaying transactions
1 parent e868b22 commit 669c943

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/txmempool.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,15 +241,18 @@ class CompareTxMemPoolEntryByDescendantScore
241241

242242
/** \class CompareTxMemPoolEntryByScore
243243
*
244-
* Sort by score of entry ((fee+delta)/size) in descending order
244+
* Sort by feerate of entry (fee/size) in descending order
245+
* This is only used for transaction relay, so we use GetFee()
246+
* instead of GetModifiedFee() to avoid leaking prioritization
247+
* information via the sort order.
245248
*/
246249
class CompareTxMemPoolEntryByScore
247250
{
248251
public:
249252
bool operator()(const CTxMemPoolEntry& a, const CTxMemPoolEntry& b) const
250253
{
251-
double f1 = (double)a.GetModifiedFee() * b.GetTxSize();
252-
double f2 = (double)b.GetModifiedFee() * a.GetTxSize();
254+
double f1 = (double)a.GetFee() * b.GetTxSize();
255+
double f2 = (double)b.GetFee() * a.GetTxSize();
253256
if (f1 == f2) {
254257
return b.GetTx().GetHash() < a.GetTx().GetHash();
255258
}

0 commit comments

Comments
 (0)