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/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/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.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/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/bls/bls.h b/src/bls/bls.h index 02a3bbefa5bf..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); @@ -234,6 +235,7 @@ class CBLSWrapper struct CBLSIdImplicit : public uint256 { CBLSIdImplicit() = default; + // cppcheck-suppress noExplicitConstructor CBLSIdImplicit(const uint256& id) { memcpy(begin(), id.begin(), sizeof(uint256)); @@ -434,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..2505bdcab827 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++) { @@ -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/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/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 dd1d5f62593b..30eaa0d9dbe4 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) @@ -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/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/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/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/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..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) @@ -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; @@ -820,15 +820,16 @@ 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, - 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/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/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/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/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/evo/specialtxman.cpp b/src/evo/specialtxman.cpp index 1925f16060d8..0cb0f67c531f 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; @@ -699,9 +700,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 +807,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 @@ -882,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 ea04abc07956..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); @@ -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/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/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/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/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/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/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/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/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/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/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/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/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/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.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_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/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/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/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/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/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/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/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/llmq/utils.cpp b/src/llmq/utils.cpp index 7155a1a98dce..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); } @@ -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/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/qt/clientfeeds.h b/src/qt/clientfeeds.h index 50ab57480fea..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: @@ -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/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/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/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 308cbe0ce267..6e61e43b8929 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); @@ -1450,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(); @@ -1539,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 @@ -1651,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 @@ -1805,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); @@ -1914,14 +1905,14 @@ 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); 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); @@ -1933,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); } @@ -2181,7 +2172,7 @@ Span GetWalletEvoRPCCommands() } #endif // ENABLE_WALLET -void RegisterEvoRPCCommands(CRPCTable& tableRPC) +void RegisterEvoRPCCommands(CRPCTable& t) { static const CRPCCommand commands[]{ {"evo", &bls_help}, @@ -2198,7 +2189,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 @@ -2212,7 +2203,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/governance.cpp b/src/rpc/governance.cpp index aaa45d061f8f..308252cca82d 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 { @@ -659,7 +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) { + 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}; @@ -930,10 +930,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/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/rpc/quorums.cpp b/src/rpc/quorums.cpp index 633c4e642988..d6bf0220de1e 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) { @@ -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/src/stats/client.cpp b/src/stats/client.cpp index 6fe4bd3e0c8d..8b1394494f44 100644 --- a/src/stats/client.cpp +++ b/src/stats/client.cpp @@ -44,8 +44,9 @@ 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; + const std::string& prefix, const std::string& suffix, + std::optional& error_out); + ~StatsdClientImpl() override = default; public: bool dec(std::string_view key, float sample_rate) override EXCLUSIVE_LOCKS_REQUIRED(!cs) @@ -160,6 +161,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://")}; } @@ -216,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_out)}, 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()) { + if (error_out.has_value()) { m_sender.reset(); return; } 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/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/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