Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/semantic-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
build
guix
ci
lint
chore
revert
trivial
Expand Down
1 change: 1 addition & 0 deletions src/.clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ readability-redundant-string-init,
CheckOptions:
- key: performance-move-const-arg.CheckTriviallyCopyableMove
value: false
HeaderFilterRegex: '.'
2 changes: 1 addition & 1 deletion src/active/dkgsessionhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ static void RelayInvToParticipants(const CDKGSession& session, const CConnman& c
"HasMasternodeQuorumNodes[%d] for quorumHash[%s] forMember[%s] relayMembers[%s]",
inv.ToString(), relayMembers.size(), connman.GetNodeCount(ConnectionDirection::Both),
connman.GetNetworkActive(),
connman.HasMasternodeQuorumNodes(session.GetParams().type, session.BlockIndex()->GetBlockHash()),
connman.HasMasternodeQuorumNodes(session.GetType(), session.BlockIndex()->GetBlockHash()),
session.BlockIndex()->GetBlockHash().ToString(), session.ProTx().ToString().substr(0, 4), ss.str());

std::stringstream ss2;
Expand Down
3 changes: 1 addition & 2 deletions src/bls/bls.h
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ class CBLSLazyWrapper
private:
mutable std::mutex mutex;

mutable std::array<uint8_t, BLSObject::SerSize> vecBytes;
mutable std::array<uint8_t, BLSObject::SerSize> vecBytes{};

mutable BLSObject obj;
mutable bool objInitialized{false};
Expand All @@ -403,7 +403,6 @@ class CBLSLazyWrapper

public:
CBLSLazyWrapper() :
vecBytes{},
bufLegacyScheme(bls::bls_legacy_scheme.load())
{}

Expand Down
2 changes: 1 addition & 1 deletion src/chain.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ static constexpr int64_t TIMESTAMP_WINDOW = MAX_FUTURE_BLOCK_TIME;
*/
static constexpr int64_t MAX_BLOCK_TIME_GAP = 25 * 60;

extern RecursiveMutex cs_main;
extern RecursiveMutex cs_main; // NOLINT(readability-redundant-declaration)

class CBlockFileInfo
{
Expand Down
2 changes: 1 addition & 1 deletion src/coinjoin/coinjoin.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class CChainLocksHandler;
class CInstantSendManager;
} // namespace llmq

extern RecursiveMutex cs_main;
extern RecursiveMutex cs_main; // NOLINT(readability-redundant-declaration)

// timeouts
static constexpr int COINJOIN_AUTO_TIMEOUT_MIN = 5;
Expand Down
2 changes: 1 addition & 1 deletion src/crypto/ripemd160.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ void Transform(uint32_t* s, const unsigned char* chunk)

////// RIPEMD160

CRIPEMD160::CRIPEMD160() : bytes(0)
CRIPEMD160::CRIPEMD160()
{
ripemd160::Initialize(s);
}
Expand Down
2 changes: 1 addition & 1 deletion src/crypto/ripemd160.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class CRIPEMD160
private:
uint32_t s[5];
unsigned char buf[64];
uint64_t bytes;
uint64_t bytes{0};

public:
static const size_t OUTPUT_SIZE = 20;
Expand Down
2 changes: 1 addition & 1 deletion src/crypto/sha1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ void Transform(uint32_t* s, const unsigned char* chunk)

////// SHA1

CSHA1::CSHA1() : bytes(0)
CSHA1::CSHA1()
{
sha1::Initialize(s);
}
Expand Down
2 changes: 1 addition & 1 deletion src/crypto/sha1.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class CSHA1
private:
uint32_t s[5];
unsigned char buf[64];
uint64_t bytes;
uint64_t bytes{0};

