From 669c9433cfbc6bc25243fcdb550009b2d4180cc9 Mon Sep 17 00:00:00 2001 From: Suhas Daftuar Date: Fri, 19 Jan 2018 10:53:55 -0500 Subject: Avoid leaking prioritization information when relaying transactions --- src/txmempool.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/txmempool.h b/src/txmempool.h index d25d9c50bb..c6a1bf08ce 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(); } -- cgit v1.2.3