From 40c270030ed2288109571ebba2b917bc3ab643fc Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kittywhiskers@users.noreply.github.com> Date: Sun, 6 Dec 2020 00:14:17 +0000 Subject: [PATCH] merge bitcoin#20581: Don't make "in" parameters look like "out"/"in-out" parameters: pass by ref to const instead of ref to non-const --- src/init.cpp | 2 +- src/init.h | 2 +- src/interfaces/wallet.cpp | 4 ++-- src/node/coinstats.cpp | 2 +- src/rpc/rawtransaction_util.cpp | 2 +- src/rpc/rawtransaction_util.h | 2 +- src/script/sigcache.cpp | 2 +- src/test/addrman_tests.cpp | 2 +- src/test/net_tests.cpp | 2 +- src/test/util_tests.cpp | 2 +- 10 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index 1bb0f12071..6dfe22404d 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1214,7 +1214,7 @@ std::set g_enabled_filter_types; std::terminate(); }; -bool AppInitBasicSetup(ArgsManager& args) +bool AppInitBasicSetup(const ArgsManager& args) { // ********************************************************* Step 1: setup #ifdef _MSC_VER diff --git a/src/init.h b/src/init.h index f384d53971..271d080f0f 100644 --- a/src/init.h +++ b/src/init.h @@ -33,7 +33,7 @@ void InitParameterInteraction(ArgsManager& args); * @note This can be done before daemonization. Do not call Shutdown() if this function fails. * @pre Parameters should be parsed and config file should be read. */ -bool AppInitBasicSetup(ArgsManager& args); +bool AppInitBasicSetup(const ArgsManager& args); /** * Initialization: parameter interaction. * @note This can be done before daemonization. Do not call Shutdown() if this function fails. diff --git a/src/interfaces/wallet.cpp b/src/interfaces/wallet.cpp index acef6a75fc..32d7eec193 100644 --- a/src/interfaces/wallet.cpp +++ b/src/interfaces/wallet.cpp @@ -75,7 +75,7 @@ WalletTx MakeWalletTx(CWallet& wallet, const CWalletTx& wtx) } //! Construct wallet tx status struct. -WalletTxStatus MakeWalletTxStatus(CWallet& wallet, const CWalletTx& wtx) +WalletTxStatus MakeWalletTxStatus(const CWallet& wallet, const CWalletTx& wtx) { WalletTxStatus result; result.block_height = wallet.chain().getBlockHeight(wtx.m_confirm.hashBlock).value_or(std::numeric_limits::max()); @@ -94,7 +94,7 @@ WalletTxStatus MakeWalletTxStatus(CWallet& wallet, const CWalletTx& wtx) } //! Construct wallet TxOut struct. -WalletTxOut MakeWalletTxOut(CWallet& wallet, +WalletTxOut MakeWalletTxOut(const CWallet& wallet, const CWalletTx& wtx, int n, int depth) EXCLUSIVE_LOCKS_REQUIRED(wallet.cs_wallet) diff --git a/src/node/coinstats.cpp b/src/node/coinstats.cpp index dc9f044440..782aa76fc9 100644 --- a/src/node/coinstats.cpp +++ b/src/node/coinstats.cpp @@ -145,7 +145,7 @@ bool GetUTXOStats(CCoinsView* view, CCoinsStats& stats, CoinStatsHashType hash_t } // The legacy hash serializes the hashBlock -static void PrepareHash(CHashWriter& ss, CCoinsStats& stats) +static void PrepareHash(CHashWriter& ss, const CCoinsStats& stats) { ss << stats.hashBlock; } diff --git a/src/rpc/rawtransaction_util.cpp b/src/rpc/rawtransaction_util.cpp index 375a3fe276..600ed642f4 100644 --- a/src/rpc/rawtransaction_util.cpp +++ b/src/rpc/rawtransaction_util.cpp @@ -205,7 +205,7 @@ void SignTransaction(CMutableTransaction& mtx, const SigningProvider* keystore, SignTransactionResultToJSON(mtx, complete, coins, input_errors, result); } -void SignTransactionResultToJSON(CMutableTransaction& mtx, bool complete, const std::map& coins, std::map& input_errors, UniValue& result) +void SignTransactionResultToJSON(CMutableTransaction& mtx, bool complete, const std::map& coins, const std::map& input_errors, UniValue& result) { // Make errors UniValue UniValue vErrors(UniValue::VARR); diff --git a/src/rpc/rawtransaction_util.h b/src/rpc/rawtransaction_util.h index cbcc9a6236..2c37ab7b49 100644 --- a/src/rpc/rawtransaction_util.h +++ b/src/rpc/rawtransaction_util.h @@ -25,7 +25,7 @@ class SigningProvider; * @param result JSON object where signed transaction results accumulate */ void SignTransaction(CMutableTransaction& mtx, const SigningProvider* keystore, const std::map& coins, const UniValue& hashType, UniValue& result); -void SignTransactionResultToJSON(CMutableTransaction& mtx, bool complete, const std::map& coins, std::map& input_errors, UniValue& result); +void SignTransactionResultToJSON(CMutableTransaction& mtx, bool complete, const std::map& coins, const std::map& input_errors, UniValue& result); /** * Parse a prevtxs UniValue array and get the map of coins from it diff --git a/src/script/sigcache.cpp b/src/script/sigcache.cpp index 13fc9a07fc..7276710f36 100644 --- a/src/script/sigcache.cpp +++ b/src/script/sigcache.cpp @@ -56,7 +56,7 @@ public: return setValid.contains(entry, erase); } - void Set(uint256& entry) + void Set(const uint256& entry) { std::unique_lock lock(cs_sigcache); setValid.insert(entry); diff --git a/src/test/addrman_tests.cpp b/src/test/addrman_tests.cpp index bfd31c654e..5f16b8dee8 100644 --- a/src/test/addrman_tests.cpp +++ b/src/test/addrman_tests.cpp @@ -69,7 +69,7 @@ public: } // Simulates connection failure so that we can test eviction of offline nodes - void SimConnFail(CService& addr) + void SimConnFail(const CService& addr) { LOCK(cs); int64_t nLastSuccess = 1; diff --git a/src/test/net_tests.cpp b/src/test/net_tests.cpp index d58f8c18c3..00b37b3560 100644 --- a/src/test/net_tests.cpp +++ b/src/test/net_tests.cpp @@ -70,7 +70,7 @@ public: } }; -static CDataStream AddrmanToStream(CAddrManSerializationMock& _addrman) +static CDataStream AddrmanToStream(const CAddrManSerializationMock& _addrman) { CDataStream ssPeersIn(SER_DISK, CLIENT_VERSION); ssPeersIn << Params().MessageStart(); diff --git a/src/test/util_tests.cpp b/src/test/util_tests.cpp index 6cd82e8788..ee6ebec1c2 100644 --- a/src/test/util_tests.cpp +++ b/src/test/util_tests.cpp @@ -1802,7 +1802,7 @@ BOOST_AUTO_TEST_CASE(test_Capitalize) BOOST_CHECK_EQUAL(Capitalize("\x00\xfe\xff"), "\x00\xfe\xff"); } -static std::string SpanToStr(Span& span) +static std::string SpanToStr(const Span& span) { return std::string(span.begin(), span.end()); }