public:
static const size_t OUTPUT_SIZE = 20;
Expand Down
2 changes: 1 addition & 1 deletion src/crypto/sha256.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ std::string SHA256AutoDetect(sha256_implementation::UseImplementation use_implem

////// SHA-256

CSHA256::CSHA256() : bytes(0)
CSHA256::CSHA256()
{
sha256::Initialize(s);
}
Expand Down
2 changes: 1 addition & 1 deletion src/crypto/sha256.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class CSHA256
private:
uint32_t s[8];
unsigned char buf[64];
uint64_t bytes;
uint64_t bytes{0};

public:
static const size_t OUTPUT_SIZE = 32;
Expand Down
2 changes: 1 addition & 1 deletion src/crypto/sha512.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ void Transform(uint64_t* s, const unsigned char* chunk)

////// SHA-512

CSHA512::CSHA512() : bytes(0)
CSHA512::CSHA512()
{
sha512::Initialize(s);
}
Expand Down
2 changes: 1 addition & 1 deletion src/crypto/sha512.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class CSHA512
private:
uint64_t s[8];
unsigned char buf[128];
uint64_t bytes;
uint64_t bytes{0};

public:
static constexpr size_t OUTPUT_SIZE = 64;
Expand Down
11 changes: 5 additions & 6 deletions src/cuckoocache.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class cache
std::vector<Element> table;

/** size stores the total available slots in the hash table */
uint32_t size;
uint32_t size{0};

/** The bit_packed_atomic_flags array is marked mutable because we want
* garbage collection to be allowed to occur from const methods */
Expand All @@ -181,7 +181,7 @@ class cache
* decremented on insert and reset to the new number of inserts which would
* cause the epoch to reach epoch_size when it reaches zero.
*/
uint32_t epoch_heuristic_counter;
uint32_t epoch_heuristic_counter{0};

/** epoch_size is set to be the number of elements supposed to be in a
* epoch. When the number of non-erased elements in an epoch
Expand All @@ -191,12 +191,12 @@ class cache
* one "dead" which has been erased, one "dying" which has been marked to be
* erased next, and one "living" which new inserts add to.
*/
uint32_t epoch_size;
uint32_t epoch_size{0};

/** depth_limit determines how many elements insert should try to replace.
* Should be set to log2(n).
*/
uint8_t depth_limit;
uint8_t depth_limit{0};

/** hash_function is a const instance of the hash function. It cannot be
* static or initialized at call time as it may have internal state (such as
Expand Down Expand Up @@ -320,8 +320,7 @@ class cache
/** You must always construct a cache with some elements via a subsequent
* call to setup or setup_bytes, otherwise operations may segfault.
*/
cache() : table(), size(), collection_flags(0), epoch_flags(),
epoch_heuristic_counter(), epoch_size(), depth_limit(0), hash_function()
cache() : table(), collection_flags(0), epoch_flags(), hash_function()
{
}

Expand Down
15 changes: 6 additions & 9 deletions src/cxxtimer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,20 +118,17 @@ class Timer {
typename duration_t::rep count() const;

private:

bool started_;
bool paused_;
std::chrono::steady_clock::time_point reference_;
std::chrono::duration<long double> accumulated_;
bool started_{false};
bool paused_{false};
std::chrono::steady_clock::time_point reference_{std::chrono::steady_clock::now()};
std::chrono::duration<long double> accumulated_{std::chrono::duration<long double>(0)};
};

}


