PIVX Core  5.6.99
P2P Digital Currency
quorums_debug.h
Go to the documentation of this file.
1 // Copyright (c) 2018-2021 The Dash Core developers
2 // Copyright (c) 2022 The PIVX Core developers
3 // Distributed under the MIT/X11 software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 
6 #ifndef PIVX_LLMQ_QUORUMS_DEBUG_H
7 #define PIVX_LLMQ_QUORUMS_DEBUG_H
8 
9 #include "consensus/params.h"
10 #include "sync.h"
11 #include "univalue.h"
12 
13 #include <functional>
14 #include <set>
15 
16 class CDataStream;
17 class CInv;
18 class CScheduler;
19 
20 namespace llmq
21 {
22 
24 {
25 public:
26  union {
27  struct
28  {
29  // is it locally considered as bad (and thus removed from the validMembers set)
30  bool bad : 1;
31  // did we complain about this member
32  bool weComplain : 1;
33 
34  // received message for DKG phases
39  };
40  uint8_t statusBitset;
41  };
42 
43  std::set<uint16_t> complaintsFromMembers;
44 
45 public:
47 };
48 
50 {
51 public:
54  uint32_t quorumHeight{0};
55  uint8_t phase{0};
56 
57  union {
58  struct
59  {
60  // sent messages for DKG phases
62  bool sentComplaint : 1;
65 
66  bool aborted : 1;
67  };
68  uint8_t statusBitset;
69  };
70 
71  std::vector<CDKGDebugMemberStatus> members;
73 
74 public:
76 
77  UniValue ToJson(int detailLevel) const;
78 };
79 
81 {
82 public:
83  int64_t nTime{0};
84 
85  std::map<Consensus::LLMQType, CDKGDebugSessionStatus> sessions;
86 
87 public:
88  UniValue ToJson(int detailLevel) const;
89 };
90 
92 {
93 private:
96 
97 public:
98  CDKGDebugManager() = default;
99 
101 
103  void InitLocalSessionStatus(Consensus::LLMQType llmqType, const uint256& quorumHash, int quorumHeight);
104 
105  void UpdateLocalSessionStatus(Consensus::LLMQType llmqType, std::function<bool(CDKGDebugSessionStatus& status)>&& func);
106  void UpdateLocalMemberStatus(Consensus::LLMQType llmqType, size_t memberIdx, std::function<bool(CDKGDebugMemberStatus& status)>&& func);
107 };
108 
109 extern std::unique_ptr<CDKGDebugManager> quorumDKGDebugManager;
110 
111 } // namespace llmq
112 
113 #endif // PIVX_LLMQ_QUORUMS_DEBUG_H
inv message data
Definition: protocol.h:466
void GetLocalDebugStatus(CDKGDebugStatus &ret)
void InitLocalSessionStatus(Consensus::LLMQType llmqType, const uint256 &quorumHash, int quorumHeight)
void UpdateLocalSessionStatus(Consensus::LLMQType llmqType, std::function< bool(CDKGDebugSessionStatus &status)> &&func)
CDKGDebugStatus localStatus
Definition: quorums_debug.h:95
void ResetLocalSessionStatus(Consensus::LLMQType llmqType)
void UpdateLocalMemberStatus(Consensus::LLMQType llmqType, size_t memberIdx, std::function< bool(CDKGDebugMemberStatus &status)> &&func)
std::set< uint16_t > complaintsFromMembers
Definition: quorums_debug.h:43
std::vector< CDKGDebugMemberStatus > members
Definition: quorums_debug.h:71
UniValue ToJson(int detailLevel) const
Consensus::LLMQType llmqType
Definition: quorums_debug.h:52
UniValue ToJson(int detailLevel) const
std::map< Consensus::LLMQType, CDKGDebugSessionStatus > sessions
Definition: quorums_debug.h:85
256-bit opaque blob.
Definition: uint256.h:138
LLMQType
Definition: params.h:90
@ LLMQ_NONE
Definition: params.h:91
Definition: quorums.cpp:26
std::unique_ptr< CDKGDebugManager > quorumDKGDebugManager