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
2 changes: 2 additions & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ BITCOIN_CORE_H = \
evo/specialtx.h \
evo/specialtx_filter.h \
evo/specialtxman.h \
evo/types.h \
dsnotificationinterface.h \
governance/governance.h \
governance/classes.h \
Expand Down Expand Up @@ -259,6 +260,7 @@ BITCOIN_CORE_H = \
llmq/signing.h \
llmq/signing_shares.h \
llmq/snapshot.h \
llmq/types.h \
llmq/utils.h \
logging.h \
logging/timer.h \
Expand Down
6 changes: 2 additions & 4 deletions src/coinjoin/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
#ifndef BITCOIN_COINJOIN_CLIENT_H
#define BITCOIN_COINJOIN_CLIENT_H

#include <coinjoin/util.h>
#include <coinjoin/coinjoin.h>
#include <coinjoin/util.h>
#include <evo/types.h>

#include <net_types.h>
#include <protocol.h>
Expand All @@ -21,7 +22,6 @@
class CCoinJoinClientManager;
class CCoinJoinClientQueueManager;
class CConnman;
class CDeterministicMN;
class CDeterministicMNManager;
class ChainstateManager;
class CMasternodeMetaMan;
Expand All @@ -33,8 +33,6 @@ class PeerManager;

class UniValue;

using CDeterministicMNCPtr = std::shared_ptr<const CDeterministicMN>;

class CPendingDsaRequest
{
private:
Expand Down
9 changes: 5 additions & 4 deletions src/evo/deterministicmns.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,19 @@

#include <evo/dmnstate.h>

#include <evo/dmn_types.h>
#include <evo/providertx.h>
#include <evo/types.h>

#include <arith_uint256.h>
#include <clientversion.h>
#include <consensus/params.h>
#include <crypto/common.h>
#include <evo/dmn_types.h>
#include <evo/providertx.h>
#include <gsl/pointers.h>
#include <saltedhasher.h>
#include <scheduler.h>
#include <sync.h>

#include <gsl/pointers.h>
#include <immer/map.hpp>

#include <atomic>
Expand Down Expand Up @@ -85,7 +87,6 @@ class CDeterministicMN
[[nodiscard]] std::string ToString() const;
[[nodiscard]] UniValue ToJson() const;
};
using CDeterministicMNCPtr = std::shared_ptr<const CDeterministicMN>;

class CDeterministicMNListDiff;

Expand Down
14 changes: 14 additions & 0 deletions src/evo/types.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright (c) 2025 The Dash Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#ifndef BITCOIN_EVO_TYPES_H
#define BITCOIN_EVO_TYPES_H

#include <memory>

class CDeterministicMN;

using CDeterministicMNCPtr = std::shared_ptr<const CDeterministicMN>;

#endif // BITCOIN_EVO_TYPES_H
6 changes: 2 additions & 4 deletions src/governance/governance.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class CFlatDB;
class CInv;
class PeerManager;

class CDeterministicMNList;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

Header self-sufficiency: include CDeterministicMNList definition

This header dereferences lastMNListForVotingKeys in inline Serialize/Unserialize (Lines 194, 214), which requires the full CDeterministicMNList definition. A forward decl alone is unsafe and relies on transitive includes.

Add the include for deterministicmns.h here.

Add near other project headers:

