aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpracticalswift <practicalswift@users.noreply.github.com>2020-12-06 15:51:22 +0000
committerpracticalswift <practicalswift@users.noreply.github.com>2020-12-06 18:44:25 +0000
commit1c65c075ee4c7f98d9c1fac5ed7576b96374d4e9 (patch)
tree6bbc3ecd15d74450843b7049414b0c1950182c4b /src
parent64156ad4d1f50daf35250dc3b329a8a595594d87 (diff)
downloadbitcoin-1c65c075ee4c7f98d9c1fac5ed7576b96374d4e9.tar.xz
Don't declare de facto const member functions as non-const
Diffstat (limited to 'src')
-rw-r--r--src/logging.cpp2
-rw-r--r--src/logging.h4
-rw-r--r--src/miner.cpp2
-rw-r--r--src/miner.h2
-rw-r--r--src/net.cpp2
-rw-r--r--src/net.h2
-rw-r--r--src/script/interpreter.cpp4
-rw-r--r--src/test/checkqueue_tests.cpp8
-rw-r--r--src/test/util/setup_common.cpp4
-rw-r--r--src/test/util/setup_common.h4
-rw-r--r--src/validation.h2
-rw-r--r--src/wallet/wallet.cpp2
-rw-r--r--src/wallet/wallet.h2
13 files changed, 20 insertions, 20 deletions
diff --git a/src/logging.cpp b/src/logging.cpp
index 35e0754f20..4ddcf1d930 100644
--- a/src/logging.cpp
+++ b/src/logging.cpp
@@ -174,7 +174,7 @@ bool GetLogCategory(BCLog::LogFlags& flag, const std::string& str)
return false;
}
-std::vector<LogCategory> BCLog::Logger::LogCategoriesList()
+std::vector<LogCategory> BCLog::Logger::LogCategoriesList() const
{
std::vector<LogCategory> ret;
for (const CLogCategoryDesc& category_desc : LogCategories) {
diff --git a/src/logging.h b/src/logging.h
index 7e646ef67a..9efecc7c12 100644
--- a/src/logging.h
+++ b/src/logging.h
@@ -135,9 +135,9 @@ namespace BCLog {
bool WillLogCategory(LogFlags category) const;
/** Returns a vector of the log categories */
- std::vector<LogCategory> LogCategoriesList();
+ std::vector<LogCategory> LogCategoriesList() const;
/** Returns a string with the log categories */
- std::string LogCategoriesString()
+ std::string LogCategoriesString() const
{
return Join(LogCategoriesList(), ", ", [&](const LogCategory& i) { return i.category; });
};
diff --git a/src/miner.cpp b/src/miner.cpp
index 41a835f70a..009ae6b13a 100644
--- a/src/miner.cpp
+++ b/src/miner.cpp
@@ -213,7 +213,7 @@ bool BlockAssembler::TestPackage(uint64_t packageSize, int64_t packageSigOpsCost
// - transaction finality (locktime)
// - premature witness (in case segwit transactions are added to mempool before
// segwit activation)
-bool BlockAssembler::TestPackageTransactions(const CTxMemPool::setEntries& package)
+bool BlockAssembler::TestPackageTransactions(const CTxMemPool::setEntries& package) const
{
for (CTxMemPool::txiter it : package) {
if (!IsFinalTx(it->GetTx(), nHeight, nLockTimeCutoff))
diff --git a/src/miner.h b/src/miner.h
index bb7a30b184..9a2b7063f4 100644
--- a/src/miner.h
+++ b/src/miner.h
@@ -185,7 +185,7 @@ private:
* locktime, premature-witness, serialized size (if necessary)
* These checks should always succeed, and they're here
* only as an extra check in case of suboptimal node configuration */
- bool TestPackageTransactions(const CTxMemPool::setEntries& package);
+ bool TestPackageTransactions(const CTxMemPool::setEntries& package) const;
/** Return true if given transaction from mapTx has already been evaluated,
* or if the transaction's cached data in mapTx is incorrect. */
bool SkipMapTxEntry(CTxMemPool::txiter it, indexed_modified_transaction_set& mapModifiedTx, CTxMemPool::setEntries& failedTx) EXCLUSIVE_LOCKS_REQUIRED(m_mempool.cs);
diff --git a/src/net.cpp b/src/net.cpp
index 9c6d7b6375..8ddbcf5d33 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -1216,7 +1216,7 @@ void CConnman::NotifyNumConnectionsChanged()
}
}
-void CConnman::InactivityCheck(CNode *pnode)
+void CConnman::InactivityCheck(CNode *pnode) const
{
int64_t nTime = GetSystemTimeInSeconds();
if (nTime - pnode->nTimeConnected > m_peer_connect_timeout)
diff --git a/src/net.h b/src/net.h
index 21ee5e7808..0e92e06e0d 100644
--- a/src/net.h
+++ b/src/net.h
@@ -423,7 +423,7 @@ private:
void AcceptConnection(const ListenSocket& hListenSocket);
void DisconnectNodes();
void NotifyNumConnectionsChanged();
- void InactivityCheck(CNode *pnode);
+ void InactivityCheck(CNode *pnode) const;
bool GenerateSelectSet(std::set<SOCKET> &recv_set, std::set<SOCKET> &send_set, std::set<SOCKET> &error_set);
void SocketEvents(std::set<SOCKET> &recv_set, std::set<SOCKET> &send_set, std::set<SOCKET> &error_set);
void SocketHandler();
diff --git a/src/script/interpreter.cpp b/src/script/interpreter.cpp
index bb5a7158a5..ecac3b9e7e 100644
--- a/src/script/interpreter.cpp
+++ b/src/script/interpreter.cpp
@@ -305,8 +305,8 @@ private:
uint32_t m_first_false_pos = NO_FALSE;
public:
- bool empty() { return m_stack_size == 0; }
- bool all_true() { return m_first_false_pos == NO_FALSE; }
+ bool empty() const { return m_stack_size == 0; }
+ bool all_true() const { return m_first_false_pos == NO_FALSE; }
void push_back(bool f)
{
if (m_first_false_pos == NO_FALSE && !f) {
diff --git a/src/test/checkqueue_tests.cpp b/src/test/checkqueue_tests.cpp
index 8348810ac1..5dbf07b420 100644
--- a/src/test/checkqueue_tests.cpp
+++ b/src/test/checkqueue_tests.cpp
@@ -26,7 +26,7 @@ static const unsigned int QUEUE_BATCH_SIZE = 128;
static const int SCRIPT_CHECK_THREADS = 3;
struct FakeCheck {
- bool operator()()
+ bool operator()() const
{
return true;
}
@@ -47,7 +47,7 @@ struct FailingCheck {
bool fails;
FailingCheck(bool _fails) : fails(_fails){};
FailingCheck() : fails(true){};
- bool operator()()
+ bool operator()() const
{
return !fails;
}
@@ -76,7 +76,7 @@ struct UniqueCheck {
struct MemoryCheck {
static std::atomic<size_t> fake_allocated_memory;
bool b {false};
- bool operator()()
+ bool operator()() const
{
return true;
}
@@ -107,7 +107,7 @@ struct FrozenCleanupCheck {
// Freezing can't be the default initialized behavior given how the queue
// swaps in default initialized Checks.
bool should_freeze {false};
- bool operator()()
+ bool operator()() const
{
return true;
}
diff --git a/src/test/util/setup_common.cpp b/src/test/util/setup_common.cpp
index adf5970206..e6b72dc447 100644
--- a/src/test/util/setup_common.cpp
+++ b/src/test/util/setup_common.cpp
@@ -231,12 +231,12 @@ TestChain100Setup::~TestChain100Setup()
gArgs.ForceSetArg("-segwitheight", "0");
}
-CTxMemPoolEntry TestMemPoolEntryHelper::FromTx(const CMutableTransaction& tx)
+CTxMemPoolEntry TestMemPoolEntryHelper::FromTx(const CMutableTransaction& tx) const
{
return FromTx(MakeTransactionRef(tx));
}
-CTxMemPoolEntry TestMemPoolEntryHelper::FromTx(const CTransactionRef& tx)
+CTxMemPoolEntry TestMemPoolEntryHelper::FromTx(const CTransactionRef& tx) const
{
return CTxMemPoolEntry(tx, nFee, nTime, nHeight,
spendsCoinbase, sigOpCost, lp);
diff --git a/src/test/util/setup_common.h b/src/test/util/setup_common.h
index 1812ce1666..a20421b85b 100644
--- a/src/test/util/setup_common.h
+++ b/src/test/util/setup_common.h
@@ -138,8 +138,8 @@ struct TestMemPoolEntryHelper
nFee(0), nTime(0), nHeight(1),
spendsCoinbase(false), sigOpCost(4) { }
- CTxMemPoolEntry FromTx(const CMutableTransaction& tx);
- CTxMemPoolEntry FromTx(const CTransactionRef& tx);
+ CTxMemPoolEntry FromTx(const CMutableTransaction& tx) const;
+ CTxMemPoolEntry FromTx(const CTransactionRef& tx) const;
// Change the default value
TestMemPoolEntryHelper &Fee(CAmount _fee) { nFee = _fee; return *this; }
diff --git a/src/validation.h b/src/validation.h
index ffb038ad75..4ec4ee8a7f 100644
--- a/src/validation.h
+++ b/src/validation.h
@@ -564,7 +564,7 @@ public:
//! @returns whether or not the CoinsViews object has been fully initialized and we can
//! safely flush this object to disk.
- bool CanFlushToDisk() EXCLUSIVE_LOCKS_REQUIRED(cs_main) {
+ bool CanFlushToDisk() const EXCLUSIVE_LOCKS_REQUIRED(cs_main) {
return m_coins_views && m_coins_views->m_cacheview;
}
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index 65b54f39b4..5c3d7a9d75 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -2706,7 +2706,7 @@ static uint32_t GetLocktimeForNewTransaction(interfaces::Chain& chain, const uin
return locktime;
}
-OutputType CWallet::TransactionChangeType(const Optional<OutputType>& change_type, const std::vector<CRecipient>& vecSend)
+OutputType CWallet::TransactionChangeType(const Optional<OutputType>& change_type, const std::vector<CRecipient>& vecSend) const
{
// If -changetype is specified, always use that change type.
if (change_type) {
diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h
index e6beb111fb..e3eae1dd95 100644
--- a/src/wallet/wallet.h
+++ b/src/wallet/wallet.h
@@ -930,7 +930,7 @@ public:
Balance GetBalance(int min_depth = 0, bool avoid_reuse = true) const;
CAmount GetAvailableBalance(const CCoinControl* coinControl = nullptr) const;
- OutputType TransactionChangeType(const Optional<OutputType>& change_type, const std::vector<CRecipient>& vecSend);
+ OutputType TransactionChangeType(const Optional<OutputType>& change_type, const std::vector<CRecipient>& vecSend) const;
/**
* Insert additional inputs into the transaction by