diff --git a/src/interfaces/node.cpp b/src/interfaces/node.cpp --- a/src/interfaces/node.cpp +++ b/src/interfaces/node.cpp @@ -51,7 +51,7 @@ ChainstateManager &chainman() { return *Assert(m_context->chainman); } public: - NodeImpl(NodeContext *context) { setContext(context); } + explicit NodeImpl(NodeContext *context) { setContext(context); } void initLogging() override { InitLogging(*Assert(m_context->args)); } void initParameterInteraction() override { InitParameterInteraction(*Assert(m_context->args)); diff --git a/src/invrequest.cpp b/src/invrequest.cpp --- a/src/invrequest.cpp +++ b/src/invrequest.cpp @@ -202,7 +202,7 @@ const PriorityComputer &m_computer; public: - ByInvIdViewExtractor(const PriorityComputer &computer) + explicit ByInvIdViewExtractor(const PriorityComputer &computer) : m_computer(computer) {} using result_type = ByInvIdView; result_type operator()(const Announcement &ann) const { @@ -587,7 +587,7 @@ EmplaceExpiredFun emplaceExpired) { clearExpired(); // Iterate over all CANDIDATE_DELAYED and REQUESTED from old to new, as - // long as they're in the past, and convert them to CANDIDATE_READY and + // long as they're in the past, and convert them to CANDIDATE_READY andc // COMPLETED respectively. while (!m_index.empty()) { auto it = m_index.get().begin(); @@ -620,7 +620,7 @@ } public: - InvRequestTrackerImpl(bool deterministic) + explicit InvRequestTrackerImpl(bool deterministic) : m_computer(deterministic), // Explicitly initialize m_index as we need to pass a reference to // m_computer to ByInvIdViewExtractor. diff --git a/src/rpc/request.h b/src/rpc/request.h --- a/src/rpc/request.h +++ b/src/rpc/request.h @@ -41,7 +41,7 @@ std::string peerAddr; const util::Ref &context; - JSONRPCRequest(const util::Ref &contextIn) + explicit JSONRPCRequest(const util::Ref &contextIn) : id(NullUniValue), params(NullUniValue), context(contextIn) {} //! Initializes request information from another request object and the diff --git a/src/script/descriptor.cpp b/src/script/descriptor.cpp --- a/src/script/descriptor.cpp +++ b/src/script/descriptor.cpp @@ -187,7 +187,7 @@ uint32_t m_expr_index; public: - PubkeyProvider(uint32_t exp_index) : m_expr_index(exp_index) {} + explicit PubkeyProvider(uint32_t exp_index) : m_expr_index(exp_index) {} virtual ~PubkeyProvider() = default; diff --git a/src/test/fuzz/signature_checker.cpp b/src/test/fuzz/signature_checker.cpp --- a/src/test/fuzz/signature_checker.cpp +++ b/src/test/fuzz/signature_checker.cpp @@ -22,7 +22,7 @@ FuzzedDataProvider &m_fuzzed_data_provider; public: - FuzzedSignatureChecker(FuzzedDataProvider &fuzzed_data_provider) + explicit FuzzedSignatureChecker(FuzzedDataProvider &fuzzed_data_provider) : m_fuzzed_data_provider(fuzzed_data_provider) {} bool CheckSig(const std::vector &scriptSig, diff --git a/src/tinyformat.h b/src/tinyformat.h --- a/src/tinyformat.h +++ b/src/tinyformat.h @@ -575,7 +575,7 @@ FormatArg() : m_value(NULL), m_formatImpl(NULL), m_toIntImpl(NULL) {} template - FormatArg(const T &value) + explicit FormatArg(const T &value) : m_value(static_cast(&value)), m_formatImpl(&formatImpl), m_toIntImpl(&toIntImpl) {} @@ -1022,7 +1022,7 @@ public: #ifdef TINYFORMAT_USE_VARIADIC_TEMPLATES template - FormatListN(const Args &...args) + explicit FormatListN(const Args &...args) : FormatList(&m_formatterStore[0], N), m_formatterStore{ FormatArg(args)...} { static_assert(sizeof...(args) == N, "Number of args must be N"); diff --git a/src/util/hash_type.h b/src/util/hash_type.h --- a/src/util/hash_type.h +++ b/src/util/hash_type.h @@ -11,7 +11,7 @@ public: BaseHash() : m_hash() {} - BaseHash(const HashType &in) : m_hash(in) {} + explicit BaseHash(const HashType &in) : m_hash(in) {} uint8_t *begin() { return m_hash.begin(); } diff --git a/src/wallet/bdb.h b/src/wallet/bdb.h --- a/src/wallet/bdb.h +++ b/src/wallet/bdb.h @@ -49,7 +49,7 @@ std::unordered_map m_fileids; std::condition_variable_any m_db_in_use; - BerkeleyEnvironment(const fs::path &env_directory); + explicit BerkeleyEnvironment(const fs::path &env_directory); BerkeleyEnvironment(); ~BerkeleyEnvironment(); void Reset(); diff --git a/src/wallet/scriptpubkeyman.h b/src/wallet/scriptpubkeyman.h --- a/src/wallet/scriptpubkeyman.h +++ b/src/wallet/scriptpubkeyman.h @@ -176,7 +176,7 @@ WalletStorage &m_storage; public: - ScriptPubKeyMan(WalletStorage &storage) : m_storage(storage) {} + explicit ScriptPubKeyMan(WalletStorage &storage) : m_storage(storage) {} virtual ~ScriptPubKeyMan(){}; virtual bool GetNewDestination(const OutputType type, CTxDestination &dest, std::string &error) { @@ -633,7 +633,7 @@ const LegacyScriptPubKeyMan &m_spk_man; public: - LegacySigningProvider(const LegacyScriptPubKeyMan &spk_man) + explicit LegacySigningProvider(const LegacyScriptPubKeyMan &spk_man) : m_spk_man(spk_man) {} bool GetCScript(const CScriptID &scriptid, CScript &script) const override {