From d84837a83869e7f435c2968adf055f517dc27d9a Mon Sep 17 00:00:00 2001 From: Michi Lumin Date: Mon, 21 May 2018 17:09:45 -0600 Subject: [PATCH] Cherry-pick from Bitcoin repo, 1ec0c0a: small changes for OSX build Cherry-pick from Bitcoin repo, 1ec0c0a: adds "const" suffix to several lines in txmempool.h and miner.h to make this build succeed under OSX w. clang++ and Boost lib 1.66+ --- src/miner.h | 5 +++-- src/txmempool.h | 16 +++++++++------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/miner.h b/src/miner.h index b3be7e52e..2bc98fd38 100644 --- a/src/miner.h +++ b/src/miner.h @@ -73,7 +73,7 @@ struct modifiedentry_iter { // except operating on CTxMemPoolModifiedEntry. // TODO: refactor to avoid duplication of this logic. struct CompareModifiedEntry { - bool operator()(const CTxMemPoolModifiedEntry &a, const CTxMemPoolModifiedEntry &b) + bool operator()(const CTxMemPoolModifiedEntry &a, const CTxMemPoolModifiedEntry &b) const { double f1 = (double)a.nModFeesWithAncestors * b.nSizeWithAncestors; double f2 = (double)b.nModFeesWithAncestors * a.nSizeWithAncestors; @@ -88,7 +88,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(); @@ -214,3 +214,4 @@ void IncrementExtraNonce(CBlock* pblock, const CBlockIndex* pindexPrev, unsigned int64_t UpdateTime(CBlockHeader* pblock, const Consensus::Params& consensusParams, const CBlockIndex* pindexPrev); #endif // BITCOIN_MINER_H + diff --git a/src/txmempool.h b/src/txmempool.h index 12c9e59f5..79209759f 100644 --- a/src/txmempool.h +++ b/src/txmempool.h @@ -229,7 +229,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); @@ -251,7 +251,7 @@ public: } // 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.GetModifiedFee() * a.GetSizeWithDescendants(); double f2 = (double)a.GetModFeesWithDescendants() * a.GetTxSize(); @@ -266,7 +266,7 @@ public: class CompareTxMemPoolEntryByScore { public: - bool operator()(const CTxMemPoolEntry& a, const CTxMemPoolEntry& b) + bool operator()(const CTxMemPoolEntry& a, const CTxMemPoolEntry& b) const { double f1 = (double)a.GetModifiedFee() * b.GetTxSize(); double f2 = (double)b.GetModifiedFee() * a.GetTxSize(); @@ -280,7 +280,7 @@ public: 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(); } @@ -289,7 +289,7 @@ public: class CompareTxMemPoolEntryByAncestorFee { public: - bool operator()(const CTxMemPoolEntry& a, const CTxMemPoolEntry& b) + bool operator()(const CTxMemPoolEntry& a, const CTxMemPoolEntry& b) const { double aFees = a.GetModFeesWithAncestors(); double aSize = a.GetSizeWithAncestors(); @@ -656,7 +656,7 @@ public: /** Estimate priority needed to get into the next nBlocks */ double estimatePriority(int nBlocks) const; - + /** Write/Read estimates to disk */ bool WriteFeeEstimates(CAutoFile& fileout) const; bool ReadFeeEstimates(CAutoFile& filein); @@ -705,7 +705,7 @@ private: void removeUnchecked(txiter entry, MemPoolRemovalReason reason = MemPoolRemovalReason::UNKNOWN); }; -/** +/** * CCoinsView that brings transactions from a memorypool into view. * It does not check for spendings by memory pool transactions. */ @@ -734,3 +734,5 @@ struct TxCoinAgePriorityCompare }; #endif // BITCOIN_TXMEMPOOL_H + +