Skip to content

Commit cae0bff

Browse files
Merge #6839: chore: consolidate oft-repeated type definitions to {evo,llmq}/types.h
e7d35e6 refactor: drop `CDeterministicMNListPtr` (Kittywhiskers Van Gogh) 1010fea refactor: consolidate `llmq::CFinalCommitmentPtr` definitions (Kittywhiskers Van Gogh) 44edad9 refactor: consolidate `llmq::CQuorum{,C}Ptr` definitions (Kittywhiskers Van Gogh) 9325db9 refactor: consolidate `CDeterministicMNCPtr` definitions (Kittywhiskers Van Gogh) Pull request description: ## Motivation Consolidating frequently defined types to module-specific headers should prevent redefinition (often required to avoid undesirable dependency chains) and make code easier to read. ## Additional Information * Depends on #6828 * Depends on #6851 (supersedes portions of this PR) ## Breaking Changes None expected. ## Checklist - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas **(note: N/A)** - [x] I have added or updated relevant unit/integration/functional/e2e tests **(note: N/A)** - [x] I have made corresponding changes to the documentation **(note: N/A)** - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: UdjinM6: utACK e7d35e6 Tree-SHA512: 2fa1d8b5b4e4d30051e2f7cec2c8ece2b35412f28d331eadcdfb5722563a43f3d259d4e6ee3a02daf815cdeb50d0eb8ca5dec15604986884f7b2164daa5cc402
2 parents c4a9d82 + e7d35e6 commit cae0bff

File tree

14 files changed

+75
-53
lines changed

14 files changed

+75
-53
lines changed

src/Makefile.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ BITCOIN_CORE_H = \
220220
evo/specialtx.h \
221221
evo/specialtx_filter.h \
222222
evo/specialtxman.h \
223+
evo/types.h \
223224
dsnotificationinterface.h \
224225
governance/governance.h \
225226
governance/classes.h \
@@ -275,6 +276,7 @@ BITCOIN_CORE_H = \
275276
llmq/signing.h \
276277
llmq/signing_shares.h \
277278
llmq/snapshot.h \
279+
llmq/types.h \
278280
llmq/utils.h \
279281
logging.h \
280282
logging/timer.h \

src/coinjoin/client.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
#ifndef BITCOIN_COINJOIN_CLIENT_H
66
#define BITCOIN_COINJOIN_CLIENT_H
77

8-
#include <coinjoin/util.h>
98
#include <coinjoin/coinjoin.h>
9+
#include <coinjoin/util.h>
10+
#include <evo/types.h>
1011

1112
#include <net_types.h>
1213
#include <protocol.h>
@@ -21,7 +22,6 @@
2122
class CCoinJoinClientManager;
2223
class CCoinJoinClientQueueManager;
2324
class CConnman;
24-
class CDeterministicMN;
2525
class CDeterministicMNManager;
2626
class ChainstateManager;
2727
class CMasternodeMetaMan;
@@ -33,8 +33,6 @@ class PeerManager;
3333

3434
class UniValue;
3535

36-
using CDeterministicMNCPtr = std::shared_ptr<const CDeterministicMN>;
37-
3836
class CPendingDsaRequest
3937
{
4038
private:

src/evo/deterministicmns.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,19 @@
77

88
#include <evo/dmnstate.h>
99

10+
#include <evo/dmn_types.h>
11+
#include <evo/providertx.h>
12+
#include <evo/types.h>
13+
1014
#include <arith_uint256.h>
1115
#include <clientversion.h>
1216
#include <consensus/params.h>
1317
#include <crypto/common.h>
14-
#include <evo/dmn_types.h>
15-
#include <evo/providertx.h>
16-
#include <gsl/pointers.h>
1718
#include <saltedhasher.h>
1819
#include <scheduler.h>
1920
#include <sync.h>
2021

22+
#include <gsl/pointers.h>
2123
#include <immer/map.hpp>
2224

2325
#include <atomic>
@@ -85,7 +87,6 @@ class CDeterministicMN
8587
[[nodiscard]] std::string ToString() const;
8688
[[nodiscard]] UniValue ToJson() const;
8789
};
88-
using CDeterministicMNCPtr = std::shared_ptr<const CDeterministicMN>;
8990

9091
class CDeterministicMNListDiff;
9192

src/evo/types.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright (c) 2025 The Dash Core developers
2+
// Distributed under the MIT software license, see the accompanying
3+
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4+
5+
#ifndef BITCOIN_EVO_TYPES_H
6+
#define BITCOIN_EVO_TYPES_H
7+
8+
#include <memory>
9+
10+
class CDeterministicMN;
11+
12+
using CDeterministicMNCPtr = std::shared_ptr<const CDeterministicMN>;
13+
14+
#endif // BITCOIN_EVO_TYPES_H

src/governance/governance.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class CFlatDB;
2424
class CInv;
2525
class PeerManager;
2626

27+
class CDeterministicMNList;
2728
class CDeterministicMNManager;
2829
class CGovernanceManager;
2930
class CGovernanceObject;
@@ -36,9 +37,6 @@ class CSporkManager;
3637
static constexpr int RATE_BUFFER_SIZE = 5;
3738
static constexpr bool DEFAULT_GOVERNANCE_ENABLE{true};
3839