#include <evo/deterministicmns.h>
🤖 Prompt for AI Agents
In src/governance/governance.h around line 27, the file only forward-declares
CDeterministicMNList but later dereferences lastMNListForVotingKeys in inline
Serialize/Unserialize methods (lines ~194 and ~214), so the full type definition
is required; add the project header include for deterministicmns.h (e.g.,
#include <evo/deterministicmns.h>) alongside the other project headers near the
top of the file so the inline serialization code has the complete
CDeterministicMNList definition.

class CDeterministicMNManager;
class CGovernanceManager;
class CGovernanceObject;
Expand All @@ -36,9 +37,6 @@ class CSporkManager;
static constexpr int RATE_BUFFER_SIZE = 5;
static constexpr bool DEFAULT_GOVERNANCE_ENABLE{true};

class CDeterministicMNList;
using CDeterministicMNListPtr = std::shared_ptr<CDeterministicMNList>;

class CRateCheckBuffer
{
private:
Expand Down Expand Up @@ -177,7 +175,7 @@ class GovernanceStore
vote_cmm_t cmmapOrphanVotes;
txout_m_t mapLastMasternodeObject;
// used to check for changed voting keys
CDeterministicMNListPtr lastMNListForVotingKeys;
std::shared_ptr<CDeterministicMNList> lastMNListForVotingKeys;

public:
GovernanceStore();
Expand Down
3 changes: 2 additions & 1 deletion src/llmq/commitment.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

#include <bls/bls.h>
#include <llmq/params.h>
#include <llmq/types.h>

#include <primitives/transaction.h>
#include <util/irange.h>
#include <util/strencodings.h>
Expand Down Expand Up @@ -156,7 +158,6 @@ class CFinalCommitment
return HexStr(vBytes);
}
};
using CFinalCommitmentPtr = std::unique_ptr<CFinalCommitment>;

