diff --git a/src/miner.h b/src/miner.h index bf79bdfd6..cc9c62c1f 100644 --- a/src/miner.h +++ b/src/miner.h @@ -71,7 +71,7 @@ struct modifiedentry_iter { // TODO: refactor to avoid duplication of this logic. struct CompareModifiedEntry { bool operator()(const CTxMemPoolModifiedEntry &a, - const CTxMemPoolModifiedEntry &b) { + const CTxMemPoolModifiedEntry &b) const { double f1 = double(b.nSizeWithAncestors * a.nModFeesWithAncestors.GetSatoshis()); double f2 = double(a.nSizeWithAncestors * @@ -87,7 +87,7 @@ struct CompareModifiedEntry { // This is sufficient to sort an ancestor package in an order that is valid // to appear in a block. struct CompareTxIterByAncestorCount { - bool operator()(const CTxMemPool::txiter &a, const CTxMemPool::txiter &b) { + bool operator()(const CTxMemPool::txiter &a, const CTxMemPool::txiter &b) const { if (a->GetCountWithAncestors() != b->GetCountWithAncestors()) return a->GetCountWithAncestors() < b->GetCountWithAncestors(); return CTxMemPool::CompareIteratorByHash()(a, b); diff --git a/src/txmempool.h b/src/txmempool.h index c51ca831b..72c066335 100644 --- a/src/txmempool.h +++ b/src/txmempool.h @@ -245,7 +245,7 @@ struct mempoolentry_txid { */ class CompareTxMemPoolEntryByDescendantScore { public: - bool operator()(const CTxMemPoolEntry &a, const CTxMemPoolEntry &b) { + bool operator()(const CTxMemPoolEntry &a, const CTxMemPoolEntry &b) const { bool fUseADescendants = UseDescendantScore(a); bool fUseBDescendants = UseDescendantScore(b); @@ -272,7 +272,7 @@ class CompareTxMemPoolEntryByDescendantScore { } // Calculate which score to use for an entry (avoiding division). - bool UseDescendantScore(const CTxMemPoolEntry &a) { + bool UseDescendantScore(const CTxMemPoolEntry &a) const { double f1 = double(a.GetSizeWithDescendants() * a.GetModifiedFee().GetSatoshis()); double f2 = @@ -287,7 +287,7 @@ class CompareTxMemPoolEntryByDescendantScore { */ class CompareTxMemPoolEntryByScore { public: - bool operator()(const CTxMemPoolEntry &a, const CTxMemPoolEntry &b) { + bool operator()(const CTxMemPoolEntry &a, const CTxMemPoolEntry &b) const { double f1 = double(b.GetTxSize() * a.GetModifiedFee().GetSatoshis()); double f2 = double(a.GetTxSize() * b.GetModifiedFee().GetSatoshis()); if (f1 == f2) { @@ -299,14 +299,14 @@ class CompareTxMemPoolEntryByScore { class CompareTxMemPoolEntryByEntryTime { public: - bool operator()(const CTxMemPoolEntry &a, const CTxMemPoolEntry &b) { + bool operator()(const CTxMemPoolEntry &a, const CTxMemPoolEntry &b) const { return a.GetTime() < b.GetTime(); } }; class CompareTxMemPoolEntryByAncestorFee { public: - bool operator()(const CTxMemPoolEntry &a, const CTxMemPoolEntry &b) { + bool operator()(const CTxMemPoolEntry &a, const CTxMemPoolEntry &b) const { double aFees = double(a.GetModFeesWithAncestors().GetSatoshis()); double aSize = a.GetSizeWithAncestors();