39-
class CDeterministicMNList;
40-
using CDeterministicMNListPtr = std::shared_ptr<CDeterministicMNList>;
41-
4240
class CRateCheckBuffer
4341
{
4442
private:
@@ -177,7 +175,7 @@ class GovernanceStore
177175
vote_cmm_t cmmapOrphanVotes;
178176
txout_m_t mapLastMasternodeObject;
179177
// used to check for changed voting keys
180-
CDeterministicMNListPtr lastMNListForVotingKeys;
178+
std::shared_ptr<CDeterministicMNList> lastMNListForVotingKeys;
181179

182180
public:
183181
GovernanceStore();

src/llmq/commitment.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
#include <bls/bls.h>
99
#include <llmq/params.h>
10+
#include <llmq/types.h>
11+
1012
#include <primitives/transaction.h>
1113
#include <util/irange.h>
1214
#include <util/strencodings.h>
@@ -156,7 +158,6 @@ class CFinalCommitment
156158
return HexStr(vBytes);
157159
}
158160
};
159-
using CFinalCommitmentPtr = std::unique_ptr<CFinalCommitment>;
160161

161162
class CFinalCommitmentTxPayload
162163
{

src/llmq/dkgsession.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#include <bls/bls.h>
1212
#include <bls/bls_ies.h>
1313
#include <bls/bls_worker.h>
14+
#include <evo/types.h>
15+
1416
#include <saltedhasher.h>
1517
#include <sync.h>
1618
#include <util/underlying.h>
@@ -26,8 +28,6 @@ class CMasternodeMetaMan;
2628
class CSporkManager;
2729
class PeerManager;
2830

29-
using CDeterministicMNCPtr = std::shared_ptr<const CDeterministicMN>;
30-
3131
namespace llmq
3232
{
3333

src/llmq/quorums.h

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,21 @@
55
#ifndef BITCOIN_LLMQ_QUORUMS_H
66
#define BITCOIN_LLMQ_QUORUMS_H
77

8-
#include <llmq/params.h>
9-
108
#include <bls/bls.h>
119
#include <bls/bls_worker.h>
1210
#include <ctpl_stl.h>
13-
#include <gsl/pointers.h>
11+
#include <evo/types.h>
12+
#include <llmq/params.h>
13+
#include <llmq/types.h>
14+
#include <unordered_lru_cache.h>
15+
1416
#include <protocol.h>
1517
#include <saltedhasher.h>
1618
#include <util/threadinterrupt.h>
17-
#include <unordered_lru_cache.h>
1819
#include <util/time.h>
1920

21+
#include <gsl/pointers.h>
22+
2023
#include <atomic>
2124
#include <map>
2225
#include <utility>
@@ -35,8 +38,6 @@ class CMasternodeSync;
3538
class CNode;
3639
class CSporkManager;
3740

38-
using CDeterministicMNCPtr = std::shared_ptr<const CDeterministicMN>;
39-
4041
namespace llmq
4142
{
4243
enum class VerifyRecSigStatus
@@ -170,14 +171,6 @@ class CQuorumDataRequest
170171
* the public key shares of individual members, which are needed to verify signature shares of these members.
171172
*/
172173

173-
class CQuorum;
174-
using CQuorumPtr = std::shared_ptr<CQuorum>;
175-
using CQuorumCPtr = std::shared_ptr<const CQuorum>;
176-
177-
class CFinalCommitment;
178-
using CFinalCommitmentPtr = std::unique_ptr<CFinalCommitment>;
179-
180-
181174
class CQuorum
182175
{
183176
friend class CQuorumManager;

src/llmq/signing.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,20 @@
66
#define BITCOIN_LLMQ_SIGNING_H
77

88
#include <bls/bls.h>
9-
#include <gsl/pointers.h>
109
#include <llmq/params.h>
1110
#include <llmq/signhash.h>
11+
#include <llmq/types.h>
12+
#include <unordered_lru_cache.h>
13+
1214
#include <net_types.h>
1315
#include <protocol.h>
1416
#include <random.h>
1517
#include <saltedhasher.h>
1618
#include <sync.h>
17-
#include <unordered_lru_cache.h>
1819
#include <util/threadinterrupt.h>
1920

21+
#include <gsl/pointers.h>
22+
2023
#include <string_view>
2124
#include <unordered_map>
2225

@@ -29,10 +32,7 @@ class CInv;
2932
class PeerManager;
3033
class UniValue;
3134

32-
namespace llmq
33-
{
34-
class CQuorum;
35-
using CQuorumCPtr = std::shared_ptr<const CQuorum>;
35+
namespace llmq {
3636
class CQuorumManager;
3737
class CSigSharesManager;
3838

src/llmq/signing_shares.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
#include <llmq/signing.h>
99

1010
#include <bls/bls.h>
11+
#include <evo/types.h>
12+
1113
#include <random.h>
1214
#include <saltedhasher.h>
1315
#include <serialize.h>
@@ -31,8 +33,6 @@ class CDeterministicMN;
3133
class CSporkManager;
3234
class PeerManager;
3335

34-
using CDeterministicMNCPtr = std::shared_ptr<const CDeterministicMN>;
35-
3636
namespace llmq
3737
{
3838
class CSigningManager;

0 commit comments

Comments
 (0)