Skip to content

Commit a41db2a

Browse files
committed
Merge #299: Make boost::multi_index comparators const
f40c7ff Make boost::multi_index comparators const (Suhas Daftuar)
2 parents 9627f30 + f40c7ff commit a41db2a

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/miner.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ struct modifiedentry_iter {
7373
// except operating on CTxMemPoolModifiedEntry.
7474
// TODO: refactor to avoid duplication of this logic.
7575
struct CompareModifiedEntry {
76-
bool operator()(const CTxMemPoolModifiedEntry &a, const CTxMemPoolModifiedEntry &b)
76+
bool operator()(const CTxMemPoolModifiedEntry &a, const CTxMemPoolModifiedEntry &b) const
7777
{
7878
double f1 = (double)a.nModFeesWithAncestors * b.nSizeWithAncestors;
7979
double f2 = (double)b.nModFeesWithAncestors * a.nSizeWithAncestors;
@@ -88,7 +88,7 @@ struct CompareModifiedEntry {
8888
// This is sufficient to sort an ancestor package in an order that is valid
8989
// to appear in a block.
9090
struct CompareTxIterByAncestorCount {
91-
bool operator()(const CTxMemPool::txiter &a, const CTxMemPool::txiter &b)
91+
bool operator()(const CTxMemPool::txiter &a, const CTxMemPool::txiter &b) const
9292
{
9393
if (a->GetCountWithAncestors() != b->GetCountWithAncestors())
9494
return a->GetCountWithAncestors() < b->GetCountWithAncestors();

src/txmempool.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ struct mempoolentry_txid
231231
class CompareTxMemPoolEntryByDescendantScore
232232
{
233233
public:
234-
bool operator()(const CTxMemPoolEntry& a, const CTxMemPoolEntry& b)
234+
bool operator()(const CTxMemPoolEntry& a, const CTxMemPoolEntry& b) const
235235
{
236236
bool fUseADescendants = UseDescendantScore(a);
237237
bool fUseBDescendants = UseDescendantScore(b);
@@ -253,7 +253,7 @@ class CompareTxMemPoolEntryByDescendantScore
253253
}
254254

255255
// Calculate which score to use for an entry (avoiding division).
256-
bool UseDescendantScore(const CTxMemPoolEntry &a)
256+
bool UseDescendantScore(const CTxMemPoolEntry &a) const
257257
{
258258
double f1 = (double)a.GetModifiedFee() * a.GetSizeWithDescendants();
259259
double f2 = (double)a.GetModFeesWithDescendants() * a.GetTxSize();
@@ -268,7 +268,7 @@ class CompareTxMemPoolEntryByDescendantScore
268268
class CompareTxMemPoolEntryByScore
269269
{
270270
public:
271-
bool operator()(const CTxMemPoolEntry& a, const CTxMemPoolEntry& b)
271+
bool operator()(const CTxMemPoolEntry& a, const CTxMemPoolEntry& b) const
272272
{
273273
double f1 = (double)a.GetModifiedFee() * b.GetTxSize();
274274
double f2 = (double)b.GetModifiedFee() * a.GetTxSize();
@@ -282,7 +282,7 @@ class CompareTxMemPoolEntryByScore
282282
class CompareTxMemPoolEntryByEntryTime
283283
{
284284
public:
285-
bool operator()(const CTxMemPoolEntry& a, const CTxMemPoolEntry& b)
285+
bool operator()(const CTxMemPoolEntry& a, const CTxMemPoolEntry& b) const
286286
{
287287
return a.GetTime() < b.GetTime();
288288
}
@@ -291,7 +291,7 @@ class CompareTxMemPoolEntryByEntryTime
291291
class CompareTxMemPoolEntryByAncestorFee
292292
{
293293
public:
294-
bool operator()(const CTxMemPoolEntry& a, const CTxMemPoolEntry& b)
294+
bool operator()(const CTxMemPoolEntry& a, const CTxMemPoolEntry& b) const
295295
{
296296
double aFees = a.GetModFeesWithAncestors();
297297
double aSize = a.GetSizeWithAncestors();

0 commit comments

Comments
 (0)