class CFinalCommitmentTxPayload
{
Expand Down
4 changes: 2 additions & 2 deletions src/llmq/dkgsession.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#include <bls/bls.h>
#include <bls/bls_ies.h>
#include <bls/bls_worker.h>
#include <evo/types.h>

#include <saltedhasher.h>
#include <sync.h>
#include <util/underlying.h>
Expand All @@ -26,8 +28,6 @@ class CMasternodeMetaMan;
class CSporkManager;
class PeerManager;

using CDeterministicMNCPtr = std::shared_ptr<const CDeterministicMN>;

namespace llmq
{

Expand Down
21 changes: 7 additions & 14 deletions src/llmq/quorums.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,21 @@
#ifndef BITCOIN_LLMQ_QUORUMS_H
#define BITCOIN_LLMQ_QUORUMS_H

#include <llmq/params.h>

#include <bls/bls.h>
#include <bls/bls_worker.h>
#include <ctpl_stl.h>
#include <gsl/pointers.h>
#include <evo/types.h>
#include <llmq/params.h>
#include <llmq/types.h>
#include <unordered_lru_cache.h>

#include <protocol.h>
#include <saltedhasher.h>
#include <util/threadinterrupt.h>
#include <unordered_lru_cache.h>
#include <util/time.h>

#include <gsl/pointers.h>

#include <atomic>
#include <map>
#include <utility>
Expand All @@ -35,8 +38,6 @@ class CMasternodeSync;
class CNode;
class CSporkManager;

using CDeterministicMNCPtr = std::shared_ptr<const CDeterministicMN>;

namespace llmq
{
enum class VerifyRecSigStatus
Expand Down Expand Up @@ -170,14 +171,6 @@ class CQuorumDataRequest
* the public key shares of individual members, which are needed to verify signature shares of these members.
*/

class CQuorum;
using CQuorumPtr = std::shared_ptr<CQuorum>;
using CQuorumCPtr = std::shared_ptr<const CQuorum>;

class CFinalCommitment;
using CFinalCommitmentPtr = std::unique_ptr<CFinalCommitment>;


class CQuorum
{
friend class CQuorumManager;
Expand Down
12 changes: 6 additions & 6 deletions src/llmq/signing.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,20 @@
#define BITCOIN_LLMQ_SIGNING_H

#include <bls/bls.h>
#include <gsl/pointers.h>
#include <llmq/params.h>
#include <llmq/signhash.h>
#include <llmq/types.h>
#include <unordered_lru_cache.h>

#include <net_types.h>
#include <protocol.h>
#include <random.h>
#include <saltedhasher.h>
#include <sync.h>
#include <unordered_lru_cache.h>
#include <util/threadinterrupt.h>

#include <gsl/pointers.h>

#include <string_view>
#include <unordered_map>

Expand All @@ -29,10 +32,7 @@ class CInv;
class PeerManager;
class UniValue;

namespace llmq
{
class CQuorum;
using CQuorumCPtr = std::shared_ptr<const CQuorum>;
namespace llmq {
class CQuorumManager;
class CSigSharesManager;

Expand Down
4 changes: 2 additions & 2 deletions src/llmq/signing_shares.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include <llmq/signing.h>

#include <bls/bls.h>
#include <evo/types.h>

#include <random.h>
#include <saltedhasher.h>
#include <serialize.h>
Expand All @@ -31,8 +33,6 @@ class CDeterministicMN;
class CSporkManager;
class PeerManager;

using CDeterministicMNCPtr = std::shared_ptr<const CDeterministicMN>;

namespace llmq
{
class CSigningManager;
Expand Down
19 changes: 19 additions & 0 deletions src/llmq/types.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright (c) 2025 The Dash Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#ifndef BITCOIN_LLMQ_TYPES_H
#define BITCOIN_LLMQ_TYPES_H

#include <memory>

namespace llmq {
class CFinalCommitment;
class CQuorum;

using CFinalCommitmentPtr = std::unique_ptr<CFinalCommitment>;
using CQuorumPtr = std::shared_ptr<CQuorum>;
using CQuorumCPtr = std::shared_ptr<const CQuorum>;
} // namespace llmq

#endif // BITCOIN_LLMQ_TYPES_H
16 changes: 6 additions & 10 deletions src/llmq/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,26 @@

#include <llmq/utils.h>

#include <bls/bls.h>
#include <evo/deterministicmns.h>
#include <llmq/options.h>
#include <llmq/snapshot.h>
#include <llmq/types.h>
#include <masternode/meta.h>
#include <util/irange.h>
#include <util/ranges.h>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: util should not be on the top?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both are Dash-specific headers, util/irange.h was introduced in dash#4788 and util/ranges.h was introduced in dash#4622.


#include <bls/bls.h>
#include <chainparams.h>
#include <deploymentstatus.h>
#include <evo/deterministicmns.h>
#include <masternode/meta.h>
#include <net.h>
#include <random.h>
#include <util/irange.h>
#include <util/ranges.h>
#include <util/time.h>
#include <util/underlying.h>

#include <atomic>
#include <optional>

class CBLSSignature;
namespace llmq {
class CQuorum;
using CQuorumPtr = std::shared_ptr<CQuorum>;
using CQuorumCPtr = std::shared_ptr<const CQuorum>;
} // namespace llmq

/**
* Forward declarations
Expand Down
7 changes: 4 additions & 3 deletions src/llmq/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@
#define BITCOIN_LLMQ_UTILS_H

#include <bls/bls.h>
#include <gsl/pointers.h>
#include <evo/types.h>
#include <llmq/params.h>

#include <saltedhasher.h>
#include <sync.h>
#include <uint256.h>

#include <gsl/pointers.h>

#include <map>
#include <set>
#include <unordered_set>
Expand All @@ -25,8 +28,6 @@ class CDeterministicMNManager;
class CMasternodeMetaMan;
class CSporkManager;

using CDeterministicMNCPtr = std::shared_ptr<const CDeterministicMN>;

namespace llmq {
class CQuorumSnapshotManager;

Expand Down
5 changes: 2 additions & 3 deletions src/qt/masternodelist.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#include <sync.h>
#include <util/system.h>

#include <evo/types.h>

#include <QMenu>
#include <QTimer>
#include <QWidget>
Expand All @@ -21,9 +23,6 @@ namespace Ui
class MasternodeList;
}

class CDeterministicMN;
using CDeterministicMNCPtr = std::shared_ptr<const CDeterministicMN>;

class ClientModel;
class WalletModel;

Expand Down
Loading