mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 21:12:48 +01:00
Avoid leaking prioritization information when relaying transactions
This commit is contained in:
parent
e868b22917
commit
669c9433cf
@ -241,15 +241,18 @@ public:
|
|||||||
|
|
||||||
/** \class CompareTxMemPoolEntryByScore
|
/** \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
|
class CompareTxMemPoolEntryByScore
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bool operator()(const CTxMemPoolEntry& a, const CTxMemPoolEntry& b) const
|
bool operator()(const CTxMemPoolEntry& a, const CTxMemPoolEntry& b) const
|
||||||
{
|
{
|
||||||
double f1 = (double)a.GetModifiedFee() * b.GetTxSize();
|
double f1 = (double)a.GetFee() * b.GetTxSize();
|
||||||
double f2 = (double)b.GetModifiedFee() * a.GetTxSize();
|
double f2 = (double)b.GetFee() * a.GetTxSize();
|
||||||
if (f1 == f2) {
|
if (f1 == f2) {
|
||||||
return b.GetTx().GetHash() < a.GetTx().GetHash();
|
return b.GetTx().GetHash() < a.GetTx().GetHash();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user