6 #ifndef PIVX_LLMQ_QUORUMS_DKGSESSIONHANDLER_H
7 #define PIVX_LLMQ_QUORUMS_DKGSESSIONHANDLER_H
11 #include "validation.h"
55 template<
typename Message>
64 template<
typename Message>
68 if (binaryMessages.empty()) {
72 std::vector<std::pair<NodeId, std::shared_ptr<Message>>> ret;
73 ret.reserve(binaryMessages.size());
74 for (
const auto& bm : binaryMessages) {
75 auto msg = std::make_shared<Message>();
81 ret.emplace_back(std::make_pair(bm.first, std::move(msg)));
The block chain is a tree shaped structure starting with the genesis block at the root,...
Information about a peer.
Acts as a FIFO queue for incoming DKG messages.
size_t maxMessagesPerNode
bool HasSeen(const uint256 &hash) const
void PushPendingMessage(NodeId from, CDataStream &vRecv, int invType)
std::pair< NodeId, std::shared_ptr< CDataStream > > BinaryMessage
std::set< uint256 > seenMessages
std::list< BinaryMessage > PopPendingMessages(size_t maxCount)
std::list< BinaryMessage > pendingMessages
std::vector< std::pair< NodeId, std::shared_ptr< Message > > > PopAndDeserializeMessages(size_t maxCount)
void PushPendingMessage(NodeId from, Message &msg, int invType)
std::map< NodeId, size_t > messagesPerNode
CDKGPendingMessages(size_t _maxMessagesPerNode)
Handles multiple sequential sessions of one specific LLMQ type.
QuorumPhaseAndHash GetPhaseAndQuorumHash() const
std::atomic< bool > stopRequested
std::function< bool()> WhileWaitFunc
bool InitNewQuorum(const CBlockIndex *pindexQuorum)
void ProcessMessage(CNode *pfrom, const std::string &strCommand, CDataStream &vRecv)
void HandlePhase(QuorumPhase curPhase, QuorumPhase nextPhase, const uint256 &expectedQuorumHash, double randomSleepFactor, const StartPhaseFunc &startPhaseFunc, const WhileWaitFunc &runWhileWaiting)
void SleepBeforePhase(QuorumPhase curPhase, const uint256 &expectedQuorumHash, double randomSleepFactor, const WhileWaitFunc &runWhileWaiting)
std::shared_ptr< CDKGSession > curSession
CDKGSessionManager & dkgManager
CDKGPendingMessages pendingPrematureCommitments
CDKGPendingMessages pendingContributions
void UpdatedBlockTip(const CBlockIndex *pindexNew)
const Consensus::LLMQParams & params
void WaitForNewQuorum(const uint256 &oldQuorumHash)
void PhaseHandlerThread()
CDKGPendingMessages pendingComplaints
std::thread phaseHandlerThread
CDKGSessionHandler(const Consensus::LLMQParams &_params, CBLSWorker &blsWorker, CDKGSessionManager &_dkgManager)
void WaitForNextPhase(QuorumPhase curPhase, QuorumPhase nextPhase, const uint256 &expectedQuorumHash, const WhileWaitFunc &runWhileWaiting)
CDKGPendingMessages pendingJustifications
std::function< void()> StartPhaseFunc
@ QuorumPhase_Initialized
const uint256 UINT256_ZERO
constant uint256 instances