inline cxxtimer::Timer::Timer(bool start) :
started_(false), paused_(false),
reference_(std::chrono::steady_clock::now()),
accumulated_(std::chrono::duration<long double>(0)) {
inline cxxtimer::Timer::Timer(bool start)
{
if (start) {
this->start();
}
Expand Down
4 changes: 2 additions & 2 deletions src/dbwrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ class CDBBatch
CDataStream ssKey;
CDataStream ssValue;

size_t size_estimate;
size_t size_estimate{0};

public:
/**
* @param[in] _parent CDBWrapper that this batch is to be submitted to
*/
explicit CDBBatch(const CDBWrapper &_parent) : parent(_parent), ssKey(SER_DISK, CLIENT_VERSION), ssValue(SER_DISK, CLIENT_VERSION), size_estimate(0) { };
explicit CDBBatch(const CDBWrapper& _parent) : parent(_parent), ssKey(SER_DISK, CLIENT_VERSION), ssValue(SER_DISK, CLIENT_VERSION) {};

void Clear()
{
Expand Down
2 changes: 1 addition & 1 deletion src/evo/deterministicmns.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class CSpecialTxProcessor;
class TxValidationState;
struct RPCResult;

extern RecursiveMutex cs_main;
extern RecursiveMutex cs_main; // NOLINT(readability-redundant-declaration)

class CDeterministicMN
{
Expand Down
2 changes: 1 addition & 1 deletion src/evo/dmn_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ constexpr auto Invalid = mntype_struct{

} // namespace dmn_types

[[nodiscard]] constexpr const dmn_types::mntype_struct GetMnType(MnType type)
[[nodiscard]] constexpr dmn_types::mntype_struct GetMnType(MnType type)
{
switch (type) {
case MnType::Regular: return dmn_types::Regular;
Expand Down
2 changes: 1 addition & 1 deletion src/evo/mnhftx.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class MNHFTx
SERIALIZE_METHODS(MNHFTx, obj)
{
READWRITE(obj.versionBit, obj.quorumHash);
READWRITE(CBLSSignatureVersionWrapper(const_cast<CBLSSignature&>(obj.sig), /* fLegacy= */ false));
READWRITE(CBLSSignatureVersionWrapper(const_cast<CBLSSignature&>(obj.sig), /*legacy=*/false));
}

std::string ToString() const;
Expand Down
2 changes: 1 addition & 1 deletion src/evo/smldiff.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class CQuorumBlockProcessor;
class CQuorumManager;
} // namespace llmq

extern RecursiveMutex cs_main;
extern RecursiveMutex cs_main; // NOLINT(readability-redundant-declaration)

/// P2P messages

Expand Down
2 changes: 1 addition & 1 deletion src/evo/specialtxman.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class CQuorumManager;
class CQuorumSnapshotManager;
} // namespace llmq

extern RecursiveMutex cs_main;
extern RecursiveMutex cs_main; // NOLINT(readability-redundant-declaration)

class CSpecialTxProcessor
{
Expand Down
2 changes: 1 addition & 1 deletion src/governance/classes.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class CSuperblock : public CGovernanceObject
return nBlockHeight;
}

const uint256 GetGovernanceObjHash() const { return nGovObjHash; }
uint256 GetGovernanceObjHash() const { return nGovObjHash; }

int CountPayments() const { return (int)vecPayments.size(); }
bool GetPayment(int nPaymentIndex, CGovernancePayment& paymentRet);
Expand Down
15 changes: 5 additions & 10 deletions src/governance/governance.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,25 +52,20 @@ using vote_time_pair_t = std::pair<CGovernanceVote, int64_t>;
static constexpr int RATE_BUFFER_SIZE = 5;
static constexpr bool DEFAULT_GOVERNANCE_ENABLE{true};

extern RecursiveMutex cs_main;
extern RecursiveMutex cs_main; // NOLINT(readability-redundant-declaration)

class CRateCheckBuffer
{
private:
std::vector<int64_t> vecTimestamps;

int nDataStart;

int nDataEnd;

bool fBufferEmpty;
int nDataStart{0};
int nDataEnd{0};
bool fBufferEmpty{true};

public:
CRateCheckBuffer() :
vecTimestamps(RATE_BUFFER_SIZE),
nDataStart(0),
nDataEnd(0),
fBufferEmpty(true)
vecTimestamps(RATE_BUFFER_SIZE)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/governance/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ChainstateManager;
class CMasternodeMetaMan;
struct RPCResult;

extern RecursiveMutex cs_main;
extern RecursiveMutex cs_main; // NOLINT(readability-redundant-declaration)

static constexpr double GOVERNANCE_FILTER_FP_RATE = 0.001;
static constexpr CAmount GOVERNANCE_PROPOSAL_FEE_TX = (1 * COIN);
Expand Down
1 change: 0 additions & 1 deletion src/governance/validators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const size_t MAX_NAME_SIZE = 40;

CProposalValidator::CProposalValidator(const std::string& strHexData, bool fAllowScript) :
objJSON(UniValue::VOBJ),
fJSONValid(false),
fAllowScript(fAllowScript),
strErrorMessages()
{
Expand Down
2 changes: 1 addition & 1 deletion src/governance/validators.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class CProposalValidator
{
private:
UniValue objJSON;
bool fJSONValid;
bool fJSONValid{false};
bool fAllowScript;
std::string strErrorMessages;

Expand Down
1 change: 0 additions & 1 deletion src/governance/votedb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include <governance/votedb.h>

CGovernanceObjectVoteFile::CGovernanceObjectVoteFile() :
nMemoryVotes(0),
listVotes(),
mapVoteIndex()
{
Expand Down
2 changes: 1 addition & 1 deletion src/governance/votedb.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class CGovernanceObjectVoteFile
using vote_m_t = std::map<uint256, vote_l_t::iterator>;

private:
int nMemoryVotes;
int nMemoryVotes{0};

vote_l_t listVotes;

Expand Down
6 changes: 3 additions & 3 deletions src/key.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ class CKey
private:
//! Whether this private key is valid. We check for correctness when modifying the key
//! data, so fValid should always correspond to the actual state.
bool fValid;
bool fValid{false};

//! Whether the public key corresponding to this private key is (to be) compressed.
bool fCompressed;
bool fCompressed{false};

//! The actual byte data
std::vector<unsigned char, secure_allocator<unsigned char> > keydata;
Expand All @@ -61,7 +61,7 @@ class CKey

public:
//! Construct an invalid private key.
CKey() : fValid(false), fCompressed(false)
CKey()
{
// Important: vch must be 32 bytes in length to not break serialization
keydata.resize(32);
Expand Down
2 changes: 1 addition & 1 deletion src/llmq/blockprocessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class CDeterministicMNManager;
class CEvoDB;
class CNode;

extern RecursiveMutex cs_main;
extern RecursiveMutex cs_main; // NOLINT(readability-redundant-declaration)

namespace llmq
{
Expand Down
2 changes: 1 addition & 1 deletion src/llmq/dkgsession.h
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ class CDKGSession
[[nodiscard]] const Uint256HashSet& RelayMembers() const { return relayMembers; }
[[nodiscard]] const CBlockIndex* BlockIndex() const { return m_quorum_base_block_index; }
[[nodiscard]] const uint256& ProTx() const { return myProTxHash; }
[[nodiscard]] const Consensus::LLMQParams GetParams() const { return params; }
[[nodiscard]] Consensus::LLMQType GetType() const { return params.type; }

protected:
virtual bool MaybeDecrypt(const CBLSIESMultiRecipientObjects<CBLSSecretKey>& obj, size_t idx,
Expand Down
2 changes: 1 addition & 1 deletion src/masternode/meta.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class MasternodeMetaStore
std::vector<uint256> tmpUsedMasternodes;
s >> tmpMetaInfo >> nDsqCount >> tmpUsedMasternodes;
for (auto& mm : tmpMetaInfo) {
metaInfos.emplace(mm.m_protx_hash, CMasternodeMetaInfo{std::move(mm)});
metaInfos.emplace(mm.m_protx_hash, CMasternodeMetaInfo{mm});
}

// Convert vector to deque and build unordered_set for O(1) lookups
Expand Down
Loading
Loading