Changeset View
Changeset View
Standalone View
Standalone View
src/txmempool.h
Show First 20 Lines • Show All 246 Lines • ▼ Show 20 Lines | bool operator()(const CTxMemPoolEntry &a, const CTxMemPoolEntry &b) const { | ||||
return f1 < f2; | return f1 < f2; | ||||
} | } | ||||
// Return the fee/size we're using for sorting this entry. | // Return the fee/size we're using for sorting this entry. | ||||
void GetModFeeAndSize(const CTxMemPoolEntry &a, double &mod_fee, | void GetModFeeAndSize(const CTxMemPoolEntry &a, double &mod_fee, | ||||
double &size) const { | double &size) const { | ||||
// Compare feerate with descendants to feerate of the transaction, and | // Compare feerate with descendants to feerate of the transaction, and | ||||
// return the fee/size for the max. | // return the fee/size for the max. | ||||
double f1 = a.GetSizeWithDescendants() * (a.GetModifiedFee() / SATOSHI); | double f1 = | ||||
double f2 = a.GetTxSize() * (a.GetModFeesWithDescendants() / SATOSHI); | a.GetVirtualSizeWithDescendants() * (a.GetModifiedFee() / SATOSHI); | ||||
double f2 = | |||||
a.GetTxVirtualSize() * (a.GetModFeesWithDescendants() / SATOSHI); | |||||
if (f2 > f1) { | if (f2 > f1) { | ||||
mod_fee = a.GetModFeesWithDescendants() / SATOSHI; | mod_fee = a.GetModFeesWithDescendants() / SATOSHI; | ||||
size = a.GetSizeWithDescendants(); | size = a.GetVirtualSizeWithDescendants(); | ||||
} else { | } else { | ||||
mod_fee = a.GetModifiedFee() / SATOSHI; | mod_fee = a.GetModifiedFee() / SATOSHI; | ||||
size = a.GetTxSize(); | size = a.GetTxVirtualSize(); | ||||
} | } | ||||
} | } | ||||
}; | }; | ||||
/** \class CompareTxMemPoolEntryByScore | /** \class CompareTxMemPoolEntryByScore | ||||
* | * | ||||
* Sort by feerate of entry (fee/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() | * This is only used for transaction relay, so we use GetFee() | ||||
▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | template <typename T> bool operator()(const T &a, const T &b) const { | ||||
return f1 > f2; | return f1 > f2; | ||||
} | } | ||||
// Return the fee/size we're using for sorting this entry. | // Return the fee/size we're using for sorting this entry. | ||||
template <typename T> | template <typename T> | ||||
void GetModFeeAndSize(const T &a, double &mod_fee, double &size) const { | void GetModFeeAndSize(const T &a, double &mod_fee, double &size) const { | ||||
// Compare feerate with ancestors to feerate of the transaction, and | // Compare feerate with ancestors to feerate of the transaction, and | ||||
// return the fee/size for the min. | // return the fee/size for the min. | ||||
double f1 = a.GetSizeWithAncestors() * (a.GetModifiedFee() / SATOSHI); | double f1 = | ||||
double f2 = a.GetTxSize() * (a.GetModFeesWithAncestors() / SATOSHI); | a.GetVirtualSizeWithAncestors() * (a.GetModifiedFee() / SATOSHI); | ||||
double f2 = | |||||
a.GetTxVirtualSize() * (a.GetModFeesWithAncestors() / SATOSHI); | |||||
if (f1 > f2) { | if (f1 > f2) { | ||||
mod_fee = a.GetModFeesWithAncestors() / SATOSHI; | mod_fee = a.GetModFeesWithAncestors() / SATOSHI; | ||||
size = a.GetSizeWithAncestors(); | size = a.GetVirtualSizeWithAncestors(); | ||||
} else { | } else { | ||||
mod_fee = a.GetModifiedFee() / SATOSHI; | mod_fee = a.GetModifiedFee() / SATOSHI; | ||||
size = a.GetTxSize(); | size = a.GetTxVirtualSize(); | ||||
} | } | ||||
} | } | ||||
}; | }; | ||||
// Multi_index tag names | // Multi_index tag names | ||||
struct descendant_score {}; | struct descendant_score {}; | ||||
struct entry_time {}; | struct entry_time {}; | ||||
struct ancestor_score {}; | struct ancestor_score {}; | ||||
▲ Show 20 Lines • Show All 641 Lines • Show Last 20 Lines |