Skip to content

Commit 12dcdaa

Browse files
Don't make "in" parameters look like "out"/"in-out" parameters: pass by ref to const instead of ref to non-const
1 parent f35e4d9 commit 12dcdaa

File tree

12 files changed

+16
-16
lines changed

12 files changed

+16
-16
lines changed

src/init.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -914,7 +914,7 @@ std::set<BlockFilterType> g_enabled_filter_types;
914914
std::terminate();
915915
};
916916

917-
bool AppInitBasicSetup(ArgsManager& args)
917+
bool AppInitBasicSetup(const ArgsManager& args)
918918
{
919919
// ********************************************************* Step 1: setup
920920
#ifdef _MSC_VER

src/init.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ void InitParameterInteraction(ArgsManager& args);
3333
* @note This can be done before daemonization. Do not call Shutdown() if this function fails.
3434
* @pre Parameters should be parsed and config file should be read.
3535
*/
36-
bool AppInitBasicSetup(ArgsManager& args);
36+
bool AppInitBasicSetup(const ArgsManager& args);
3737
/**
3838
* Initialization: parameter interaction.
3939
* @note This can be done before daemonization. Do not call Shutdown() if this function fails.

src/node/coinstats.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ bool GetUTXOStats(CCoinsView* view, CCoinsStats& stats, CoinStatsHashType hash_t
112112
}
113113

114114
// The legacy hash serializes the hashBlock
115-
static void PrepareHash(CHashWriter& ss, CCoinsStats& stats)
115+
static void PrepareHash(CHashWriter& ss, const CCoinsStats& stats)
116116
{
117117
ss << stats.hashBlock;
118118
}

src/rpc/rawtransaction_util.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ void SignTransaction(CMutableTransaction& mtx, const SigningProvider* keystore,
286286
SignTransactionResultToJSON(mtx, complete, coins, input_errors, result);
287287
}
288288

289-
void SignTransactionResultToJSON(CMutableTransaction& mtx, bool complete, const std::map<COutPoint, Coin>& coins, std::map<int, std::string>& input_errors, UniValue& result)
289+
void SignTransactionResultToJSON(CMutableTransaction& mtx, bool complete, const std::map<COutPoint, Coin>& coins, const std::map<int, std::string>& input_errors, UniValue& result)
290290
{
291291
// Make errors UniValue
292292
UniValue vErrors(UniValue::VARR);

src/rpc/rawtransaction_util.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class SigningProvider;
2525
* @param result JSON object where signed transaction results accumulate
2626
*/
2727
void SignTransaction(CMutableTransaction& mtx, const SigningProvider* keystore, const std::map<COutPoint, Coin>& coins, const UniValue& hashType, UniValue& result);
28-
void SignTransactionResultToJSON(CMutableTransaction& mtx, bool complete, const std::map<COutPoint, Coin>& coins, std::map<int, std::string>& input_errors, UniValue& result);
28+
void SignTransactionResultToJSON(CMutableTransaction& mtx, bool complete, const std::map<COutPoint, Coin>& coins, const std::map<int, std::string>& input_errors, UniValue& result);
2929

3030
/**
3131
* Parse a prevtxs UniValue array and get the map of coins from it

src/script/sigcache.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class CSignatureCache
6666
return setValid.contains(entry, erase);
6767
}
6868

69-
void Set(uint256& entry)
69+
void Set(const uint256& entry)
7070
{
7171
boost::unique_lock<boost::shared_mutex> lock(cs_sigcache);
7272
setValid.insert(entry);

src/test/addrman_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class CAddrManTest : public CAddrMan
7171
}
7272

7373
// Simulates connection failure so that we can test eviction of offline nodes
74-
void SimConnFail(CService& addr)
74+
void SimConnFail(const CService& addr)
7575
{
7676
LOCK(cs);
7777
int64_t nLastSuccess = 1;

src/test/net_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class CAddrManCorrupted : public CAddrManSerializationMock
7575
}
7676
};
7777

78-
static CDataStream AddrmanToStream(CAddrManSerializationMock& _addrman)
78+
static CDataStream AddrmanToStream(const CAddrManSerializationMock& _addrman)
7979
{
8080
CDataStream ssPeersIn(SER_DISK, CLIENT_VERSION);
8181
ssPeersIn << Params().MessageStart();

src/test/util_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1860,7 +1860,7 @@ BOOST_AUTO_TEST_CASE(test_Capitalize)
18601860
BOOST_CHECK_EQUAL(Capitalize("\x00\xfe\xff"), "\x00\xfe\xff");
18611861
}
18621862

1863-
static std::string SpanToStr(Span<const char>& span)
1863+
static std::string SpanToStr(const Span<const char>& span)
18641864
{
18651865
return std::string(span.begin(), span.end());
18661866
}

src/validation.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -505,13 +505,13 @@ class MemPoolAccept
505505

506506
// Run the script checks using our policy flags. As this can be slow, we should
507507
// only invoke this on transactions that have otherwise passed policy checks.
508-
bool PolicyScriptChecks(ATMPArgs& args, Workspace& ws, PrecomputedTransactionData& txdata) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
508+
bool PolicyScriptChecks(ATMPArgs& args, const Workspace& ws, PrecomputedTransactionData& txdata) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
509509

510510
// Re-run the script checks, using consensus flags, and try to cache the
511511
// result in the scriptcache. This should be done after
512512
// PolicyScriptChecks(). This requires that all inputs either be in our
513513
// utxo set or in the mempool.
514-
bool ConsensusScriptChecks(ATMPArgs& args, Workspace& ws, PrecomputedTransactionData &txdata) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
514+
bool ConsensusScriptChecks(ATMPArgs& args, const Workspace& ws, PrecomputedTransactionData &txdata) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
515515

516516
// Try to add the transaction to the mempool, removing any conflicts first.
517517
// Returns true if the transaction is in the mempool after any size
@@ -921,7 +921,7 @@ bool MemPoolAccept::PreChecks(ATMPArgs& args, Workspace& ws)
921921
return true;
922922
}
923923

924-
bool MemPoolAccept::PolicyScriptChecks(ATMPArgs& args, Workspace& ws, PrecomputedTransactionData& txdata)
924+
bool MemPoolAccept::PolicyScriptChecks(ATMPArgs& args, const Workspace& ws, PrecomputedTransactionData& txdata)
925925
{
926926
const CTransaction& tx = *ws.m_ptx;
927927

@@ -948,7 +948,7 @@ bool MemPoolAccept::PolicyScriptChecks(ATMPArgs& args, Workspace& ws, Precompute
948948
return true;
949949
}
950950

951-
bool MemPoolAccept::ConsensusScriptChecks(ATMPArgs& args, Workspace& ws, PrecomputedTransactionData& txdata)
951+
bool MemPoolAccept::ConsensusScriptChecks(ATMPArgs& args, const Workspace& ws, PrecomputedTransactionData& txdata)
952952
{
953953
const CTransaction& tx = *ws.m_ptx;
954954
const uint256& hash = ws.m_hash;

0 commit comments

Comments
 (0)