Skip to content

Commit 1c65c07

Browse files
Don't declare de facto const member functions as non-const
1 parent 64156ad commit 1c65c07

File tree

13 files changed

+20
-20
lines changed

13 files changed

+20
-20
lines changed

src/logging.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ bool GetLogCategory(BCLog::LogFlags& flag, const std::string& str)
174174
return false;
175175
}
176176

177-
std::vector<LogCategory> BCLog::Logger::LogCategoriesList()
177+
std::vector<LogCategory> BCLog::Logger::LogCategoriesList() const
178178
{
179179
std::vector<LogCategory> ret;
180180
for (const CLogCategoryDesc& category_desc : LogCategories) {

src/logging.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,9 @@ namespace BCLog {
135135

136136
bool WillLogCategory(LogFlags category) const;
137137
/** Returns a vector of the log categories */
138-
std::vector<LogCategory> LogCategoriesList();
138+
std::vector<LogCategory> LogCategoriesList() const;
139139
/** Returns a string with the log categories */
140-
std::string LogCategoriesString()
140+
std::string LogCategoriesString() const
141141
{
142142
return Join(LogCategoriesList(), ", ", [&](const LogCategory& i) { return i.category; });
143143
};

src/miner.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ bool BlockAssembler::TestPackage(uint64_t packageSize, int64_t packageSigOpsCost
213213
// - transaction finality (locktime)
214214
// - premature witness (in case segwit transactions are added to mempool before
215215
// segwit activation)
216-
bool BlockAssembler::TestPackageTransactions(const CTxMemPool::setEntries& package)
216+
bool BlockAssembler::TestPackageTransactions(const CTxMemPool::setEntries& package) const
217217
{
218218
for (CTxMemPool::txiter it : package) {
219219
if (!IsFinalTx(it->GetTx(), nHeight, nLockTimeCutoff))

src/miner.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ class BlockAssembler
185185
* locktime, premature-witness, serialized size (if necessary)
186186
* These checks should always succeed, and they're here
187187
* only as an extra check in case of suboptimal node configuration */
188-
bool TestPackageTransactions(const CTxMemPool::setEntries& package);
188+
bool TestPackageTransactions(const CTxMemPool::setEntries& package) const;
189189
/** Return true if given transaction from mapTx has already been evaluated,
190190
* or if the transaction's cached data in mapTx is incorrect. */
191191
bool SkipMapTxEntry(CTxMemPool::txiter it, indexed_modified_transaction_set& mapModifiedTx, CTxMemPool::setEntries& failedTx) EXCLUSIVE_LOCKS_REQUIRED(m_mempool.cs);

src/net.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1216,7 +1216,7 @@ void CConnman::NotifyNumConnectionsChanged()
12161216
}
12171217
}
12181218

1219-
void CConnman::InactivityCheck(CNode *pnode)
1219+
void CConnman::InactivityCheck(CNode *pnode) const
12201220
{
12211221
int64_t nTime = GetSystemTimeInSeconds();
12221222
if (nTime - pnode->nTimeConnected > m_peer_connect_timeout)

src/net.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ class CConnman
423423
void AcceptConnection(const ListenSocket& hListenSocket);
424424
void DisconnectNodes();
425425
void NotifyNumConnectionsChanged();
426-
void InactivityCheck(CNode *pnode);
426+
void InactivityCheck(CNode *pnode) const;
427427
bool GenerateSelectSet(std::set<SOCKET> &recv_set, std::set<SOCKET> &send_set, std::set<SOCKET> &error_set);
428428
void SocketEvents(std::set<SOCKET> &recv_set, std::set<SOCKET> &send_set, std::set<SOCKET> &error_set);
429429
void SocketHandler();

src/script/interpreter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,8 +305,8 @@ class ConditionStack {
305305
uint32_t m_first_false_pos = NO_FALSE;
306306

307307
public:
308-
bool empty() { return m_stack_size == 0; }
309-
bool all_true() { return m_first_false_pos == NO_FALSE; }
308+
bool empty() const { return m_stack_size == 0; }
309+
bool all_true() const { return m_first_false_pos == NO_FALSE; }
310310
void push_back(bool f)
311311
{
312312
if (m_first_false_pos == NO_FALSE && !f) {

src/test/checkqueue_tests.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ static const unsigned int QUEUE_BATCH_SIZE = 128;
2626
static const int SCRIPT_CHECK_THREADS = 3;
2727

2828
struct FakeCheck {
29-
bool operator()()
29+
bool operator()() const
3030
{
3131
return true;
3232
}
@@ -47,7 +47,7 @@ struct FailingCheck {
4747
bool fails;
4848
FailingCheck(bool _fails) : fails(_fails){};
4949
FailingCheck() : fails(true){};
50-
bool operator()()
50+
bool operator()() const
5151
{
5252
return !fails;
5353
}
@@ -76,7 +76,7 @@ struct UniqueCheck {
7676
struct MemoryCheck {
7777
static std::atomic<size_t> fake_allocated_memory;
7878
bool b {false};
79-
bool operator()()
79+
bool operator()() const
8080
{
8181
return true;
8282
}
@@ -107,7 +107,7 @@ struct FrozenCleanupCheck {
107107
// Freezing can't be the default initialized behavior given how the queue
108108
// swaps in default initialized Checks.
109109
bool should_freeze {false};
110-
bool operator()()
110+
bool operator()() const
111111
{
112112
return true;
113113
}

src/test/util/setup_common.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,12 +231,12 @@ TestChain100Setup::~TestChain100Setup()
231231
gArgs.ForceSetArg("-segwitheight", "0");
232232
}
233233

234-
CTxMemPoolEntry TestMemPoolEntryHelper::FromTx(const CMutableTransaction& tx)
234+
CTxMemPoolEntry TestMemPoolEntryHelper::FromTx(const CMutableTransaction& tx) const
235235
{
236236
return FromTx(MakeTransactionRef(tx));
237237
}
238238

239-
CTxMemPoolEntry TestMemPoolEntryHelper::FromTx(const CTransactionRef& tx)
239+
CTxMemPoolEntry TestMemPoolEntryHelper::FromTx(const CTransactionRef& tx) const
240240
{
241241
return CTxMemPoolEntry(tx, nFee, nTime, nHeight,
242242
spendsCoinbase, sigOpCost, lp);

src/test/util/setup_common.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ struct TestMemPoolEntryHelper
138138
nFee(0), nTime(0), nHeight(1),
139139
spendsCoinbase(false), sigOpCost(4) { }
140140

141-
CTxMemPoolEntry FromTx(const CMutableTransaction& tx);
142-
CTxMemPoolEntry FromTx(const CTransactionRef& tx);
141+
CTxMemPoolEntry FromTx(const CMutableTransaction& tx) const;
142+
CTxMemPoolEntry FromTx(const CTransactionRef& tx) const;
143143

144144
// Change the default value
145145
TestMemPoolEntryHelper &Fee(CAmount _fee) { nFee = _fee; return *this; }

0 commit comments

Comments
 (0)