1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
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();
|