aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSuhas Daftuar <sdaftuar@gmail.com>2018-01-19 10:53:55 -0500
committerSuhas Daftuar <sdaftuar@gmail.com>2018-01-25 18:02:24 -0500
commit669c9433cfbc6bc25243fcdb550009b2d4180cc9 (patch)
tree164c8ab2d48325d96a903877fd6b722e5d2dc1c3 /src
parente868b22917aee4c888f843bd86a2bf8ea29530eb (diff)
downloadbitcoin-669c9433cfbc6bc25243fcdb550009b2d4180cc9.tar.xz
Avoid leaking prioritization information when relaying transactions
Diffstat (limited to 'src')
-rw-r--r--src/txmempool.h9
1 files 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();
}