diff --git a/src/external_signer.cpp b/src/external_signer.cpp index 33129199775..84d98a19906 100644 --- a/src/external_signer.cpp +++ b/src/external_signer.cpp @@ -15,14 +15,15 @@ #include #include -ExternalSigner::ExternalSigner(const std::string& command, const std::string chain, const std::string& fingerprint, const std::string name): m_command(command), m_chain(chain), m_fingerprint(fingerprint), m_name(name) {} +ExternalSigner::ExternalSigner(std::string command, std::string chain, std::string fingerprint, std::string name) + : m_command{std::move(command)}, m_chain{std::move(chain)}, m_fingerprint{std::move(fingerprint)}, m_name{std::move(name)} {} std::string ExternalSigner::NetworkArg() const { return " --chain " + m_chain; } -bool ExternalSigner::Enumerate(const std::string& command, std::vector& signers, const std::string chain) +bool ExternalSigner::Enumerate(const std::string& command, std::vector& signers, const std::string& chain) { // Call enumerate const UniValue result = RunCommandParseJSON(command + " enumerate"); diff --git a/src/external_signer.h b/src/external_signer.h index 318b3bc062c..5d23cef461f 100644 --- a/src/external_signer.h +++ b/src/external_signer.h @@ -31,7 +31,7 @@ public: //! @param[in] fingerprint master key fingerprint of the signer //! @param[in] chain "main", "test", "regtest" or "signet" //! @param[in] name device name - ExternalSigner(const std::string& command, const std::string chain, const std::string& fingerprint, const std::string name); + ExternalSigner(std::string command, std::string chain, std::string fingerprint, std::string name); //! Master key fingerprint of the signer std::string m_fingerprint; @@ -44,7 +44,7 @@ public: //! @param[in,out] signers vector to which new signers (with a unique master key fingerprint) are added //! @param chain "main", "test", "regtest" or "signet" //! @returns success - static bool Enumerate(const std::string& command, std::vector& signers, const std::string chain); + static bool Enumerate(const std::string& command, std::vector& signers, const std::string& chain); //! Display address on the device. Calls ` displayaddress --desc `. //! @param[in] descriptor Descriptor specifying which address to display. diff --git a/src/netbase.h b/src/netbase.h index d3c263f9e8a..174eae43e29 100644 --- a/src/netbase.h +++ b/src/netbase.h @@ -60,7 +60,8 @@ class Proxy public: Proxy() : m_is_unix_socket(false), m_tor_stream_isolation(false) {} explicit Proxy(const CService& _proxy, bool tor_stream_isolation = false) : proxy(_proxy), m_is_unix_socket(false), m_tor_stream_isolation(tor_stream_isolation) {} - explicit Proxy(const std::string path, bool tor_stream_isolation = false) : m_unix_socket_path(path), m_is_unix_socket(true), m_tor_stream_isolation(tor_stream_isolation) {} + explicit Proxy(std::string path, bool tor_stream_isolation = false) + : m_unix_socket_path(std::move(path)), m_is_unix_socket(true), m_tor_stream_isolation(tor_stream_isolation) {} CService proxy; std::string m_unix_socket_path; diff --git a/src/psbt.cpp b/src/psbt.cpp index 9339bf7c092..a1eafbc001d 100644 --- a/src/psbt.cpp +++ b/src/psbt.cpp @@ -322,7 +322,7 @@ bool PSBTInputSigned(const PSBTInput& input) return !input.final_script_sig.empty() || !input.final_script_witness.IsNull(); } -bool PSBTInputSignedAndVerified(const PartiallySignedTransaction psbt, unsigned int input_index, const PrecomputedTransactionData* txdata) +bool PSBTInputSignedAndVerified(const PartiallySignedTransaction& psbt, unsigned int input_index, const PrecomputedTransactionData* txdata) { CTxOut utxo; assert(input_index < psbt.inputs.size()); diff --git a/src/psbt.h b/src/psbt.h index 9d7fc05b791..1a426a2eeb3 100644 --- a/src/psbt.h +++ b/src/psbt.h @@ -1413,7 +1413,7 @@ PrecomputedTransactionData PrecomputePSBTData(const PartiallySignedTransaction& bool PSBTInputSigned(const PSBTInput& input); /** Checks whether a PSBTInput is already signed by doing script verification using final fields. */ -bool PSBTInputSignedAndVerified(const PartiallySignedTransaction psbt, unsigned int input_index, const PrecomputedTransactionData* txdata); +bool PSBTInputSignedAndVerified(const PartiallySignedTransaction& psbt, unsigned int input_index, const PrecomputedTransactionData* txdata); /** Signs a PSBTInput, verifying that all provided data matches what is being signed. * diff --git a/src/test/argsman_tests.cpp b/src/test/argsman_tests.cpp index 5236d5db21c..e91ae5e96f3 100644 --- a/src/test/argsman_tests.cpp +++ b/src/test/argsman_tests.cpp @@ -52,7 +52,7 @@ BOOST_AUTO_TEST_CASE(util_datadir) struct TestArgsManager : public ArgsManager { TestArgsManager() { m_network_only_args.clear(); } - void ReadConfigString(const std::string str_config) + void ReadConfigString(const std::string& str_config) { std::istringstream streamConfig(str_config); { @@ -63,7 +63,7 @@ struct TestArgsManager : public ArgsManager std::string error; BOOST_REQUIRE(ReadConfigStream(streamConfig, "", error)); } - void SetNetworkOnlyArg(const std::string arg) + void SetNetworkOnlyArg(const std::string& arg) { LOCK(cs_args); m_network_only_args.insert(arg); diff --git a/src/wallet/rpc/util.cpp b/src/wallet/rpc/util.cpp index d68e6c65269..a699b226150 100644 --- a/src/wallet/rpc/util.cpp +++ b/src/wallet/rpc/util.cpp @@ -124,7 +124,7 @@ void PushParentDescriptors(const CWallet& wallet, const CScript& script_pubkey, entry.pushKV("parent_descs", std::move(parent_descs)); } -void HandleWalletError(const std::shared_ptr wallet, DatabaseStatus& status, bilingual_str& error) +void HandleWalletError(const std::shared_ptr& wallet, DatabaseStatus& status, bilingual_str& error) { if (!wallet) { // Map bad format to not found, since bad format is returned when the diff --git a/src/wallet/rpc/util.h b/src/wallet/rpc/util.h index d649721431a..89729218d1a 100644 --- a/src/wallet/rpc/util.h +++ b/src/wallet/rpc/util.h @@ -54,7 +54,7 @@ std::string LabelFromValue(const UniValue& value); //! Fetch parent descriptors of this scriptPubKey. void PushParentDescriptors(const CWallet& wallet, const CScript& script_pubkey, UniValue& entry); -void HandleWalletError(const std::shared_ptr wallet, DatabaseStatus& status, bilingual_str& error); +void HandleWalletError(const std::shared_ptr& wallet, DatabaseStatus& status, bilingual_str& error); void AppendLastProcessedBlock(UniValue& entry, const CWallet& wallet) EXCLUSIVE_LOCKS_REQUIRED(wallet.cs_wallet); } // namespace wallet diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 56c676c189f..abbb6c1267d 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -2534,7 +2534,7 @@ bool CWallet::TopUpKeyPool(unsigned int kpSize) return res; } -util::Result CWallet::GetNewDestination(const OutputType type, const std::string label) +util::Result CWallet::GetNewDestination(const OutputType type, const std::string& label) { LOCK(cs_wallet); auto spk_man = GetScriptPubKeyMan(type, /*internal=*/false); diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index 24d6b07d356..d23c1a943ec 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -783,7 +783,7 @@ public: */ void MarkDestinationsDirty(const std::set& destinations) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); - util::Result GetNewDestination(const OutputType type, const std::string label); + util::Result GetNewDestination(const OutputType type, const std::string& label); util::Result GetNewChangeDestination(const OutputType type); bool IsMine(const CTxDestination& dest) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);