From 1b2e7560cad9407351e07bee6ba1515864fe922d Mon Sep 17 00:00:00 2001 From: pasta Date: Mon, 3 Aug 2026 12:08:25 -0500 Subject: [PATCH 01/17] fix: address cppcheck warnings hidden by vacuous lint-cppcheck-dash The cppcheck linter has been silently analyzing nothing (see next commit), letting several warnings in non-backported files accumulate. Fix the ones that the linter's ALWAYS_ENABLED_WARNINGS patterns force-report: remove unused/dead locals, make single-argument constructors explicit (with an inline suppression for CBLSIdImplicit, whose implicit conversion is intentional), narrow benchmark counters to the scope they are used in, pass CSigBase and BlsCheck constructor arguments by reference/move, and inline-suppress a danglingTempReference false positive on a lifetime-extended range-for temporary. --- src/active/dkgsession.cpp | 3 --- src/bls/bls.h | 1 + src/chainlock/chainlock.h | 2 +- src/coinjoin/coinjoin.h | 2 +- src/evo/specialtxman.cpp | 7 ++++--- src/llmq/signing_shares.cpp | 2 +- src/llmq/utils.cpp | 4 ++-- src/rpc/evo.cpp | 1 - src/rpc/governance.cpp | 2 ++ 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/active/dkgsession.cpp b/src/active/dkgsession.cpp index 33b1d983d474..313da0ff30bd 100644 --- a/src/active/dkgsession.cpp +++ b/src/active/dkgsession.cpp @@ -673,9 +673,6 @@ CFinalCommitment ActiveDKGSession::FinalizeSingleCommitment() CDKGLogger logger(*this, __func__, __LINE__); - std::vector signerIds; - std::vector thresholdSigs; - CFinalCommitment fqc(params, m_quorum_base_block_index->GetBlockHash()); diff --git a/src/bls/bls.h b/src/bls/bls.h index 02a3bbefa5bf..c516065196ec 100644 --- a/src/bls/bls.h +++ b/src/bls/bls.h @@ -234,6 +234,7 @@ class CBLSWrapper struct CBLSIdImplicit : public uint256 { CBLSIdImplicit() = default; + // cppcheck-suppress noExplicitConstructor CBLSIdImplicit(const uint256& id) { memcpy(begin(), id.begin(), sizeof(uint256)); diff --git a/src/chainlock/chainlock.h b/src/chainlock/chainlock.h index 3ee131264ad2..54bf6500334e 100644 --- a/src/chainlock/chainlock.h +++ b/src/chainlock/chainlock.h @@ -58,7 +58,7 @@ class Chainlocks chainlock::ChainLockSig bestChainLockWithKnownBlock GUARDED_BY(cs); public: - Chainlocks(const CSporkManager& sporkman); + explicit Chainlocks(const CSporkManager& sporkman); [[nodiscard]] bool IsEnabled() const; [[nodiscard]] bool IsSigningEnabled() const; diff --git a/src/coinjoin/coinjoin.h b/src/coinjoin/coinjoin.h index 20662233091e..0cc205bdcf66 100644 --- a/src/coinjoin/coinjoin.h +++ b/src/coinjoin/coinjoin.h @@ -429,7 +429,7 @@ class CDSTXManager public: CDSTXManager(const CDSTXManager&) = delete; CDSTXManager& operator=(const CDSTXManager&) = delete; - CDSTXManager(const chainlock::Chainlocks& chainlocks); + explicit CDSTXManager(const chainlock::Chainlocks& chainlocks); ~CDSTXManager(); void AddDSTX(const CCoinJoinBroadcastTx& dstx) EXCLUSIVE_LOCKS_REQUIRED(!cs_mapdstx); diff --git a/src/evo/specialtxman.cpp b/src/evo/specialtxman.cpp index 1925f16060d8..39917f755b9b 100644 --- a/src/evo/specialtxman.cpp +++ b/src/evo/specialtxman.cpp @@ -699,9 +699,6 @@ bool CSpecialTxProcessor::ProcessSpecialTxsInBlock(Chainstate& chainstate, const static int64_t nTimeLoop = 0; static int64_t nTimeQuorum = 0; static int64_t nTimeDMN = 0; - static int64_t nTimeMerkleMNL = 0; - static int64_t nTimeMerkleQuorums = 0; - static int64_t nTimeCbTxCL = 0; static int64_t nTimeMnehf = 0; static int64_t nTimePayload = 0; static int64_t nTimeCreditPool = 0; @@ -809,6 +806,10 @@ bool CSpecialTxProcessor::ProcessSpecialTxsInBlock(Chainstate& chainstate, const nTimeDMN * 0.000001); if (opt_cbTx.has_value()) { + static int64_t nTimeMerkleMNL = 0; + static int64_t nTimeMerkleQuorums = 0; + static int64_t nTimeCbTxCL = 0; + uint256 calculatedMerkleRootMNL; if (!CalcCbTxMerkleRootMNList(calculatedMerkleRootMNL, mn_list.to_sml(), state)) { // pass the state returned by the function above diff --git a/src/llmq/signing_shares.cpp b/src/llmq/signing_shares.cpp index 278293f9e285..3f1d5a4e07b6 100644 --- a/src/llmq/signing_shares.cpp +++ b/src/llmq/signing_shares.cpp @@ -114,7 +114,7 @@ std::string CBatchedSigShares::ToInvString() const return inv.ToString(); } -static void InitSession(CSigSharesNodeState::Session& s, const llmq::SignHash& signHash, CSigBase from) +static void InitSession(CSigSharesNodeState::Session& s, const llmq::SignHash& signHash, const CSigBase& from) { const auto& llmq_params_opt = Params().GetLLMQ(from.getLlmqType()); assert(llmq_params_opt.has_value()); diff --git a/src/llmq/utils.cpp b/src/llmq/utils.cpp index 7155a1a98dce..98f502e2d8c5 100644 --- a/src/llmq/utils.cpp +++ b/src/llmq/utils.cpp @@ -549,9 +549,9 @@ BlsCheck::BlsCheck() = default; BlsCheck::BlsCheck(CBLSSignature sig, std::vector pubkeys, uint256 msg_hash, std::string id_string) : m_sig(sig), - m_pubkeys(pubkeys), + m_pubkeys(std::move(pubkeys)), m_msg_hash(msg_hash), - m_id_string(id_string) + m_id_string(std::move(id_string)) { } diff --git a/src/rpc/evo.cpp b/src/rpc/evo.cpp index 308cbe0ce267..9cf3d18d8037 100644 --- a/src/rpc/evo.cpp +++ b/src/rpc/evo.cpp @@ -934,7 +934,6 @@ static UniValue protx_register_common_wrapper(const JSONRPCRequest& request, LOCK(pwallet->cs_wallet); // lets prove we own the collateral CScript scriptPubKey = GetScriptForDestination(txDest); - std::unique_ptr provider = pwallet->GetSolvingProvider(scriptPubKey); std::string signed_payload; SigningResult err = pwallet->SignMessage(ptx.MakeSignString(), *pkhash, signed_payload); diff --git a/src/rpc/governance.cpp b/src/rpc/governance.cpp index aaa45d061f8f..76275aefa973 100644 --- a/src/rpc/governance.cpp +++ b/src/rpc/governance.cpp @@ -660,6 +660,8 @@ static RPCResult ListObjectsHelp() auto ret = CGovernanceObject::GetStateJsonHelp(/*key=*/"", /*optional=*/false, /*local_valid_key=*/"fBlockchainValidity"); auto mod_inner = ret.m_inner; for (const auto& result : CGovernanceObject::GetVotesJsonHelp(/*key=*/"", /*optional=*/false).m_inner) { + // The range expression's temporary is lifetime-extended for the whole loop + // cppcheck-suppress danglingTempReference mod_inner.push_back(result); } return RPCResult{ret.m_type, ret.m_key_name, ret.m_description, mod_inner}; From ddbfd7bebf87f20c045e5577901289a1a5b458e0 Mon Sep 17 00:00:00 2001 From: pasta Date: Mon, 3 Aug 2026 12:08:46 -0500 Subject: [PATCH 02/17] fix(lint): make lint-cppcheck-dash actually report warnings The linter has been vacuous in two ways. First, without __GNUC__ defined, src/attributes.h hits '#error No known always_inline attribute', which aborts cppcheck's analysis of nearly every translation unit; the resulting preprocessorErrorDirective lines were then dropped by the output filter because they don't point at files from non-backported.txt. Second, even with preprocessing fixed, cppcheck 2.17.1 crashes with an assertion in TokenList::setLang under --check-level=exhaustive, and that crash was explicitly suppressed. Define __GNUC__ so preprocessing succeeds, bump cppcheck to 2.21.0 (which no longer crashes with exhaustive checking) and drop the crash suppression, and treat analysis failures (preprocessorErrorDirective, syntaxError, internal errors) as lint failures regardless of which file they point at so the linter can never silently go vacuous again. Making syntaxError fatal immediately surfaced a real case: QT_VERSION_CHECK is a function-like macro cppcheck cannot evaluate, which aborted analysis of the Qt translation units, so define it on the command line too. Fail on any nonzero cppcheck exit status. Without --error-exitcode, diagnostics never make cppcheck return nonzero, so a nonzero status always means the analysis itself failed (bad arguments, unloadable config, OOM kill, crash) and must not pass. Filter out 'note:'/source-context lines, which don't carry the check id that suppressions match on and would leak through when their parent warning is suppressed, while matching all real diagnostic severities (the gcc template currently renders them all as 'warning:', but match the raw severities too in case that changes). Finally, suppress the check ids with pre-existing violations in the tree so the linter can be enforced; these should be burned down and re-enabled over time. --- contrib/containers/ci/ci-slim.Dockerfile | 2 +- test/lint/lint-cppcheck-dash.py | 77 +++++++++++++++++++----- 2 files changed, 63 insertions(+), 16 deletions(-) diff --git a/contrib/containers/ci/ci-slim.Dockerfile b/contrib/containers/ci/ci-slim.Dockerfile index 10ece13d60ca..73c864983939 100644 --- a/contrib/containers/ci/ci-slim.Dockerfile +++ b/contrib/containers/ci/ci-slim.Dockerfile @@ -1,6 +1,6 @@ # Builder for cppcheck FROM debian:bookworm-slim AS cppcheck-builder -ARG CPPCHECK_VERSION=2.17.1 +ARG CPPCHECK_VERSION=2.21.0 RUN set -ex; \ apt-get update && apt-get install -y --no-install-recommends \ curl \ diff --git a/test/lint/lint-cppcheck-dash.py b/test/lint/lint-cppcheck-dash.py index cc35f8720e4c..040f7b6adc39 100755 --- a/test/lint/lint-cppcheck-dash.py +++ b/test/lint/lint-cppcheck-dash.py @@ -33,27 +33,43 @@ # ".*", ) +# Lines that indicate cppcheck itself failed to analyze a translation unit. +# These must always fail the lint (regardless of which file they point at), +# otherwise analysis silently ends up vacuous. +FATAL_ERRORS = ( + "preprocessorErrorDirective", + "cppcheckError", + "internalError", + "Internal error", + "syntaxError", +) + SUPPRESSED_WARNINGS = ( "src/stacktraces.cpp:.*: .*: Parameter 'info' can be declared as pointer to const", - "src/stacktraces.cpp:.*: note: You might need to cast the function pointer here", - - # current version of cppcheck fails with this error if exhaustive level is used - # TODO: remove with a newer version - "warning: Internal error: Child process crashed with signal 6", - - # The following can be useful to ignore when the catch all is used - # "Consider performing initialization in initialization list.", - "Consider using std::transform algorithm instead of a raw loop.", - "Consider using std::accumulate algorithm instead of a raw loop.", - "Consider using std::any_of algorithm instead of a raw loop.", - "Consider using std::copy_if algorithm instead of a raw loop.", - # "Consider using std::count_if algorithm instead of a raw loop.", - # "Consider using std::find_if algorithm instead of a raw loop.", - # "Member variable '.*' is not initialized in the constructor.", "unusedFunction", "unknownMacro", "unusedStructMember", + + # Checks with pre-existing violations in the tree; suppressed wholesale so + # the linter can be enforced. TODO: burn these down and re-enable them + # one at a time. Note that any message matching ALWAYS_ENABLED_WARNINGS is + # still reported even if its check id is listed here. + "assertWithSideEffect", + "constParameterReference", + "constVariablePointer", + "constVariableReference", + "duplInheritedMember", + "functionStatic", + "knownConditionTrueFalse", + "missingOverride", + "returnByReference", + "shadowFunction", + "shadowMember", + "shadowVariable", + "uninitMemberVarNoCtor", + "useInitializationList", + "useStlAlgorithm", ) def main(): @@ -74,6 +90,7 @@ def main(): always_enabled_regexp = '|'.join(ALWAYS_ENABLED_WARNINGS) suppressed_regexp = '|'.join(SUPPRESSED_WARNINGS) + fatal_regexp = '|'.join(FATAL_ERRORS) files_regexp = '|'.join(re.escape(f) for f in files) script_dir = os.path.dirname(os.path.abspath(__file__)) @@ -96,6 +113,10 @@ def main(): '--template=gcc', '--check-level=exhaustive', '-D__cplusplus', + # Pretend to be GCC so that headers which require a known compiler + # (e.g. src/attributes.h) don't hit an #error directive, which would + # abort analysis of every translation unit that includes them. + '-D__GNUC__', '-DENABLE_WALLET', '-DCLIENT_VERSION_BUILD', '-DCLIENT_VERSION_IS_RELEASE', @@ -105,6 +126,10 @@ def main(): '-DDEBUG', '-DUSE_EPOLL', '-DCHAR_BIT=8', + # Function-like macro that cppcheck cannot evaluate on its own; leaving + # it undefined aborts analysis of Qt translation units with a fatal + # syntaxError ("failed to evaluate #if condition"). + '-DQT_VERSION_CHECK(major,minor,patch)=((major<<16)|(minor<<8)|(patch))', '-I', 'src/', '-q', ] + files @@ -118,11 +143,33 @@ def main(): unique_sorted_lines = sorted(set(dependencies_output.stdout.splitlines())) for line in unique_sorted_lines: + if re.search(fatal_regexp, line): + warnings.append(line) + continue + # 'note:' and source-context lines only make sense next to their parent + # warning; on their own (e.g. when the parent is suppressed) they are + # noise, and they don't carry the check id the suppressions match on. + # cppcheck's gcc template currently renders every non-error severity as + # 'warning:', but match the raw severities too in case that changes. + if not re.search(r' (?:error|warning|style|performance|portability): ', line): + continue if not re.search(files_regexp, line): continue if re.search(always_enabled_regexp, line) or not re.search(suppressed_regexp, line): warnings.append(line) + # Without --error-exitcode, diagnostics never make cppcheck return nonzero; + # any nonzero status (bad arguments, unloadable config, OOM kill, crash) + # means analysis did not complete and must not pass. + rc = dependencies_output.returncode + if rc != 0: + print(f"cppcheck exited with code {rc}") + if dependencies_output.stdout and not warnings: + # Show a short tail to aid CI debugging without flooding logs. + tail = dependencies_output.stdout.splitlines()[-50:] + print('\n'.join(tail)) + exit_code = 1 + if warnings: print('\n'.join(warnings)) print() From 81b33d360b44a32c4ac19876b85b8d6ecba50b1e Mon Sep 17 00:00:00 2001 From: pasta Date: Mon, 3 Aug 2026 15:24:53 -0500 Subject: [PATCH 03/17] lint: re-enable assertWithSideEffect cppcheck --- src/evo/specialtxman.cpp | 1 + test/lint/lint-cppcheck-dash.py | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/evo/specialtxman.cpp b/src/evo/specialtxman.cpp index 39917f755b9b..2321801829a4 100644 --- a/src/evo/specialtxman.cpp +++ b/src/evo/specialtxman.cpp @@ -293,6 +293,7 @@ bool CSpecialTxProcessor::RebuildListFromBlock(const CBlock& block, gsl::not_nul { // Verify that prevList either represents an empty/initial state (default-constructed), // or it matches the previous block's hash. + // cppcheck-suppress assertWithSideEffect assert(prevList == CDeterministicMNList() || prevList.GetBlockHash() == pindexPrev->GetBlockHash()); int nHeight = pindexPrev->nHeight + 1; diff --git a/test/lint/lint-cppcheck-dash.py b/test/lint/lint-cppcheck-dash.py index 040f7b6adc39..98f3d7e1c31a 100755 --- a/test/lint/lint-cppcheck-dash.py +++ b/test/lint/lint-cppcheck-dash.py @@ -55,7 +55,6 @@ # the linter can be enforced. TODO: burn these down and re-enable them # one at a time. Note that any message matching ALWAYS_ENABLED_WARNINGS is # still reported even if its check id is listed here. - "assertWithSideEffect", "constParameterReference", "constVariablePointer", "constVariableReference", From 9477b4d698440855406a40315df56558f85fe1f4 Mon Sep 17 00:00:00 2001 From: pasta Date: Mon, 3 Aug 2026 15:25:36 -0500 Subject: [PATCH 04/17] lint: re-enable constVariablePointer cppcheck --- src/rpc/quorums.cpp | 2 +- test/lint/lint-cppcheck-dash.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/rpc/quorums.cpp b/src/rpc/quorums.cpp index 633c4e642988..418a3435348f 100644 --- a/src/rpc/quorums.cpp +++ b/src/rpc/quorums.cpp @@ -1304,7 +1304,7 @@ static RPCHelpMan verifyislock() signHeight = pindexMined->nHeight; } - CBlockIndex* pBlockIndex{nullptr}; + const CBlockIndex* pBlockIndex{nullptr}; { LOCK(cs_main); if (signHeight == -1) { diff --git a/test/lint/lint-cppcheck-dash.py b/test/lint/lint-cppcheck-dash.py index 98f3d7e1c31a..e8b4d80a3006 100755 --- a/test/lint/lint-cppcheck-dash.py +++ b/test/lint/lint-cppcheck-dash.py @@ -56,7 +56,6 @@ # one at a time. Note that any message matching ALWAYS_ENABLED_WARNINGS is # still reported even if its check id is listed here. "constParameterReference", - "constVariablePointer", "constVariableReference", "duplInheritedMember", "functionStatic", From c85b5f9af49704591f222bfb8b033e90fe05595b Mon Sep 17 00:00:00 2001 From: pasta Date: Mon, 3 Aug 2026 15:26:01 -0500 Subject: [PATCH 05/17] lint: re-enable constVariableReference cppcheck --- src/governance/governance.cpp | 2 +- src/llmq/net_signing.cpp | 2 +- test/lint/lint-cppcheck-dash.py | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/governance/governance.cpp b/src/governance/governance.cpp index ea04abc07956..d70b7ba49827 100644 --- a/src/governance/governance.cpp +++ b/src/governance/governance.cpp @@ -1156,7 +1156,7 @@ void CGovernanceManager::RemoveInvalidVotes() if (removed.empty()) { continue; } - for (auto& voteHash : removed) { + for (const auto& voteHash : removed) { cmapVoteToObject.Erase(voteHash); cmapInvalidVotes.Erase(voteHash); cmmapOrphanVotes.Erase(voteHash); diff --git a/src/llmq/net_signing.cpp b/src/llmq/net_signing.cpp index bc02a8883f43..a2ed28b2929c 100644 --- a/src/llmq/net_signing.cpp +++ b/src/llmq/net_signing.cpp @@ -454,7 +454,7 @@ void NetSigning::ProcessPendingSigShares( } auto rec_sigs = m_shares_manager->ProcessPendingSigShares(v, quorums); - for (auto& rs : rec_sigs) { + for (const auto& rs : rec_sigs) { ProcessRecoveredSig(rs, true); } } diff --git a/test/lint/lint-cppcheck-dash.py b/test/lint/lint-cppcheck-dash.py index e8b4d80a3006..9375c62ef68f 100755 --- a/test/lint/lint-cppcheck-dash.py +++ b/test/lint/lint-cppcheck-dash.py @@ -56,7 +56,6 @@ # one at a time. Note that any message matching ALWAYS_ENABLED_WARNINGS is # still reported even if its check id is listed here. "constParameterReference", - "constVariableReference", "duplInheritedMember", "functionStatic", "knownConditionTrueFalse", From 47022ca5f37062909b223f3e899fe4e294b58e8e Mon Sep 17 00:00:00 2001 From: pasta Date: Mon, 3 Aug 2026 15:26:26 -0500 Subject: [PATCH 06/17] lint: re-enable returnByReference cppcheck --- src/coinjoin/client.h | 2 +- src/coinjoin/util.h | 2 +- test/lint/lint-cppcheck-dash.py | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/coinjoin/client.h b/src/coinjoin/client.h index dd1d5f62593b..405538da3234 100644 --- a/src/coinjoin/client.h +++ b/src/coinjoin/client.h @@ -52,7 +52,7 @@ class CPendingDsaRequest } [[nodiscard]] uint256 GetProTxHash() const { return proTxHash; } - [[nodiscard]] CCoinJoinAccept GetDSA() const { return dsa; } + [[nodiscard]] const CCoinJoinAccept& GetDSA() const { return dsa; } [[nodiscard]] bool IsExpired() const { return GetTime() - nTimeCreated > TIMEOUT; } friend bool operator==(const CPendingDsaRequest& a, const CPendingDsaRequest& b) diff --git a/src/coinjoin/util.h b/src/coinjoin/util.h index e927a4a3389f..353a0e33626f 100644 --- a/src/coinjoin/util.h +++ b/src/coinjoin/util.h @@ -59,7 +59,7 @@ class CTransactionBuilderOutput CTransactionBuilderOutput(CTransactionBuilderOutput&&) = delete; CTransactionBuilderOutput& operator=(CTransactionBuilderOutput&&) = delete; /// Get the scriptPubKey of this output - [[nodiscard]] CScript GetScript() const { return script; } + [[nodiscard]] const CScript& GetScript() const { return script; } /// Get the amount of this output [[nodiscard]] CAmount GetAmount() const { return nAmount; } /// Try update the amount of this output. Returns true if it was successful and false if not (e.g. insufficient amount left). diff --git a/test/lint/lint-cppcheck-dash.py b/test/lint/lint-cppcheck-dash.py index 9375c62ef68f..26ca21099209 100755 --- a/test/lint/lint-cppcheck-dash.py +++ b/test/lint/lint-cppcheck-dash.py @@ -60,7 +60,6 @@ "functionStatic", "knownConditionTrueFalse", "missingOverride", - "returnByReference", "shadowFunction", "shadowMember", "shadowVariable", From 964de2dd5e5994d53bda2c63621c644ac9619240 Mon Sep 17 00:00:00 2001 From: pasta Date: Mon, 3 Aug 2026 15:27:14 -0500 Subject: [PATCH 07/17] lint: re-enable useInitializationList cppcheck --- src/evo/simplifiedmns.cpp | 5 ++--- src/stats/client.cpp | 6 +++--- test/lint/lint-cppcheck-dash.py | 1 - 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/evo/simplifiedmns.cpp b/src/evo/simplifiedmns.cpp index da7d9f1ad97e..e3133dc63cdd 100644 --- a/src/evo/simplifiedmns.cpp +++ b/src/evo/simplifiedmns.cpp @@ -69,10 +69,9 @@ std::string CSimplifiedMNListEntry::ToString() const (nVersion >= ProTxVersion::ExtAddr ? "" : strprintf(", platformHTTPPort=%d", platformHTTPPort))); } -CSimplifiedMNList::CSimplifiedMNList(std::vector>&& smlEntries) +CSimplifiedMNList::CSimplifiedMNList(std::vector>&& smlEntries) : + mnList{std::move(smlEntries)} { - mnList = std::move(smlEntries); - std::sort(mnList.begin(), mnList.end(), [&](const std::unique_ptr& a, const std::unique_ptr& b) { return a->proRegTxHash.Compare(b->proRegTxHash) < 0; }); diff --git a/src/stats/client.cpp b/src/stats/client.cpp index 6fe4bd3e0c8d..42759e5463ab 100644 --- a/src/stats/client.cpp +++ b/src/stats/client.cpp @@ -217,12 +217,12 @@ util::Result> StatsdClient::make(const ArgsManager StatsdClientImpl::StatsdClientImpl(const std::string& host, uint16_t port, uint64_t batch_size, uint64_t interval_ms, const std::string& prefix, const std::string& suffix, std::optional& error) : + m_sender{std::make_unique(host, port, + std::make_pair(batch_size, static_cast(STATSD_MSG_DELIMITER)), + interval_ms, error)}, m_prefix{[prefix]() { return !prefix.empty() ? prefix + STATSD_NS_DELIMITER : prefix; }()}, m_suffix{[suffix]() { return !suffix.empty() ? STATSD_NS_DELIMITER + suffix : suffix; }()} { - m_sender = std::make_unique(host, port, - std::make_pair(batch_size, static_cast(STATSD_MSG_DELIMITER)), - interval_ms, error); if (error.has_value()) { m_sender.reset(); return; diff --git a/test/lint/lint-cppcheck-dash.py b/test/lint/lint-cppcheck-dash.py index 26ca21099209..c7e9945f9826 100755 --- a/test/lint/lint-cppcheck-dash.py +++ b/test/lint/lint-cppcheck-dash.py @@ -64,7 +64,6 @@ "shadowMember", "shadowVariable", "uninitMemberVarNoCtor", - "useInitializationList", "useStlAlgorithm", ) From 12c07115fe19bf6f83f89db5167318fb3a85f27e Mon Sep 17 00:00:00 2001 From: pasta Date: Mon, 3 Aug 2026 15:28:04 -0500 Subject: [PATCH 08/17] lint: re-enable shadowVariable cppcheck --- src/rpc/evo.cpp | 6 +++--- src/rpc/quorums.cpp | 4 ++-- test/lint/lint-cppcheck-dash.py | 1 - 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/rpc/evo.cpp b/src/rpc/evo.cpp index 9cf3d18d8037..46f99f038dc8 100644 --- a/src/rpc/evo.cpp +++ b/src/rpc/evo.cpp @@ -2180,7 +2180,7 @@ Span GetWalletEvoRPCCommands() } #endif // ENABLE_WALLET -void RegisterEvoRPCCommands(CRPCTable& tableRPC) +void RegisterEvoRPCCommands(CRPCTable& t) { static const CRPCCommand commands[]{ {"evo", &bls_help}, @@ -2197,7 +2197,7 @@ void RegisterEvoRPCCommands(CRPCTable& tableRPC) {"evo", &protx_info}, }; for (const auto& command : commands) { - tableRPC.appendCommand(command.name, &command); + t.appendCommand(command.name, &command); } // If we aren't compiling with wallet support, we still need to register RPCs that are // capable of working without wallet support. We have to do this even if wallet support @@ -2211,7 +2211,7 @@ void RegisterEvoRPCCommands(CRPCTable& tableRPC) #endif // ENABLE_WALLET ) { for (const auto& command : commands_wallet) { - tableRPC.appendCommand(command.name, &command); + t.appendCommand(command.name, &command); } } } diff --git a/src/rpc/quorums.cpp b/src/rpc/quorums.cpp index 418a3435348f..d6bf0220de1e 100644 --- a/src/rpc/quorums.cpp +++ b/src/rpc/quorums.cpp @@ -1388,7 +1388,7 @@ static RPCHelpMan submitchainlock() } -void RegisterQuorumsRPCCommands(CRPCTable &tableRPC) +void RegisterQuorumsRPCCommands(CRPCTable& t) { static const CRPCCommand commands[]{ {"evo", &quorum_help}, @@ -1413,6 +1413,6 @@ void RegisterQuorumsRPCCommands(CRPCTable &tableRPC) {"evo", &verifyislock}, }; for (const auto& command : commands) { - tableRPC.appendCommand(command.name, &command); + t.appendCommand(command.name, &command); } } diff --git a/test/lint/lint-cppcheck-dash.py b/test/lint/lint-cppcheck-dash.py index c7e9945f9826..f2d266160948 100755 --- a/test/lint/lint-cppcheck-dash.py +++ b/test/lint/lint-cppcheck-dash.py @@ -62,7 +62,6 @@ "missingOverride", "shadowFunction", "shadowMember", - "shadowVariable", "uninitMemberVarNoCtor", "useStlAlgorithm", ) From 64ce0384daa6866d18ee44e3fc75a7898862a7a9 Mon Sep 17 00:00:00 2001 From: pasta Date: Mon, 3 Aug 2026 15:29:13 -0500 Subject: [PATCH 09/17] lint: re-enable shadowMember cppcheck --- src/governance/superblock.cpp | 6 +++--- src/governance/superblock.h | 2 +- src/wallet/hdchain.cpp | 4 ++-- src/wallet/hdchain.h | 2 +- test/lint/lint-cppcheck-dash.py | 1 - 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/governance/superblock.cpp b/src/governance/superblock.cpp index 781596017055..744367d5b0b3 100644 --- a/src/governance/superblock.cpp +++ b/src/governance/superblock.cpp @@ -245,14 +245,14 @@ CAmount CSuperblock::GetPaymentsTotalAmount() * - Does this transaction match the superblock? */ -bool CSuperblock::IsValid(const CChain& active_chain, const CTransaction& txNew, int nBlockHeight, CAmount blockReward, bool is_v24) +bool CSuperblock::IsValid(const CChain& active_chain, const CTransaction& txNew, int block_height, CAmount blockReward, bool is_v24) { // TODO : LOCK(cs); // No reason for a lock here now since this method only accesses data // internal to *this and since CSuperblock's are accessed only through // shared pointers there's no way our object can get deleted while this // code is running. - if (!IsValidBlockHeight(nBlockHeight)) { + if (!IsValidBlockHeight(block_height)) { LogPrintf("CSuperblock::IsValid -- ERROR: Block invalid, incorrect block height\n"); return false; } @@ -279,7 +279,7 @@ bool CSuperblock::IsValid(const CChain& active_chain, const CTransaction& txNew, // payments should not exceed limit CAmount nPaymentsTotalAmount = GetPaymentsTotalAmount(); - CAmount nPaymentsLimit = GetPaymentsLimit(active_chain, nBlockHeight); + CAmount nPaymentsLimit = GetPaymentsLimit(active_chain, block_height); if (nPaymentsTotalAmount > nPaymentsLimit) { LogPrintf("CSuperblock::IsValid -- ERROR: Block invalid, payments limit exceeded: payments %lld, limit %lld\n", nPaymentsTotalAmount, nPaymentsLimit); return false; diff --git a/src/governance/superblock.h b/src/governance/superblock.h index b0204d8544d6..77c24f31c6bb 100644 --- a/src/governance/superblock.h +++ b/src/governance/superblock.h @@ -107,7 +107,7 @@ class CSuperblock : public CGovernanceObject bool GetPayment(int nPaymentIndex, CGovernancePayment& paymentRet); CAmount GetPaymentsTotalAmount(); - bool IsValid(const CChain& active_chain, const CTransaction& txNew, int nBlockHeight, CAmount blockReward, bool is_v24); + bool IsValid(const CChain& active_chain, const CTransaction& txNew, int block_height, CAmount blockReward, bool is_v24); bool IsExpired(int heightToTest) const; std::vector GetProposalHashes() const; diff --git a/src/wallet/hdchain.cpp b/src/wallet/hdchain.cpp index f781aaac075d..96c904c9b107 100644 --- a/src/wallet/hdchain.cpp +++ b/src/wallet/hdchain.cpp @@ -40,9 +40,9 @@ bool CHDChain::IsCrypted() const return fCrypted; } -bool CHDChain::SetMnemonic(const SecureVector& vchMnemonic, const SecureVector& vchMnemonicPassphrase, bool fUpdateID) +bool CHDChain::SetMnemonic(const SecureVector& mnemonic, const SecureVector& mnemonic_passphrase, bool fUpdateID) { - return SetMnemonic(SecureString(vchMnemonic.begin(), vchMnemonic.end()), SecureString(vchMnemonicPassphrase.begin(), vchMnemonicPassphrase.end()), fUpdateID); + return SetMnemonic(SecureString(mnemonic.begin(), mnemonic.end()), SecureString(mnemonic_passphrase.begin(), mnemonic_passphrase.end()), fUpdateID); } bool CHDChain::SetMnemonic(const SecureString& ssMnemonic, const SecureString& ssMnemonicPassphrase, bool fUpdateID) diff --git a/src/wallet/hdchain.h b/src/wallet/hdchain.h index 4a525a289a96..2c84e71abaac 100644 --- a/src/wallet/hdchain.h +++ b/src/wallet/hdchain.h @@ -95,7 +95,7 @@ class CHDChain void SetCrypted(bool fCryptedIn); bool IsCrypted() const; - bool SetMnemonic(const SecureVector& vchMnemonic, const SecureVector& vchMnemonicPassphrase, bool fUpdateID); + bool SetMnemonic(const SecureVector& mnemonic, const SecureVector& mnemonic_passphrase, bool fUpdateID); bool SetMnemonic(const SecureString& ssMnemonic, const SecureString& ssMnemonicPassphrase, bool fUpdateID); bool GetMnemonic(SecureVector& vchMnemonicRet, SecureVector& vchMnemonicPassphraseRet) const; bool GetMnemonic(SecureString& ssMnemonicRet, SecureString& ssMnemonicPassphraseRet) const; diff --git a/test/lint/lint-cppcheck-dash.py b/test/lint/lint-cppcheck-dash.py index f2d266160948..098ea3a2af70 100755 --- a/test/lint/lint-cppcheck-dash.py +++ b/test/lint/lint-cppcheck-dash.py @@ -61,7 +61,6 @@ "knownConditionTrueFalse", "missingOverride", "shadowFunction", - "shadowMember", "uninitMemberVarNoCtor", "useStlAlgorithm", ) From 8155ea72e71bd83c22315d8d86afc2d129ee1bdf Mon Sep 17 00:00:00 2001 From: pasta Date: Mon, 3 Aug 2026 15:34:02 -0500 Subject: [PATCH 10/17] lint: re-enable constParameterReference cppcheck --- src/active/context.cpp | 2 +- src/coinjoin/walletman.cpp | 2 +- src/evo/deterministicmns.cpp | 7 +++---- src/evo/deterministicmns.h | 6 +++--- src/evo/specialtxman.cpp | 2 +- src/evo/specialtxman.h | 2 +- src/governance/governance.cpp | 2 +- src/governance/governance.h | 3 +-- src/governance/signing.cpp | 5 ++--- src/governance/signing.h | 4 +--- src/init.cpp | 2 +- src/llmq/blockprocessor.cpp | 2 +- src/llmq/blockprocessor.h | 2 +- src/llmq/net_dkg.cpp | 4 ++-- src/llmq/net_quorum.cpp | 4 ++-- src/llmq/net_quorum.h | 4 ++-- src/llmq/quorums.h | 1 + src/llmq/utils.cpp | 8 ++++---- src/node/interfaces.cpp | 4 ++-- src/rpc/coinjoin.cpp | 2 +- src/rpc/evo.cpp | 8 ++++---- src/rpc/governance.cpp | 7 ++----- src/wallet/hdchain.cpp | 2 +- test/lint/lint-cppcheck-dash.py | 1 - 24 files changed, 39 insertions(+), 47 deletions(-) diff --git a/src/active/context.cpp b/src/active/context.cpp index a92c782c3b14..a28ac91f5f71 100644 --- a/src/active/context.cpp +++ b/src/active/context.cpp @@ -42,7 +42,7 @@ ActiveContext::ActiveContext(CBLSWorker& bls_worker, ChainstateManager& chainman dkgdbgman{std::make_unique(dmnman, qsnapman, chainman)}, qdkgsman{std::make_unique(dmnman, qsnapman, chainman, sporkman, db_params)}, shareman{std::make_unique(connman, chainman, sigman, *nodeman, qman, sporkman)}, - gov_signer{std::make_unique(connman, dmnman, govman, superblocks, *nodeman, chainman, mn_sync)}, + gov_signer{std::make_unique(dmnman, govman, superblocks, *nodeman, chainman, mn_sync)}, ehf_sighandler{std::make_unique(chainman, sigman, *shareman, qman)}, cl_signer{std::make_unique(chainman, chainlocks, clhandler, isman, qman, sigman, *shareman, mn_sync)}, diff --git a/src/coinjoin/walletman.cpp b/src/coinjoin/walletman.cpp index a4cf2881cc6c..dc774c18bf87 100644 --- a/src/coinjoin/walletman.cpp +++ b/src/coinjoin/walletman.cpp @@ -321,7 +321,7 @@ MessageProcessingResult CJWalletManagerImpl::ProcessDSQueue(NodeId from, CConnma dmn->proTxHash.ToString(), dsq.ToString()); ForAnyCJClientMan( - [&dsq](CCoinJoinClientManager& clientman) { return clientman.MarkAlreadyJoinedQueueAsTried(dsq); }); + [&dsq](const CCoinJoinClientManager& clientman) { return clientman.MarkAlreadyJoinedQueueAsTried(dsq); }); m_queueman->AddQueue(dsq); } diff --git a/src/evo/deterministicmns.cpp b/src/evo/deterministicmns.cpp index b25f4d01a514..0eed499ba976 100644 --- a/src/evo/deterministicmns.cpp +++ b/src/evo/deterministicmns.cpp @@ -1135,8 +1135,7 @@ bool CDeterministicMNManager::MigrateLegacyDiffs(const CBlockIndex* const tip_in } CDeterministicMNManager::RecalcDiffsResult CDeterministicMNManager::RecalculateAndRepairDiffs( - const CBlockIndex* start_index, const CBlockIndex* stop_index, ChainstateManager& chainman, - BuildListFromBlockFunc build_list_func, bool repair) + const CBlockIndex* start_index, const CBlockIndex* stop_index, BuildListFromBlockFunc build_list_func, bool repair) { RecalcDiffsResult result; result.start_height = start_index->nHeight; @@ -1237,7 +1236,7 @@ CDeterministicMNManager::RecalcDiffsResult CDeterministicMNManager::RecalculateA // Write repaired diffs to database if (repair) { - WriteRepairedDiffs(recalculated_diffs, result); + WriteRepairedDiffs(recalculated_diffs); } return result; @@ -1426,7 +1425,7 @@ std::vector> CDeterministicMNManage } void CDeterministicMNManager::WriteRepairedDiffs( - const std::vector>& recalculated_diffs, RecalcDiffsResult& result) + const std::vector>& recalculated_diffs) { AssertLockNotHeld(cs); diff --git a/src/evo/deterministicmns.h b/src/evo/deterministicmns.h index 2f38f0ceec4e..ed1a86e5ce49 100644 --- a/src/evo/deterministicmns.h +++ b/src/evo/deterministicmns.h @@ -805,7 +805,7 @@ class CDeterministicMNManager CDeterministicMNList& mnListRet)>; [[nodiscard]] RecalcDiffsResult RecalculateAndRepairDiffs(const CBlockIndex* start_index, - const CBlockIndex* stop_index, ChainstateManager& chainman, + const CBlockIndex* stop_index, BuildListFromBlockFunc build_list_func, bool repair) EXCLUSIVE_LOCKS_REQUIRED(!cs); [[nodiscard]] bool IsRepaired() const; @@ -828,7 +828,7 @@ class CDeterministicMNManager std::vector> RepairSnapshotPair( const CBlockIndex* from_index, const CBlockIndex* to_index, const CDeterministicMNList& from_snapshot, const CDeterministicMNList& to_snapshot, BuildListFromBlockFunc build_list_func, RecalcDiffsResult& result); - void WriteRepairedDiffs(const std::vector>& recalculated_diffs, - RecalcDiffsResult& result) EXCLUSIVE_LOCKS_REQUIRED(!cs); + void WriteRepairedDiffs(const std::vector>& recalculated_diffs) + EXCLUSIVE_LOCKS_REQUIRED(!cs); }; #endif // BITCOIN_EVO_DETERMINISTICMNS_H diff --git a/src/evo/specialtxman.cpp b/src/evo/specialtxman.cpp index 2321801829a4..0cb0f67c531f 100644 --- a/src/evo/specialtxman.cpp +++ b/src/evo/specialtxman.cpp @@ -884,7 +884,7 @@ bool CSpecialTxProcessor::ProcessSpecialTxsInBlock(Chainstate& chainstate, const return true; } -bool CSpecialTxProcessor::UndoSpecialTxsInBlock(Chainstate& chainstate, const CBlock& block, const CBlockIndex* pindex, std::optional& updatesRet) +bool CSpecialTxProcessor::UndoSpecialTxsInBlock(const Chainstate& chainstate, const CBlock& block, const CBlockIndex* pindex, std::optional& updatesRet) { AssertLockHeld(::cs_main); diff --git a/src/evo/specialtxman.h b/src/evo/specialtxman.h index 860e027a93de..b2e7a33ec62e 100644 --- a/src/evo/specialtxman.h +++ b/src/evo/specialtxman.h @@ -74,7 +74,7 @@ class CSpecialTxProcessor bool ProcessSpecialTxsInBlock(Chainstate& chainstate, const CBlock& block, const CBlockIndex* pindex, const CCoinsViewCache& view, bool fJustCheck, bool fCheckCbTxMerkleRoots, BlockValidationState& state, std::optional& updatesRet) EXCLUSIVE_LOCKS_REQUIRED(::cs_main); - bool UndoSpecialTxsInBlock(Chainstate& chainstate, const CBlock& block, const CBlockIndex* pindex, std::optional& updatesRet) + bool UndoSpecialTxsInBlock(const Chainstate& chainstate, const CBlock& block, const CBlockIndex* pindex, std::optional& updatesRet) EXCLUSIVE_LOCKS_REQUIRED(::cs_main); diff --git a/src/governance/governance.cpp b/src/governance/governance.cpp index d70b7ba49827..dd002fa0a046 100644 --- a/src/governance/governance.cpp +++ b/src/governance/governance.cpp @@ -786,7 +786,7 @@ bool CGovernanceManager::MasternodeRateCheck(const CGovernanceObject& govobj, bo return false; } -bool CGovernanceManager::ProcessVoteAndRelay(const CGovernanceVote& vote, CGovernanceException& exception, CConnman& connman) +bool CGovernanceManager::ProcessVoteAndRelay(const CGovernanceVote& vote, CGovernanceException& exception) { AssertLockNotHeld(cs_store); AssertLockNotHeld(cs_relay); diff --git a/src/governance/governance.h b/src/governance/governance.h index cca00d8cdb60..3c1d3e384d87 100644 --- a/src/governance/governance.h +++ b/src/governance/governance.h @@ -21,7 +21,6 @@ class CBloomFilter; class CBlockIndex; -class CConnman; class CDataStream; class CDeterministicMNList; class CDeterministicMNManager; @@ -313,7 +312,7 @@ class CGovernanceManager : public GovernanceStore */ bool ConfirmInventoryRequest(const CInv& inv) EXCLUSIVE_LOCKS_REQUIRED(!cs_store); - bool ProcessVoteAndRelay(const CGovernanceVote& vote, CGovernanceException& exception, CConnman& connman) + bool ProcessVoteAndRelay(const CGovernanceVote& vote, CGovernanceException& exception) EXCLUSIVE_LOCKS_REQUIRED(!cs_store, !cs_relay); void RelayObject(const CGovernanceObject& obj) EXCLUSIVE_LOCKS_REQUIRED(!cs_relay); diff --git a/src/governance/signing.cpp b/src/governance/signing.cpp index fb2b608e8161..425c109cf9a1 100644 --- a/src/governance/signing.cpp +++ b/src/governance/signing.cpp @@ -23,10 +23,9 @@ namespace { constexpr std::chrono::seconds GOVERNANCE_FUDGE_WINDOW{2h}; } // anonymous namespace -GovernanceSigner::GovernanceSigner(CConnman& connman, CDeterministicMNManager& dmnman, CGovernanceManager& govman, +GovernanceSigner::GovernanceSigner(CDeterministicMNManager& dmnman, CGovernanceManager& govman, governance::SuperblockManager& superblocks, const CActiveMasternodeManager& mn_activeman, const ChainstateManager& chainman, const CMasternodeSync& mn_sync) : - m_connman{connman}, m_dmnman{dmnman}, m_govman{govman}, m_superblocks{superblocks}, @@ -280,7 +279,7 @@ bool GovernanceSigner::VoteFundingTrigger(const uint256& nHash, const vote_outco vote.SetSignature(m_mn_activeman.SignBasic(vote.GetSignatureHash())); CGovernanceException exception; - if (!m_govman.ProcessVoteAndRelay(vote, exception, m_connman)) { + if (!m_govman.ProcessVoteAndRelay(vote, exception)) { LogPrint(BCLog::GOBJECT, "%s -- Vote FUNDING %d for trigger:%s failed:%s\n", __func__, outcome, nHash.ToString(), exception.what()); return false; diff --git a/src/governance/signing.h b/src/governance/signing.h index 8ad61a751b5e..a7f7ec8c1c17 100644 --- a/src/governance/signing.h +++ b/src/governance/signing.h @@ -16,7 +16,6 @@ class CActiveMasternodeManager; class CBlockIndex; -class CConnman; class CDeterministicMNManager; class CGovernanceManager; class ChainstateManager; @@ -29,7 +28,6 @@ class SuperblockManager; class GovernanceSigner { private: - CConnman& m_connman; CDeterministicMNManager& m_dmnman; CGovernanceManager& m_govman; governance::SuperblockManager& m_superblocks; @@ -44,7 +42,7 @@ class GovernanceSigner GovernanceSigner() = delete; GovernanceSigner(const GovernanceSigner&) = delete; GovernanceSigner& operator=(const GovernanceSigner&) = delete; - explicit GovernanceSigner(CConnman& connman, CDeterministicMNManager& dmnman, CGovernanceManager& govman, + explicit GovernanceSigner(CDeterministicMNManager& dmnman, CGovernanceManager& govman, governance::SuperblockManager& superblocks, const CActiveMasternodeManager& mn_activeman, const ChainstateManager& chainman, const CMasternodeSync& mn_sync); ~GovernanceSigner(); diff --git a/src/init.cpp b/src/init.cpp index 88e9c978254c..7bb5019fd4b4 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -2427,7 +2427,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info) CDeterministicMNList& mnListRet) -> bool { return node.chain_helper->special_tx->RebuildListFromBlock(block, pindexPrev, prevList, view, debugLogs, state, mnListRet); }; - auto result = node.dmnman->RecalculateAndRepairDiffs(start_index, stop_index, chainman, build_list_func, true); + auto result = node.dmnman->RecalculateAndRepairDiffs(start_index, stop_index, build_list_func, true); if (!result.verification_errors.empty()) { LogPrintf("WARNING: Verification errors:\n%s\n", Join(result.verification_errors, "\n")); diff --git a/src/llmq/blockprocessor.cpp b/src/llmq/blockprocessor.cpp index ce2d24057ea2..51cb55aa03e5 100644 --- a/src/llmq/blockprocessor.cpp +++ b/src/llmq/blockprocessor.cpp @@ -500,7 +500,7 @@ std::optional> CQuorumBlockProcessor::Get return std::make_pair(m_qc_hashes_cached, m_qc_indexed_hashes_cached); } -bool CQuorumBlockProcessor::UndoBlock(Chainstate& chainstate, const CBlock& block, gsl::not_null pindex) +bool CQuorumBlockProcessor::UndoBlock(const Chainstate& chainstate, const CBlock& block, gsl::not_null pindex) { AssertLockHeld(::cs_main); diff --git a/src/llmq/blockprocessor.h b/src/llmq/blockprocessor.h index 5b1430cec0ba..bb11cd67ba58 100644 --- a/src/llmq/blockprocessor.h +++ b/src/llmq/blockprocessor.h @@ -108,7 +108,7 @@ class CQuorumBlockProcessor bool ProcessBlock(Chainstate& chainstate, const CBlock& block, gsl::not_null pindex, BlockValidationState& state, bool fJustCheck, bool fBLSChecks) EXCLUSIVE_LOCKS_REQUIRED(::cs_main, !minableCommitmentsCs, !m_qc_hashes_cache_mutex); - bool UndoBlock(Chainstate& chainstate, const CBlock& block, gsl::not_null pindex) + bool UndoBlock(const Chainstate& chainstate, const CBlock& block, gsl::not_null pindex) EXCLUSIVE_LOCKS_REQUIRED(::cs_main, !minableCommitmentsCs, !m_qc_hashes_cache_mutex); //! it returns hash of commitment if it should be relay, otherwise nullopt diff --git a/src/llmq/net_dkg.cpp b/src/llmq/net_dkg.cpp index 5eddc10c1a9d..a75f9da8dd5b 100644 --- a/src/llmq/net_dkg.cpp +++ b/src/llmq/net_dkg.cpp @@ -544,7 +544,7 @@ bool NetDKG::AlreadyHave(const CInv& inv) case MSG_QUORUM_PREMATURE_COMMITMENT: { if (!IsQuorumDKGEnabled(m_sporkman)) return false; bool seen = false; - m_qdkgsman.ForEachHandler([&](CDKGSessionHandler& h) { + m_qdkgsman.ForEachHandler([&](const CDKGSessionHandler& h) { if (seen) return; if (h.pendingContributions.HasSeen(inv.hash) || h.pendingComplaints.HasSeen(inv.hash) || h.pendingJustifications.HasSeen(inv.hash) || h.pendingPrematureCommitments.HasSeen(inv.hash)) { @@ -652,7 +652,7 @@ void NetDKG::PhaseHandlerThread(ActiveDKGSessionHandler& handler) } static void AddQuorumProbeConnections(const Consensus::LLMQParams& llmqParams, CConnman& connman, - CMasternodeMetaMan& mn_metaman, const CSporkManager& sporkman, + const CMasternodeMetaMan& mn_metaman, const CSporkManager& sporkman, const UtilParameters& util_params, const CDeterministicMNList& tip_mn_list, const uint256& myProTxHash) { diff --git a/src/llmq/net_quorum.cpp b/src/llmq/net_quorum.cpp index c5a1c3320886..1727a8f90b0b 100644 --- a/src/llmq/net_quorum.cpp +++ b/src/llmq/net_quorum.cpp @@ -263,8 +263,8 @@ bool NetQuorum::ProcessContribQGETDATA(CDataStream& ssResponseData, const CQuoru return false; } -bool NetQuorum::ProcessContribQDATA(CNode& pfrom, CDataStream& vRecv, - CQuorum& quorum, CQuorumDataRequest& request) +bool NetQuorum::ProcessContribQDATA(const CNode& pfrom, CDataStream& vRecv, + CQuorum& quorum, const CQuorumDataRequest& request) { if (!(request.GetDataMask() & CQuorumDataRequest::ENCRYPTED_CONTRIBUTIONS)) { return true; diff --git a/src/llmq/net_quorum.h b/src/llmq/net_quorum.h index 4e5f91749b99..5ba27c69b379 100644 --- a/src/llmq/net_quorum.h +++ b/src/llmq/net_quorum.h @@ -95,8 +95,8 @@ class NetQuorum final : public NetHandler, public CValidationInterface bool ProcessContribQGETDATA(CDataStream& ssResponseData, const CQuorum& quorum, CQuorumDataRequest& request, gsl::not_null block_index) const; - bool ProcessContribQDATA(CNode& pfrom, CDataStream& vRecv, - CQuorum& quorum, CQuorumDataRequest& request); + bool ProcessContribQDATA(const CNode& pfrom, CDataStream& vRecv, + CQuorum& quorum, const CQuorumDataRequest& request); private: CBLSWorker& m_bls_worker; diff --git a/src/llmq/quorums.h b/src/llmq/quorums.h index 591048cc0ed1..2b28f80835ec 100644 --- a/src/llmq/quorums.h +++ b/src/llmq/quorums.h @@ -117,6 +117,7 @@ class CQuorumDataRequest SERIALIZE_METHODS(CQuorumDataRequest, obj) { bool fRead{false}; + // cppcheck-suppress constParameterReference SER_READ(obj, fRead = true); READWRITE(obj.llmqType, obj.quorumHash, obj.nDataMask, obj.proTxHash); if (fRead) { diff --git a/src/llmq/utils.cpp b/src/llmq/utils.cpp index 98f502e2d8c5..be172e2ee813 100644 --- a/src/llmq/utils.cpp +++ b/src/llmq/utils.cpp @@ -305,8 +305,8 @@ QuorumMembers ComputeQuorumMembers(Consensus::LLMQType llmqType, const CChainPar void BuildQuorumSnapshot(const Consensus::LLMQParams& llmqParams, const Consensus::Params& consensus_params, const CDeterministicMNList& allMns, const CDeterministicMNList& mnUsedAtH, - std::vector& sortedCombinedMns, llmq::CQuorumSnapshot& quorumSnapshot, - std::vector& skipList, const CBlockIndex* pCycleQuorumBaseBlockIndex) + llmq::CQuorumSnapshot& quorumSnapshot, std::vector& skipList, + const CBlockIndex* pCycleQuorumBaseBlockIndex) { if (!llmqParams.useRotation || pCycleQuorumBaseBlockIndex->nHeight % llmqParams.dkgInterval != 0) { ASSERT_IF_DEBUG(false); @@ -456,8 +456,8 @@ std::vector BuildNewQuorumQuarterMembers(const Consensus::LLMQPar if (storeSnapshot) { llmq::CQuorumSnapshot quorumSnapshot{}; - BuildQuorumSnapshot(llmqParams, util_params.m_chainman.GetConsensus(), allMns, MnsUsedAtH, sortedCombinedMnsList, - quorumSnapshot, skipList, util_params.m_base_index); + BuildQuorumSnapshot(llmqParams, util_params.m_chainman.GetConsensus(), allMns, MnsUsedAtH, quorumSnapshot, + skipList, util_params.m_base_index); util_params.m_qsnapman.StoreSnapshotForBlock(llmqParams.type, util_params.m_base_index, quorumSnapshot); } diff --git a/src/node/interfaces.cpp b/src/node/interfaces.cpp index f1f7aee2df96..6cae82a144a6 100644 --- a/src/node/interfaces.cpp +++ b/src/node/interfaces.cpp @@ -292,9 +292,9 @@ class GOVImpl : public GOV } bool processVoteAndRelay(const CGovernanceVote& vote, std::string& error) override { - if (context().govman != nullptr && context().connman != nullptr) { + if (context().govman != nullptr) { CGovernanceException exception; - bool result = context().govman->ProcessVoteAndRelay(vote, exception, *context().connman); + bool result = context().govman->ProcessVoteAndRelay(vote, exception); if (!result) { error = exception.GetMessage(); } diff --git a/src/rpc/coinjoin.cpp b/src/rpc/coinjoin.cpp index bdb91b1da51d..0a07229e9f6c 100644 --- a/src/rpc/coinjoin.cpp +++ b/src/rpc/coinjoin.cpp @@ -542,7 +542,7 @@ void RegisterCoinJoinRPCCommands(CRPCTable& t) #endif // ENABLE_WALLET ) { for (const auto& command : commands_wallet) { - tableRPC.appendCommand(command.name, &command); + t.appendCommand(command.name, &command); } } } diff --git a/src/rpc/evo.cpp b/src/rpc/evo.cpp index 46f99f038dc8..2ca9283a45bc 100644 --- a/src/rpc/evo.cpp +++ b/src/rpc/evo.cpp @@ -1449,7 +1449,7 @@ static bool CheckWalletOwnsKey(const CWallet* const pwallet, const CKeyID& keyID } #endif -static UniValue BuildDMNListEntry(const CWallet* const pwallet, const CDeterministicMN& dmn, CMasternodeMetaMan& mn_metaman, bool detailed, const ChainstateManager& chainman, const CBlockIndex* pindex = nullptr) +static UniValue BuildDMNListEntry(const CWallet* const pwallet, const CDeterministicMN& dmn, const CMasternodeMetaMan& mn_metaman, bool detailed, const ChainstateManager& chainman, const CBlockIndex* pindex = nullptr) { if (!detailed) { return dmn.proTxHash.ToString(); @@ -1538,7 +1538,7 @@ static RPCHelpMan protx_list() const ChainstateManager& chainman = EnsureChainman(node); CDeterministicMNManager& dmnman = *CHECK_NONFATAL(node.dmnman); - CMasternodeMetaMan& mn_metaman = *CHECK_NONFATAL(node.mn_metaman); + const CMasternodeMetaMan& mn_metaman = *CHECK_NONFATAL(node.mn_metaman); std::shared_ptr wallet{nullptr}; #ifdef ENABLE_WALLET @@ -1650,7 +1650,7 @@ static RPCHelpMan protx_info() const ChainstateManager& chainman = EnsureChainman(node); CDeterministicMNManager& dmnman = *CHECK_NONFATAL(node.dmnman); - CMasternodeMetaMan& mn_metaman = *CHECK_NONFATAL(node.mn_metaman); + const CMasternodeMetaMan& mn_metaman = *CHECK_NONFATAL(node.mn_metaman); std::shared_ptr wallet{nullptr}; #ifdef ENABLE_WALLET @@ -1913,7 +1913,7 @@ static UniValue evodb_verify_or_repair_impl(const JSONRPCRequest& request, bool }; // Call the dmnman method to do the work - auto recalc_result = dmnman.RecalculateAndRepairDiffs(start_index, stop_index, chainman, build_list_func, repair); + auto recalc_result = dmnman.RecalculateAndRepairDiffs(start_index, stop_index, build_list_func, repair); // Convert result to UniValue UniValue result(UniValue::VOBJ); diff --git a/src/rpc/governance.cpp b/src/rpc/governance.cpp index 76275aefa973..4a89e09ff3c7 100644 --- a/src/rpc/governance.cpp +++ b/src/rpc/governance.cpp @@ -466,8 +466,7 @@ static UniValue VoteWithMasternodes(const JSONRPCRequest& request, const CWallet } CGovernanceException exception; - CConnman& connman = EnsureConnman(node); - if (node.govman->ProcessVoteAndRelay(vote, exception, connman)) { + if (node.govman->ProcessVoteAndRelay(vote, exception)) { nSuccessful++; statusObj.pushKV("result", "success"); } else { @@ -932,10 +931,8 @@ static RPCHelpMan voteraw() throw JSONRPCError(RPC_INTERNAL_ERROR, "Failure to verify vote."); } - CConnman& connman = EnsureConnman(node); - CGovernanceException exception; - if (node.govman->ProcessVoteAndRelay(vote, exception, connman)) { + if (node.govman->ProcessVoteAndRelay(vote, exception)) { return "Voted successfully"; } else { throw JSONRPCError(RPC_INTERNAL_ERROR, "Error voting : " + exception.GetMessage()); diff --git a/src/wallet/hdchain.cpp b/src/wallet/hdchain.cpp index 96c904c9b107..7e10d07bade5 100644 --- a/src/wallet/hdchain.cpp +++ b/src/wallet/hdchain.cpp @@ -130,7 +130,7 @@ uint256 CHDChain::GetSeedHash() } //! Try to derive an extended key, throw if it fails. -static void DeriveExtKey(CExtKey& key_in, unsigned int index, CExtKey& key_out) +static void DeriveExtKey(const CExtKey& key_in, unsigned int index, CExtKey& key_out) { if (!key_in.Derive(key_out, index)) { throw std::runtime_error("Could not derive extended key"); diff --git a/test/lint/lint-cppcheck-dash.py b/test/lint/lint-cppcheck-dash.py index 098ea3a2af70..05998aa7050e 100755 --- a/test/lint/lint-cppcheck-dash.py +++ b/test/lint/lint-cppcheck-dash.py @@ -55,7 +55,6 @@ # the linter can be enforced. TODO: burn these down and re-enable them # one at a time. Note that any message matching ALWAYS_ENABLED_WARNINGS is # still reported even if its check id is listed here. - "constParameterReference", "duplInheritedMember", "functionStatic", "knownConditionTrueFalse", From 99162fadb14a599c97e135d4c7b349668ec91eef Mon Sep 17 00:00:00 2001 From: pasta Date: Mon, 3 Aug 2026 15:35:45 -0500 Subject: [PATCH 11/17] lint: re-enable missingOverride cppcheck --- src/active/context.h | 2 +- src/active/dkgsession.h | 2 +- src/active/dkgsessionhandler.h | 2 +- src/chainlock/signing.h | 2 +- src/coinjoin/client.h | 2 +- src/coinjoin/server.h | 2 +- src/evo/mnhftx.h | 2 +- src/instantsend/signing.h | 2 +- src/llmq/ehf_signals.h | 2 +- src/llmq/net_dkg.h | 2 +- src/llmq/observer.h | 2 +- src/qt/clientfeeds.h | 12 ++++++------ src/stats/client.cpp | 2 +- test/lint/lint-cppcheck-dash.py | 1 - 14 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/active/context.h b/src/active/context.h index ecff35a188cf..d7d45d8e15e2 100644 --- a/src/active/context.h +++ b/src/active/context.h @@ -66,7 +66,7 @@ struct ActiveContext final : public llmq::QuorumRole, public CValidationInterfac llmq::CQuorumManager& qman, llmq::CQuorumSnapshotManager& qsnapman, llmq::CSigningManager& sigman, const CMasternodeSync& mn_sync, const CBLSSecretKey& operator_sk, const util::DbWrapperParams& db_params, bool quorums_watch); - ~ActiveContext(); + ~ActiveContext() override; void Start(); void Stop(); diff --git a/src/active/dkgsession.h b/src/active/dkgsession.h index 48ca59dd7429..6ea2f71a510d 100644 --- a/src/active/dkgsession.h +++ b/src/active/dkgsession.h @@ -31,7 +31,7 @@ class ActiveDKGSession final : public llmq::CDKGSession const CActiveMasternodeManager& mn_activeman, const ChainstateManager& chainman, const CSporkManager& sporkman, const CBlockIndex* base_block_index, const Consensus::LLMQParams& params); - ~ActiveDKGSession(); + ~ActiveDKGSession() override; public: // Phase 1: contribution diff --git a/src/active/dkgsessionhandler.h b/src/active/dkgsessionhandler.h index 10f7af052ca4..d6684c74c6ba 100644 --- a/src/active/dkgsessionhandler.h +++ b/src/active/dkgsessionhandler.h @@ -77,7 +77,7 @@ class ActiveDKGSessionHandler final : public llmq::CDKGSessionHandler const CActiveMasternodeManager& mn_activeman, const ChainstateManager& chainman, const CSporkManager& sporkman, const Consensus::LLMQParams& llmq_params, bool quorums_watch, int quorums_idx); - ~ActiveDKGSessionHandler(); + ~ActiveDKGSessionHandler() override; public: //! CDKGSessionHandler diff --git a/src/chainlock/signing.h b/src/chainlock/signing.h index 8249ceb9a79a..b077026fe303 100644 --- a/src/chainlock/signing.h +++ b/src/chainlock/signing.h @@ -63,7 +63,7 @@ class ChainLockSigner final : public llmq::CRecoveredSigsListener, public CValid ChainlockHandler& clhandler, const llmq::CInstantSendManager& isman, const llmq::CQuorumManager& qman, llmq::CSigningManager& sigman, llmq::CSigSharesManager& shareman, const CMasternodeSync& mn_sync); - ~ChainLockSigner(); + ~ChainLockSigner() override; void Start(); void Stop(); diff --git a/src/coinjoin/client.h b/src/coinjoin/client.h index 405538da3234..30eaa0d9dbe4 100644 --- a/src/coinjoin/client.h +++ b/src/coinjoin/client.h @@ -214,7 +214,7 @@ class CCoinJoinClientManager : public interfaces::CoinJoin::Client explicit CCoinJoinClientManager(const std::shared_ptr& wallet, CDeterministicMNManager& dmnman, CMasternodeMetaMan& mn_metaman, const CMasternodeSync& mn_sync, const llmq::CInstantSendManager& isman, CoinJoinQueueManager* queueman); - ~CCoinJoinClientManager(); + ~CCoinJoinClientManager() override; void ProcessMessage(CNode& peer, Chainstate& active_chainstate, CConnman& connman, const CTxMemPool& mempool, std::string_view msg_type, CDataStream& vRecv) EXCLUSIVE_LOCKS_REQUIRED(!cs_deqsessions); diff --git a/src/coinjoin/server.h b/src/coinjoin/server.h index 6e148871b9d0..0c11576118fd 100644 --- a/src/coinjoin/server.h +++ b/src/coinjoin/server.h @@ -108,7 +108,7 @@ class CCoinJoinServer : public CCoinJoinBaseSession, public NetHandler CDeterministicMNManager& dmnman, CDSTXManager& dstxman, CMasternodeMetaMan& mn_metaman, CTxMemPool& mempool, const CActiveMasternodeManager& mn_activeman, const CMasternodeSync& mn_sync, const llmq::CInstantSendManager& isman); - ~CCoinJoinServer(); + ~CCoinJoinServer() override; void ProcessMessage(CNode& pfrom, const std::string& msg_type, CDataStream& vRecv) override; bool ProcessGetData(CNode& pfrom, const CInv& inv, const CNetMsgMaker& msgMaker) override; diff --git a/src/evo/mnhftx.h b/src/evo/mnhftx.h index 94d1bc1c2476..b5d721360d49 100644 --- a/src/evo/mnhftx.h +++ b/src/evo/mnhftx.h @@ -111,7 +111,7 @@ class CMNHFManager : public AbstractEHFManager CMNHFManager(const CMNHFManager&) = delete; CMNHFManager& operator=(const CMNHFManager&) = delete; explicit CMNHFManager(CEvoDB& evoDb, const ChainstateManager& chainman); - ~CMNHFManager(); + ~CMNHFManager() override; /** * Every new block should be processed when Tip() is updated by calling of CMNHFManager::ProcessBlock. diff --git a/src/instantsend/signing.h b/src/instantsend/signing.h index 9b413ed8f57b..18d1b083aed1 100644 --- a/src/instantsend/signing.h +++ b/src/instantsend/signing.h @@ -71,7 +71,7 @@ class InstantSendSigner final : public llmq::CRecoveredSigsListener llmq::CInstantSendManager& isman, llmq::CSigningManager& sigman, llmq::CSigSharesManager& shareman, llmq::CQuorumManager& qman, CSporkManager& sporkman, CTxMemPool& mempool, const CMasternodeSync& mn_sync); - ~InstantSendSigner(); + ~InstantSendSigner() override; void RegisterRecoveryInterface(); void UnregisterRecoveryInterface(); diff --git a/src/llmq/ehf_signals.h b/src/llmq/ehf_signals.h index e6247c0c21d8..12b7cb26f655 100644 --- a/src/llmq/ehf_signals.h +++ b/src/llmq/ehf_signals.h @@ -36,7 +36,7 @@ class CEHFSignalsHandler : public CRecoveredSigsListener explicit CEHFSignalsHandler(ChainstateManager& chainman, CSigningManager& sigman, CSigSharesManager& shareman, const CQuorumManager& qman); - ~CEHFSignalsHandler(); + ~CEHFSignalsHandler() override; /** * Since Tip is updated it could be a time to generate EHF Signal diff --git a/src/llmq/net_dkg.h b/src/llmq/net_dkg.h index 81019392400e..59ea5882c4e8 100644 --- a/src/llmq/net_dkg.h +++ b/src/llmq/net_dkg.h @@ -63,7 +63,7 @@ class NetDKG final : public NetHandler CDKGDebugManager& dkgdbgman, CQuorumBlockProcessor& qblockman, CQuorumSnapshotManager& qsnapman, const CActiveMasternodeManager& mn_activeman, CConnman& connman); - ~NetDKG(); + ~NetDKG() override; // NetHandler void ProcessMessage(CNode& pfrom, const std::string& msg_type, CDataStream& vRecv) override diff --git a/src/llmq/observer.h b/src/llmq/observer.h index d0fb60b2554e..edb7746f4d69 100644 --- a/src/llmq/observer.h +++ b/src/llmq/observer.h @@ -35,7 +35,7 @@ struct ObserverContext final : public QuorumRole, public CValidationInterface { ObserverContext(CDeterministicMNManager& dmnman, llmq::CQuorumManager& qman, llmq::CQuorumSnapshotManager& qsnapman, const ChainstateManager& chainman, const CSporkManager& sporkman, const util::DbWrapperParams& db_params); - ~ObserverContext(); + ~ObserverContext() override; // QuorumRole // Watch-only nodes are not masternodes diff --git a/src/qt/clientfeeds.h b/src/qt/clientfeeds.h index 50ab57480fea..75d1a24c6105 100644 --- a/src/qt/clientfeeds.h +++ b/src/qt/clientfeeds.h @@ -105,7 +105,7 @@ class ChainLockFeed : public Feed { public: explicit ChainLockFeed(QObject* parent, ClientModel& client_model); - ~ChainLockFeed(); + ~ChainLockFeed() override; void fetch() override; @@ -123,7 +123,7 @@ class CreditPoolFeed : public Feed { public: explicit CreditPoolFeed(QObject* parent, ClientModel& client_model); - ~CreditPoolFeed(); + ~CreditPoolFeed() override; void fetch() override; @@ -140,7 +140,7 @@ class InstantSendFeed : public Feed { public: explicit InstantSendFeed(QObject* parent, ClientModel& client_model); - ~InstantSendFeed(); + ~InstantSendFeed() override; void fetch() override; @@ -160,7 +160,7 @@ class MasternodeFeed : public Feed { public: explicit MasternodeFeed(QObject* parent, ClientModel& client_model); - ~MasternodeFeed(); + ~MasternodeFeed() override; void fetch() override; @@ -177,7 +177,7 @@ class QuorumFeed : public Feed { public: explicit QuorumFeed(QObject* parent, ClientModel& client_model); - ~QuorumFeed(); + ~QuorumFeed() override; void fetch() override; @@ -202,7 +202,7 @@ class ProposalFeed : public Feed { public: explicit ProposalFeed(QObject* parent, ClientModel& client_model, MasternodeFeed& feed_masternode); - ~ProposalFeed(); + ~ProposalFeed() override; void fetch() override; diff --git a/src/stats/client.cpp b/src/stats/client.cpp index 42759e5463ab..1f6a2dc41c46 100644 --- a/src/stats/client.cpp +++ b/src/stats/client.cpp @@ -45,7 +45,7 @@ class StatsdClientImpl final : public StatsdClient public: explicit StatsdClientImpl(const std::string& host, uint16_t port, uint64_t batch_size, uint64_t interval_ms, const std::string& prefix, const std::string& suffix, std::optional& error); - ~StatsdClientImpl() = default; + ~StatsdClientImpl() override = default; public: bool dec(std::string_view key, float sample_rate) override EXCLUSIVE_LOCKS_REQUIRED(!cs) diff --git a/test/lint/lint-cppcheck-dash.py b/test/lint/lint-cppcheck-dash.py index 05998aa7050e..eb048631e42e 100755 --- a/test/lint/lint-cppcheck-dash.py +++ b/test/lint/lint-cppcheck-dash.py @@ -58,7 +58,6 @@ "duplInheritedMember", "functionStatic", "knownConditionTrueFalse", - "missingOverride", "shadowFunction", "uninitMemberVarNoCtor", "useStlAlgorithm", From 7bbba5d3b18bde2ded02ac5fa926de84d09a0074 Mon Sep 17 00:00:00 2001 From: pasta Date: Mon, 3 Aug 2026 15:37:06 -0500 Subject: [PATCH 12/17] lint: re-enable knownConditionTrueFalse cppcheck --- src/governance/net_governance.cpp | 5 ----- src/index/timestampindex.cpp | 8 +++----- src/index/timestampindex.h | 4 ++-- src/rpc/blockchain.cpp | 4 +--- src/rpc/evo.cpp | 8 -------- src/stats/client.cpp | 1 + test/lint/lint-cppcheck-dash.py | 2 +- 7 files changed, 8 insertions(+), 24 deletions(-) diff --git a/src/governance/net_governance.cpp b/src/governance/net_governance.cpp index 8516d092748b..2e8b5da79140 100644 --- a/src/governance/net_governance.cpp +++ b/src/governance/net_governance.cpp @@ -175,11 +175,6 @@ void NetGovernance::ProcessMessage(CNode& peer, const std::string& msg_type, CDa uint256 nHash = govobj.GetHash(); - if (!m_node_sync.IsBlockchainSynced()) { - LogPrint(BCLog::GOBJECT, "MNGOVERNANCEOBJECT -- masternode list not synced\n"); - return; - } - std::string strHash = nHash.ToString(); LogPrint(BCLog::GOBJECT, "MNGOVERNANCEOBJECT -- Received object: %s\n", strHash); diff --git a/src/index/timestampindex.cpp b/src/index/timestampindex.cpp index aefbcc290f43..baff14da61fb 100644 --- a/src/index/timestampindex.cpp +++ b/src/index/timestampindex.cpp @@ -22,7 +22,7 @@ bool TimestampIndex::DB::Write(const CTimestampIndexKey& key) return CDBWrapper::Write(std::make_pair(DB_TIMESTAMPINDEX, key), true); } -bool TimestampIndex::DB::ReadRange(uint32_t high, uint32_t low, std::vector& hashes) +void TimestampIndex::DB::ReadRange(uint32_t high, uint32_t low, std::vector& hashes) { std::unique_ptr pcursor(NewIterator()); @@ -39,8 +39,6 @@ bool TimestampIndex::DB::ReadRange(uint32_t high, uint32_t low, std::vector& hashes) const +void TimestampIndex::GetBlockHashes(uint32_t high, uint32_t low, std::vector& hashes) const { - return m_db->ReadRange(high, low, hashes); + m_db->ReadRange(high, low, hashes); } diff --git a/src/index/timestampindex.h b/src/index/timestampindex.h index 76780b0753da..d24e58ebcd0b 100644 --- a/src/index/timestampindex.h +++ b/src/index/timestampindex.h @@ -34,7 +34,7 @@ class TimestampIndex final : public BaseIndex bool Write(const CTimestampIndexKey& key); /// Read timestamp index entries within the given range - bool ReadRange(uint32_t high, uint32_t low, std::vector& hashes); + void ReadRange(uint32_t high, uint32_t low, std::vector& hashes); /// Erase timestamp index entry bool EraseTimestampIndex(const CTimestampIndexKey& key); @@ -58,7 +58,7 @@ class TimestampIndex final : public BaseIndex virtual ~TimestampIndex() override; /// Retrieve block hashes within the given timestamp range [low, high] - bool GetBlockHashes(uint32_t high, uint32_t low, std::vector& hashes) const; + void GetBlockHashes(uint32_t high, uint32_t low, std::vector& hashes) const; }; #endif // BITCOIN_INDEX_TIMESTAMPINDEX_H diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index 7b02446efc9b..ee644d85e4fe 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -567,9 +567,7 @@ static RPCHelpMan getblockhashes() unsigned int low = request.params[1].getInt(); std::vector blockHashes; - if (!node.timestamp_index->GetBlockHashes(high, low, blockHashes)) { - throw JSONRPCError(RPC_MISC_ERROR, "Failed to read timestamp index."); - } + node.timestamp_index->GetBlockHashes(high, low, blockHashes); UniValue result(UniValue::VARR); for (const auto& hash : blockHashes) { diff --git a/src/rpc/evo.cpp b/src/rpc/evo.cpp index 2ca9283a45bc..0bc68f4f5da2 100644 --- a/src/rpc/evo.cpp +++ b/src/rpc/evo.cpp @@ -1804,14 +1804,6 @@ static RPCHelpMan protx_listdiff() const CBlockIndex* pBaseBlockIndex = ParseBlockIndex(request.params[0], chainman, "baseBlock"); const CBlockIndex* pTargetBlockIndex = ParseBlockIndex(request.params[1], chainman, "block"); - if (pBaseBlockIndex == nullptr) { - throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Base block not found"); - } - - if (pTargetBlockIndex == nullptr) { - throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found"); - } - ret.pushKV("baseHeight", pBaseBlockIndex->nHeight); ret.pushKV("blockHeight", pTargetBlockIndex->nHeight); diff --git a/src/stats/client.cpp b/src/stats/client.cpp index 1f6a2dc41c46..496b077c0d20 100644 --- a/src/stats/client.cpp +++ b/src/stats/client.cpp @@ -160,6 +160,7 @@ util::Result> StatsdClient::make(const ArgsManager return util::Error{_("No text before the scheme delimiter, malformed URL")}; } std::string scheme{ToLower(host.substr(/*pos=*/0, scheme_idx))}; + // cppcheck-suppress knownConditionTrueFalse if (scheme != "udp") { return util::Error{_("Unsupported URL scheme, must begin with udp://")}; } diff --git a/test/lint/lint-cppcheck-dash.py b/test/lint/lint-cppcheck-dash.py index eb048631e42e..9cb5dc6d0fbb 100755 --- a/test/lint/lint-cppcheck-dash.py +++ b/test/lint/lint-cppcheck-dash.py @@ -46,6 +46,7 @@ SUPPRESSED_WARNINGS = ( "src/stacktraces.cpp:.*: .*: Parameter 'info' can be declared as pointer to const", + "Return value 'state.(Invalid|Error).*' is always false.*knownConditionTrueFalse", "unusedFunction", "unknownMacro", @@ -57,7 +58,6 @@ # still reported even if its check id is listed here. "duplInheritedMember", "functionStatic", - "knownConditionTrueFalse", "shadowFunction", "uninitMemberVarNoCtor", "useStlAlgorithm", From 0bce8c39213a4ce9881d16263f888ec43e0383fd Mon Sep 17 00:00:00 2001 From: pasta Date: Mon, 3 Aug 2026 15:38:33 -0500 Subject: [PATCH 13/17] lint: re-enable functionStatic cppcheck --- src/bls/bls.h | 2 ++ src/bls/bls_worker.cpp | 6 +++--- src/evo/deterministicmns.h | 9 +++++---- src/evo/netinfo.cpp | 4 ++-- src/evo/netinfo.h | 5 +++-- src/index/addressindex_types.h | 8 ++++---- test/lint/lint-cppcheck-dash.py | 1 - 7 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/bls/bls.h b/src/bls/bls.h index c516065196ec..ae2124cd38e1 100644 --- a/src/bls/bls.h +++ b/src/bls/bls.h @@ -161,6 +161,7 @@ class CBLSWrapper return IsValid(); } + // cppcheck-suppress functionStatic inline void Serialize(CSizeComputer& s) const { s.seek(SerSize); @@ -435,6 +436,7 @@ class CBLSLazyWrapper return *this; } + // cppcheck-suppress functionStatic inline void Serialize(CSizeComputer& s) const { s.seek(BLSObject::SerSize); diff --git a/src/bls/bls_worker.cpp b/src/bls/bls_worker.cpp index 6a859b322569..df7914f64b11 100644 --- a/src/bls/bls_worker.cpp +++ b/src/bls/bls_worker.cpp @@ -155,8 +155,8 @@ struct Aggregator : public std::enable_shared_from_this> { } } - const T* pointer(const T& v) { return &v; } - const T* pointer(const T* v) { return v; } + static const T* pointer(const T& v) { return &v; } + static const T* pointer(const T* v) { return v; } // Starts aggregation. // If parallel=true, then this will return fast, otherwise this will block until aggregation is done @@ -297,7 +297,7 @@ struct Aggregator : public std::enable_shared_from_this> { } template - T SyncAggregate(Span vec, size_t start, size_t count) + static T SyncAggregate(Span vec, size_t start, size_t count) { T result = *vec[start]; for (size_t j = 1; j < count; j++) { diff --git a/src/evo/deterministicmns.h b/src/evo/deterministicmns.h index ed1a86e5ce49..b4a886f39eed 100644 --- a/src/evo/deterministicmns.h +++ b/src/evo/deterministicmns.h @@ -517,7 +517,7 @@ class CDeterministicMNList private: template - [[nodiscard]] uint256 GetUniquePropertyHash(const T& v) const + [[nodiscard]] static uint256 GetUniquePropertyHash(const T& v) { #define DMNL_NO_TEMPLATE(name) \ static_assert(!std::is_same_v, name>, "GetUniquePropertyHash cannot be templated against " #name) @@ -820,12 +820,13 @@ class CDeterministicMNManager CDeterministicMNList GetListForBlockInternal(gsl::not_null pindex) EXCLUSIVE_LOCKS_REQUIRED(cs); // Helper methods for RecalculateAndRepairDiffs - std::vector CollectSnapshotBlocks(const CBlockIndex* start_index, const CBlockIndex* stop_index, - const Consensus::Params& consensus_params); + static std::vector CollectSnapshotBlocks(const CBlockIndex* start_index, + const CBlockIndex* stop_index, + const Consensus::Params& consensus_params); bool VerifySnapshotPair(const CBlockIndex* from_index, const CBlockIndex* to_index, const CDeterministicMNList& from_snapshot, const CDeterministicMNList& to_snapshot, RecalcDiffsResult& result); - std::vector> RepairSnapshotPair( + static std::vector> RepairSnapshotPair( const CBlockIndex* from_index, const CBlockIndex* to_index, const CDeterministicMNList& from_snapshot, const CDeterministicMNList& to_snapshot, BuildListFromBlockFunc build_list_func, RecalcDiffsResult& result); void WriteRepairedDiffs(const std::vector>& recalculated_diffs) diff --git a/src/evo/netinfo.cpp b/src/evo/netinfo.cpp index d63366639b5c..bc73d244cbba 100644 --- a/src/evo/netinfo.cpp +++ b/src/evo/netinfo.cpp @@ -400,7 +400,7 @@ bool ExtNetInfo::IsAddrPortDuplicate(const NetInfoEntry& candidate) const [&candidate](const auto& entry) { return candidate == entry; }); } -bool ExtNetInfo::HasAddrDuplicates(const NetInfoList& entries) const +bool ExtNetInfo::HasAddrDuplicates(const NetInfoList& entries) { std::unordered_set known{}; for (const auto& entry : entries) { @@ -412,7 +412,7 @@ bool ExtNetInfo::HasAddrDuplicates(const NetInfoList& entries) const return false; } -bool ExtNetInfo::IsAddrDuplicate(const NetInfoEntry& candidate, const NetInfoList& entries) const +bool ExtNetInfo::IsAddrDuplicate(const NetInfoEntry& candidate, const NetInfoList& entries) { const std::string& candidate_str{candidate.ToStringAddr()}; return std::any_of(entries.begin(), entries.end(), diff --git a/src/evo/netinfo.h b/src/evo/netinfo.h index 9c75cd4376aa..d54195d2ec2e 100644 --- a/src/evo/netinfo.h +++ b/src/evo/netinfo.h @@ -325,6 +325,7 @@ class MnNetInfo final : public NetInfoInterface } } + // cppcheck-suppress functionStatic void Serialize(CSizeComputer& s) const { s.seek(::GetSerializeSize(CService{}, s.GetVersion())); @@ -375,10 +376,10 @@ class ExtNetInfo final : public NetInfoInterface bool IsAddrPortDuplicate(const NetInfoEntry& candidate) const; /** Returns true if there are addr duplicates within a given address list */ - bool HasAddrDuplicates(const NetInfoList& entries) const; + static bool HasAddrDuplicates(const NetInfoList& entries); /** Returns true if candidate is an addr duplicate within a given address list */ - bool IsAddrDuplicate(const NetInfoEntry& candidate, const NetInfoList& entries) const; + static bool IsAddrDuplicate(const NetInfoEntry& candidate, const NetInfoList& entries); /** Validate uniqueness requirements and add to object if passed */ NetInfoStatus ProcessCandidate(const NetInfoPurpose purpose, const NetInfoEntry& candidate); diff --git a/src/index/addressindex_types.h b/src/index/addressindex_types.h index 3d45c96ab14b..e22192a1956b 100644 --- a/src/index/addressindex_types.h +++ b/src/index/addressindex_types.h @@ -127,7 +127,7 @@ struct CAddressIndexKey { } public: - size_t GetSerializeSize(int nType, int nVersion) const { return 66; } + static size_t GetSerializeSize(int, int) { return 66; } template void Serialize(Stream& s) const @@ -174,7 +174,7 @@ struct CAddressIndexIteratorKey { } public: - size_t GetSerializeSize(int nType, int nVersion) const { return 21; } + static size_t GetSerializeSize(int, int) { return 21; } template void Serialize(Stream& s) const @@ -213,7 +213,7 @@ struct CAddressIndexIteratorHeightKey { } public: - size_t GetSerializeSize(int nType, int nVersion) const { return 25; } + static size_t GetSerializeSize(int, int) { return 25; } template void Serialize(Stream& s) const @@ -257,7 +257,7 @@ struct CAddressUnspentKey { } public: - size_t GetSerializeSize(int nType, int nVersion) const { return 57; } + static size_t GetSerializeSize(int, int) { return 57; } template void Serialize(Stream& s) const diff --git a/test/lint/lint-cppcheck-dash.py b/test/lint/lint-cppcheck-dash.py index 9cb5dc6d0fbb..4364c56b37be 100755 --- a/test/lint/lint-cppcheck-dash.py +++ b/test/lint/lint-cppcheck-dash.py @@ -57,7 +57,6 @@ # one at a time. Note that any message matching ALWAYS_ENABLED_WARNINGS is # still reported even if its check id is listed here. "duplInheritedMember", - "functionStatic", "shadowFunction", "uninitMemberVarNoCtor", "useStlAlgorithm", From ab62dfeb0a6400a56f935052d26dba769273df30 Mon Sep 17 00:00:00 2001 From: pasta Date: Mon, 3 Aug 2026 15:39:52 -0500 Subject: [PATCH 14/17] lint: re-enable shadowFunction cppcheck --- src/index/addressindex.cpp | 14 ++++++++------ src/index/addressindex.h | 5 +++-- src/qt/clientfeeds.h | 4 ++-- src/rpc/evo.cpp | 8 ++++---- src/rpc/node.cpp | 2 +- src/stats/client.cpp | 9 +++++---- src/util/ranges_set.cpp | 7 +++---- src/util/ranges_set.h | 2 +- test/lint/lint-cppcheck-dash.py | 2 +- 9 files changed, 28 insertions(+), 25 deletions(-) diff --git a/src/index/addressindex.cpp b/src/index/addressindex.cpp index fd6b21422b61..2943494bd9e6 100644 --- a/src/index/addressindex.cpp +++ b/src/index/addressindex.cpp @@ -47,12 +47,13 @@ bool AddressIndex::DB::WriteBatch(const std::vector& address } bool AddressIndex::DB::ReadAddressIndex(const uint160& address_hash, const AddressType type, - std::vector& entries, const int32_t start, const int32_t end) + std::vector& entries, const int32_t start_height, + const int32_t end_height) { std::unique_ptr pcursor(NewIterator()); - if (start > 0 && end > 0) { - pcursor->Seek(std::make_pair(DB_ADDRESSINDEX, CAddressIndexIteratorHeightKey(type, address_hash, start))); + if (start_height > 0 && end_height > 0) { + pcursor->Seek(std::make_pair(DB_ADDRESSINDEX, CAddressIndexIteratorHeightKey(type, address_hash, start_height))); } else { pcursor->Seek(std::make_pair(DB_ADDRESSINDEX, CAddressIndexIteratorKey(type, address_hash))); } @@ -61,7 +62,7 @@ bool AddressIndex::DB::ReadAddressIndex(const uint160& address_hash, const Addre std::pair key; if (pcursor->GetKey(key) && key.first == DB_ADDRESSINDEX && key.second.m_address_type == type && key.second.m_address_bytes == address_hash) { - if (end > 0 && key.second.m_block_height > end) { + if (end_height > 0 && key.second.m_block_height > end_height) { break; } CAmount value; @@ -399,9 +400,10 @@ bool AddressIndex::CustomRewind(const interfaces::BlockKey& current_tip, const i BaseIndex::DB& AddressIndex::GetDB() const { return *m_db; } bool AddressIndex::GetAddressIndex(const uint160& address_hash, const AddressType type, - std::vector& entries, const int32_t start, const int32_t end) const + std::vector& entries, const int32_t start_height, + const int32_t end_height) const { - return m_db->ReadAddressIndex(address_hash, type, entries, start, end); + return m_db->ReadAddressIndex(address_hash, type, entries, start_height, end_height); } bool AddressIndex::GetAddressUnspentIndex(const uint160& address_hash, const AddressType type, diff --git a/src/index/addressindex.h b/src/index/addressindex.h index e3d4eaf78c92..06497faba7cf 100644 --- a/src/index/addressindex.h +++ b/src/index/addressindex.h @@ -41,7 +41,8 @@ class AddressIndex final : public BaseIndex /// Read address transaction history bool ReadAddressIndex(const uint160& address_hash, const AddressType type, - std::vector& entries, const int32_t start = 0, const int32_t end = 0); + std::vector& entries, const int32_t start_height = 0, + const int32_t end_height = 0); /// Read address unspent outputs bool ReadAddressUnspentIndex(const uint160& address_hash, const AddressType type, @@ -78,7 +79,7 @@ class AddressIndex final : public BaseIndex /// Query address transaction history bool GetAddressIndex(const uint160& address_hash, const AddressType type, std::vector& entries, - const int32_t start = 0, const int32_t end = 0) const; + const int32_t start_height = 0, const int32_t end_height = 0) const; /// Query address unspent outputs bool GetAddressUnspentIndex(const uint160& address_hash, const AddressType type, diff --git a/src/qt/clientfeeds.h b/src/qt/clientfeeds.h index 75d1a24c6105..2667f42cbc25 100644 --- a/src/qt/clientfeeds.h +++ b/src/qt/clientfeeds.h @@ -83,10 +83,10 @@ class Feed : public FeedBase void fetch() override EXCLUSIVE_LOCKS_REQUIRED(!m_cs) = 0; protected: - void setData(std::shared_ptr data) EXCLUSIVE_LOCKS_REQUIRED(!m_cs) + void setData(std::shared_ptr feed_data) EXCLUSIVE_LOCKS_REQUIRED(!m_cs) { LOCK(m_cs); - m_data = std::move(data); + m_data = std::move(feed_data); } private: diff --git a/src/rpc/evo.cpp b/src/rpc/evo.cpp index 0bc68f4f5da2..6e61e43b8929 100644 --- a/src/rpc/evo.cpp +++ b/src/rpc/evo.cpp @@ -1911,8 +1911,8 @@ static UniValue evodb_verify_or_repair_impl(const JSONRPCRequest& request, bool UniValue result(UniValue::VOBJ); UniValue verification_errors(UniValue::VARR); - for (const auto& error : recalc_result.verification_errors) { - verification_errors.push_back(error); + for (const auto& verification_error : recalc_result.verification_errors) { + verification_errors.push_back(verification_error); } result.pushKV("startHeight", recalc_result.start_height); @@ -1924,8 +1924,8 @@ static UniValue evodb_verify_or_repair_impl(const JSONRPCRequest& request, bool // Only include repair errors if we're in repair mode if (repair) { UniValue repair_errors(UniValue::VARR); - for (const auto& error : recalc_result.repair_errors) { - repair_errors.push_back(error); + for (const auto& repair_error : recalc_result.repair_errors) { + repair_errors.push_back(repair_error); } result.pushKV("repairErrors", repair_errors); } diff --git a/src/rpc/node.cpp b/src/rpc/node.cpp index 30f6b25ac1e5..8c9000857b89 100644 --- a/src/rpc/node.cpp +++ b/src/rpc/node.cpp @@ -677,7 +677,7 @@ static RPCHelpMan getaddressbalance() LOCK(::cs_main); for (const auto& address : addresses) { if (!node.address_index->GetAddressIndex(address.first, address.second, addressIndex, - /*start=*/0, /*end=*/0)) { + /*start_height=*/0, /*end_height=*/0)) { throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "No information available for address"); } } diff --git a/src/stats/client.cpp b/src/stats/client.cpp index 496b077c0d20..8b1394494f44 100644 --- a/src/stats/client.cpp +++ b/src/stats/client.cpp @@ -44,7 +44,8 @@ class StatsdClientImpl final : public StatsdClient { public: explicit StatsdClientImpl(const std::string& host, uint16_t port, uint64_t batch_size, uint64_t interval_ms, - const std::string& prefix, const std::string& suffix, std::optional& error); + const std::string& prefix, const std::string& suffix, + std::optional& error_out); ~StatsdClientImpl() override = default; public: @@ -217,14 +218,14 @@ util::Result> StatsdClient::make(const ArgsManager StatsdClientImpl::StatsdClientImpl(const std::string& host, uint16_t port, uint64_t batch_size, uint64_t interval_ms, const std::string& prefix, const std::string& suffix, - std::optional& error) : + std::optional& error_out) : m_sender{std::make_unique(host, port, std::make_pair(batch_size, static_cast(STATSD_MSG_DELIMITER)), - interval_ms, error)}, + interval_ms, error_out)}, m_prefix{[prefix]() { return !prefix.empty() ? prefix + STATSD_NS_DELIMITER : prefix; }()}, m_suffix{[suffix]() { return !suffix.empty() ? STATSD_NS_DELIMITER + suffix : suffix; }()} { - if (error.has_value()) { + if (error_out.has_value()) { m_sender.reset(); return; } diff --git a/src/util/ranges_set.cpp b/src/util/ranges_set.cpp index 6ad79b76fead..11b7863a17f8 100644 --- a/src/util/ranges_set.cpp +++ b/src/util/ranges_set.cpp @@ -6,9 +6,9 @@ CRangesSet::Range::Range() : CRangesSet::Range::Range(0, 0) {} -CRangesSet::Range::Range(uint64_t begin, uint64_t end) : - begin(begin), - end(end) +CRangesSet::Range::Range(uint64_t begin_in, uint64_t end_in) : + begin(begin_in), + end(end_in) { } @@ -95,4 +95,3 @@ bool CRangesSet::Contains(uint64_t value) const noexcept --prev; return prev->begin <= value && prev->end > value; } - diff --git a/src/util/ranges_set.h b/src/util/ranges_set.h index 242fc7f42833..d67be4919056 100644 --- a/src/util/ranges_set.h +++ b/src/util/ranges_set.h @@ -30,7 +30,7 @@ class CRangesSet uint64_t begin; uint64_t end; Range(); - Range(uint64_t begin, uint64_t end); + Range(uint64_t begin_in, uint64_t end_in); bool operator<(const Range& other) const { if (begin != other.begin) return begin < other.begin; diff --git a/test/lint/lint-cppcheck-dash.py b/test/lint/lint-cppcheck-dash.py index 4364c56b37be..87eb1ac30564 100755 --- a/test/lint/lint-cppcheck-dash.py +++ b/test/lint/lint-cppcheck-dash.py @@ -47,6 +47,7 @@ SUPPRESSED_WARNINGS = ( "src/stacktraces.cpp:.*: .*: Parameter 'info' can be declared as pointer to const", "Return value 'state.(Invalid|Error).*' is always false.*knownConditionTrueFalse", + "Local variable '_' shadows outer function.*shadowFunction", "unusedFunction", "unknownMacro", @@ -57,7 +58,6 @@ # one at a time. Note that any message matching ALWAYS_ENABLED_WARNINGS is # still reported even if its check id is listed here. "duplInheritedMember", - "shadowFunction", "uninitMemberVarNoCtor", "useStlAlgorithm", ) From 9303de404915521177af7e5d1e71717b3f8c1a16 Mon Sep 17 00:00:00 2001 From: pasta Date: Mon, 3 Aug 2026 15:41:48 -0500 Subject: [PATCH 15/17] lint: re-enable uninitMemberVarNoCtor cppcheck --- src/bls/bls_worker.cpp | 4 ++-- src/evo/dmn_types.h | 4 ++-- src/instantsend/instantsend.h | 4 ++-- src/llmq/dkgmessages.h | 6 +++--- src/llmq/dkgsessionmgr.h | 2 +- src/llmq/params.h | 28 ++++++++++++++-------------- src/llmq/signing_shares.h | 2 +- src/llmq/snapshot.h | 2 +- src/qt/donutchart.h | 4 ++-- src/test/evo_netinfo_tests.cpp | 4 ++-- src/util/std23.h | 2 +- test/lint/lint-cppcheck-dash.py | 3 ++- 12 files changed, 33 insertions(+), 32 deletions(-) diff --git a/src/bls/bls_worker.cpp b/src/bls/bls_worker.cpp index df7914f64b11..2505bdcab827 100644 --- a/src/bls/bls_worker.cpp +++ b/src/bls/bls_worker.cpp @@ -382,8 +382,8 @@ struct VectorAggregator : public std::enable_shared_from_this { struct BatchState { - size_t start; - size_t count; + size_t start{0}; + size_t count{0}; BLSVerificationVectorPtr vvec; CBLSSecretKey skShare; diff --git a/src/evo/dmn_types.h b/src/evo/dmn_types.h index bdf79e84c4f1..4ba6efee8a6a 100644 --- a/src/evo/dmn_types.h +++ b/src/evo/dmn_types.h @@ -24,8 +24,8 @@ namespace dmn_types { struct mntype_struct { - const int32_t voting_weight; - const CAmount collat_amount; + const int32_t voting_weight{0}; + const CAmount collat_amount{0}; const std::string_view description; }; diff --git a/src/instantsend/instantsend.h b/src/instantsend/instantsend.h index 58b669d3a5ec..5e901cb82662 100644 --- a/src/instantsend/instantsend.h +++ b/src/instantsend/instantsend.h @@ -32,7 +32,7 @@ typedef std::shared_ptr CTransactionRef; namespace instantsend { struct PendingISLockFromPeer { - NodeId node_id; + NodeId node_id{0}; InstantSendLockPtr islock; }; @@ -71,7 +71,7 @@ class CInstantSendManager // TXs which are neither IS locked nor ChainLocked. We use this to determine for which TXs we need to retry IS // locking of child TXs struct NonLockedTxInfo { - const CBlockIndex* pindexMined; + const CBlockIndex* pindexMined{nullptr}; CTransactionRef tx; Uint256HashSet children; }; diff --git a/src/llmq/dkgmessages.h b/src/llmq/dkgmessages.h index 177b68e5d4d4..7b19647677cf 100644 --- a/src/llmq/dkgmessages.h +++ b/src/llmq/dkgmessages.h @@ -20,7 +20,7 @@ namespace llmq { class CDKGContribution { public: - Consensus::LLMQType llmqType; + Consensus::LLMQType llmqType{Consensus::LLMQType::LLMQ_NONE}; uint256 quorumHash; uint256 proTxHash; BLSVerificationVectorPtr vvec; @@ -107,11 +107,11 @@ class CDKGComplaint class CDKGJustification { public: - Consensus::LLMQType llmqType; + Consensus::LLMQType llmqType{Consensus::LLMQType::LLMQ_NONE}; uint256 quorumHash; uint256 proTxHash; struct Contribution { - uint32_t index; + uint32_t index{0}; CBLSSecretKey key; SERIALIZE_METHODS(Contribution, obj) { diff --git a/src/llmq/dkgsessionmgr.h b/src/llmq/dkgsessionmgr.h index ecbb8478a28d..cf1cdfa52d1e 100644 --- a/src/llmq/dkgsessionmgr.h +++ b/src/llmq/dkgsessionmgr.h @@ -65,7 +65,7 @@ class CDKGSessionManager mutable Mutex contributionsCacheCs; struct ContributionsCacheKey { - Consensus::LLMQType llmqType; + Consensus::LLMQType llmqType{Consensus::LLMQType::LLMQ_NONE}; uint256 quorumHash; uint256 proTxHash; bool operator<(const ContributionsCacheKey& r) const diff --git a/src/llmq/params.h b/src/llmq/params.h index eaa2c05ad09d..2c975d828cb8 100644 --- a/src/llmq/params.h +++ b/src/llmq/params.h @@ -48,44 +48,44 @@ enum class LLMQType : uint8_t { // Configures a LLMQ and its DKG // See https://github.com/dashpay/dips/blob/master/dip-0006.md for more details struct LLMQParams { - LLMQType type; + LLMQType type{LLMQType::LLMQ_NONE}; // not consensus critical, only used in logging, RPC and UI std::string_view name; // Whether this is a DIP0024 quorum or not - bool useRotation; + bool useRotation{false}; // the size of the quorum, e.g. 50 or 400 - int size; + int size{0}; // The minimum number of valid members after the DKG. If less members are determined valid, no commitment can be // created. Should be higher then the threshold to allow some room for failing nodes, otherwise quorum might end up // not being able to ever created a recovered signature if more nodes fail after the DKG - int minSize; + int minSize{0}; // The threshold required to recover a final signature. Should be at least 50%+1 of the quorum size. This value // also controls the size of the public key verification vector and has a large influence on the performance of // recovery. It also influences the amount of minimum messages that need to be exchanged for a single signing session. // This value has the most influence on the security of the quorum. The number of total malicious masternodes // required to negatively influence signing sessions highly correlates to the threshold percentage. - int threshold; + int threshold{0}; // The interval in number blocks for DKGs and the creation of LLMQs. If set to 24 for example, a DKG will start // every 24 blocks, which is approximately once every hour. - int dkgInterval; + int dkgInterval{0}; // The number of blocks per phase in a DKG session. There are 6 phases plus the mining phase that need to be processed // per DKG. Set this value to a number of blocks so that each phase has enough time to propagate all required // messages to all members before the next phase starts. If blocks are produced too fast, whole DKG sessions will // fail. - int dkgPhaseBlocks; + int dkgPhaseBlocks{0}; // The starting block inside the DKG interval for when mining of commitments starts. The value is inclusive. // Starting from this block, the inclusion of (possibly null) commitments is enforced until the first non-null // commitment is mined. The chosen value should be at least 5 * dkgPhaseBlocks so that it starts right after the // finalization phase. - int dkgMiningWindowStart; + int dkgMiningWindowStart{0}; // The ending block inside the DKG interval for when mining of commitments ends. The value is inclusive. // Choose a value so that miners have enough time to receive the commitment and mine it. Also take into consideration @@ -93,31 +93,31 @@ struct LLMQParams { // be large enough so that other miners have a chance to produce a block containing a non-null commitment. The window // should at the same time not be too large so that not too much space is wasted with null commitments in case a DKG // session failed. - int dkgMiningWindowEnd; + int dkgMiningWindowEnd{0}; // In the complaint phase, members will vote on other members being bad (missing valid contribution). If at least // dkgBadVotesThreshold have voted for another member to be bad, it will considered to be bad by all other members // as well. This serves as a protection against late-comers who send their contribution on the bring of // phase-transition, which would otherwise result in inconsistent views of the valid members set - int dkgBadVotesThreshold; + int dkgBadVotesThreshold{0}; // Number of quorums to consider "active" for signing sessions - int signingActiveQuorumCount; + int signingActiveQuorumCount{0}; // Used for intra-quorum communication. This is the number of quorums for which we should keep old connections. // For non-rotated quorums it should be at least one more than the active quorums set. // For rotated quorums it should be equal to 2 x active quorums set. - int keepOldConnections; + int keepOldConnections{0}; // The number of quorums for which we should keep keys. Usually it's equal to signingActiveQuorumCount * 2. // Unlike for other quorum types we want to keep data (secret key shares and vvec) // for Platform quorums for much longer because Platform can be restarted and // it must be able to re-sign stuff. - int keepOldKeys; + int keepOldKeys{0}; // How many members should we try to send all sigShares to before we give up. - int recoveryMembers; + int recoveryMembers{0}; public: [[nodiscard]] constexpr int max_cycles(int quorums_count) const { diff --git a/src/llmq/signing_shares.h b/src/llmq/signing_shares.h index 5b00e7ae0e5b..d7337084bc46 100644 --- a/src/llmq/signing_shares.h +++ b/src/llmq/signing_shares.h @@ -382,7 +382,7 @@ class CSigSharesNodeState uint32_t recvSessionId{UNINITIALIZED_SESSION_ID}; uint32_t sendSessionId{UNINITIALIZED_SESSION_ID}; - Consensus::LLMQType llmqType; + Consensus::LLMQType llmqType{Consensus::LLMQType::LLMQ_NONE}; uint256 quorumHash; uint256 id; uint256 msgHash; diff --git a/src/llmq/snapshot.h b/src/llmq/snapshot.h index 6877366f2e6d..7691dbf19286 100644 --- a/src/llmq/snapshot.h +++ b/src/llmq/snapshot.h @@ -94,7 +94,7 @@ class CGetQuorumRotationInfo public: std::vector baseBlockHashes; uint256 blockRequestHash; - bool extraShare; + bool extraShare{false}; SERIALIZE_METHODS(CGetQuorumRotationInfo, obj) { diff --git a/src/qt/donutchart.h b/src/qt/donutchart.h index 4ac5085122f7..7f1e4966b44b 100644 --- a/src/qt/donutchart.h +++ b/src/qt/donutchart.h @@ -44,8 +44,8 @@ class DonutChart : public QWidget private: struct Geometry { - int m_inner_radius; - int m_outer_radius; + int m_inner_radius{0}; + int m_outer_radius{0}; QPoint m_center; }; diff --git a/src/test/evo_netinfo_tests.cpp b/src/test/evo_netinfo_tests.cpp index 4455456ac9a2..5c690e5f117d 100644 --- a/src/test/evo_netinfo_tests.cpp +++ b/src/test/evo_netinfo_tests.cpp @@ -19,8 +19,8 @@ BOOST_FIXTURE_TEST_SUITE(evo_netinfo_tests, BasicTestingSetup) struct TestEntry { std::pair input; - NetInfoStatus expected_ret_mn; - NetInfoStatus expected_ret_ext; + NetInfoStatus expected_ret_mn{NetInfoStatus::BadInput}; + NetInfoStatus expected_ret_ext{NetInfoStatus::BadInput}; }; static const std::vector addr_vals_main{ diff --git a/src/util/std23.h b/src/util/std23.h index 879fd7c3c93e..942d18e75236 100644 --- a/src/util/std23.h +++ b/src/util/std23.h @@ -95,7 +95,7 @@ template Date: Fri, 7 Aug 2026 23:34:28 -0500 Subject: [PATCH 16/17] fix(rpc): bind temporary RPCResult to local variable in ListObjectsHelp Avoid dangling reference in C++20 by binding the temporary RPCResult returned by CGovernanceObject::GetVotesJsonHelp to a named local variable before iterating over m_inner. --- src/rpc/governance.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/rpc/governance.cpp b/src/rpc/governance.cpp index 4a89e09ff3c7..308252cca82d 100644 --- a/src/rpc/governance.cpp +++ b/src/rpc/governance.cpp @@ -658,9 +658,8 @@ static RPCResult ListObjectsHelp() { auto ret = CGovernanceObject::GetStateJsonHelp(/*key=*/"", /*optional=*/false, /*local_valid_key=*/"fBlockchainValidity"); auto mod_inner = ret.m_inner; - for (const auto& result : CGovernanceObject::GetVotesJsonHelp(/*key=*/"", /*optional=*/false).m_inner) { - // The range expression's temporary is lifetime-extended for the whole loop - // cppcheck-suppress danglingTempReference + const auto votes_help = CGovernanceObject::GetVotesJsonHelp(/*key=*/"", /*optional=*/false); + for (const auto& result : votes_help.m_inner) { mod_inner.push_back(result); } return RPCResult{ret.m_type, ret.m_key_name, ret.m_description, mod_inner}; From dc99412a0ae88e826d7d37bfc402ce53fa9a94ab Mon Sep 17 00:00:00 2001 From: pasta Date: Sat, 8 Aug 2026 10:45:47 -0500 Subject: [PATCH 17/17] fix(lint): define QT_CONFIG macro in lint-cppcheck-dash Define QT_CONFIG(x)=0 so cppcheck doesn't hit a fatal syntaxError when analyzing Qt translation units that include uic-generated headers (e.g. ui_masternodelist.h) in built working trees. --- test/lint/lint-cppcheck-dash.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/lint/lint-cppcheck-dash.py b/test/lint/lint-cppcheck-dash.py index df0c15c766dd..cd0dbdc8cb79 100755 --- a/test/lint/lint-cppcheck-dash.py +++ b/test/lint/lint-cppcheck-dash.py @@ -117,10 +117,11 @@ def main(): '-DDEBUG', '-DUSE_EPOLL', '-DCHAR_BIT=8', - # Function-like macro that cppcheck cannot evaluate on its own; leaving - # it undefined aborts analysis of Qt translation units with a fatal + # Function-like macros that cppcheck cannot evaluate on its own; leaving + # them undefined aborts analysis of Qt translation units with a fatal # syntaxError ("failed to evaluate #if condition"). '-DQT_VERSION_CHECK(major,minor,patch)=((major<<16)|(minor<<8)|(patch))', + '-DQT_CONFIG(x)=0', '-I', 'src/', '-q', ] + files