Dash Core Source Documentation (0.16.0.1)
Find detailed information regarding the Dash Core source code.
Handles multiple sequential sessions of one specific LLMQ type. More...
#include <quorums_dkgsessionhandler.h>
Public Member Functions | |
CDKGSessionHandler (const Consensus::LLMQParams &_params, CBLSWorker &blsWorker, CDKGSessionManager &_dkgManager) | |
~CDKGSessionHandler () | |
void | UpdatedBlockTip (const CBlockIndex *pindexNew) |
void | ProcessMessage (CNode *pfrom, const std::string &strCommand, CDataStream &vRecv, CConnman &connman) |
void | StartThread () |
void | StopThread () |
Private Types | |
typedef std::function< void()> | StartPhaseFunc |
typedef std::function< bool()> | WhileWaitFunc |
Private Member Functions | |
bool | InitNewQuorum (const CBlockIndex *pindexQuorum) |
std::pair< QuorumPhase, uint256 > | GetPhaseAndQuorumHash () const |
void | WaitForNextPhase (QuorumPhase curPhase, QuorumPhase nextPhase, const uint256 &expectedQuorumHash, const WhileWaitFunc &runWhileWaiting) |
void | WaitForNewQuorum (const uint256 &oldQuorumHash) |
void | SleepBeforePhase (QuorumPhase curPhase, const uint256 &expectedQuorumHash, double randomSleepFactor, const WhileWaitFunc &runWhileWaiting) |
void | HandlePhase (QuorumPhase curPhase, QuorumPhase nextPhase, const uint256 &expectedQuorumHash, double randomSleepFactor, const StartPhaseFunc &startPhaseFunc, const WhileWaitFunc &runWhileWaiting) |
void | HandleDKGRound () |
void | PhaseHandlerThread () |
Private Attributes | |
CCriticalSection | cs |
std::atomic< bool > | stopRequested {false} |
const Consensus::LLMQParams & | params |
CBLSWorker & | blsWorker |
CDKGSessionManager & | dkgManager |
QuorumPhase | phase {QuorumPhase_Idle} |
int | currentHeight {-1} |
int | quorumHeight {-1} |
uint256 | quorumHash |
std::shared_ptr< CDKGSession > | curSession |
std::thread | phaseHandlerThread |
CDKGPendingMessages | pendingContributions |
CDKGPendingMessages | pendingComplaints |
CDKGPendingMessages | pendingJustifications |
CDKGPendingMessages | pendingPrematureCommitments |
Friends | |
class | CDKGSessionManager |
Detailed Description
Handles multiple sequential sessions of one specific LLMQ type.
There is one instance of this class per LLMQ type.
It internally starts the phase handler thread, which constantly loops and sequentially processes one session at a time and waiting for the next phase if necessary.
Definition at line 96 of file quorums_dkgsessionhandler.h.
Member Typedef Documentation
◆ StartPhaseFunc
|
private |
Definition at line 136 of file quorums_dkgsessionhandler.h.
◆ WhileWaitFunc
|
private |
Definition at line 137 of file quorums_dkgsessionhandler.h.
Constructor & Destructor Documentation
◆ CDKGSessionHandler()
llmq::CDKGSessionHandler::CDKGSessionHandler | ( | const Consensus::LLMQParams & | _params, |
CBLSWorker & | blsWorker, | ||
CDKGSessionManager & | _dkgManager | ||
) |
Definition at line 88 of file quorums_dkgsessionhandler.cpp.
References Consensus::LLMQ_NONE, params, and Consensus::LLMQParams::type.
◆ ~CDKGSessionHandler()
llmq::CDKGSessionHandler::~CDKGSessionHandler | ( | ) |
Definition at line 103 of file quorums_dkgsessionhandler.cpp.
Member Function Documentation
◆ GetPhaseAndQuorumHash()
|
private |
Definition at line 183 of file quorums_dkgsessionhandler.cpp.
References cs, LOCK, phase, and quorumHash.
Referenced by WaitForNewQuorum(), and WaitForNextPhase().
◆ HandleDKGRound()
|
private |
Definition at line 509 of file quorums_dkgsessionhandler.cpp.
References llmq::CQuorumBlockProcessor::AddMinableCommitment(), llmq::CLLMQUtils::AddQuorumProbeConnections(), llmq::CDKGPendingMessages::Clear(), cs, cs_main, curSession, llmq::DEFAULT_WATCH_QUORUMS, llmq::CLLMQUtils::EnsureQuorumConnections(), gArgs, ArgsManager::GetBoolArg(), HandlePhase(), InitNewQuorum(), llmq::CLLMQUtils::IsAllMembersConnectedEnabled(), LOCK, mapBlockIndex, params, pendingComplaints, pendingContributions, pendingJustifications, pendingPrematureCommitments, llmq::quorumBlockProcessor, llmq::quorumDKGDebugManager, quorumHash, quorumHeight, llmq::QuorumPhase_Commit, llmq::QuorumPhase_Complain, llmq::QuorumPhase_Contribute, llmq::QuorumPhase_Finalize, llmq::QuorumPhase_Initialized, llmq::QuorumPhase_Justify, llmq::QuorumPhase_None, Consensus::LLMQParams::type, llmq::CDKGDebugManager::UpdateLocalSessionStatus(), WaitForNewQuorum(), and WaitForNextPhase().
Referenced by PhaseHandlerThread().
◆ HandlePhase()
|
private |
Definition at line 321 of file quorums_dkgsessionhandler.cpp.
References BCLog::LLMQ_DKG, LogPrint, Consensus::LLMQParams::name, params, SleepBeforePhase(), and WaitForNextPhase().
Referenced by HandleDKGRound().
◆ InitNewQuorum()
|
private |
Definition at line 161 of file quorums_dkgsessionhandler.cpp.
References activeMasternodeInfo, blsWorker, curSession, deterministicMNManager, dkgManager, llmq::CLLMQUtils::GetAllQuorumMembers(), CChainParams::GetConsensus(), LogPrintf, CBlockIndex::nHeight, params, Params(), CActiveMasternodeInfo::proTxHash, and Consensus::LLMQParams::type.
Referenced by HandleDKGRound().
◆ PhaseHandlerThread()
|
private |
Definition at line 593 of file quorums_dkgsessionhandler.cpp.
References HandleDKGRound(), BCLog::LLMQ_DKG, LogPrint, Consensus::LLMQParams::name, params, llmq::quorumDKGDebugManager, ShutdownRequested(), stopRequested, Consensus::LLMQParams::type, and llmq::CDKGDebugManager::UpdateLocalSessionStatus().
Referenced by StartThread().
◆ ProcessMessage()
void llmq::CDKGSessionHandler::ProcessMessage | ( | CNode * | pfrom, |
const std::string & | strCommand, | ||
CDataStream & | vRecv, | ||
CConnman & | connman | ||
) |
Definition at line 129 of file quorums_dkgsessionhandler.cpp.
References CNode::GetId(), pendingComplaints, pendingContributions, pendingJustifications, pendingPrematureCommitments, llmq::CDKGPendingMessages::PushPendingMessage(), NetMsgType::QCOMPLAINT, NetMsgType::QCONTRIB, NetMsgType::QJUSTIFICATION, and NetMsgType::QPCOMMITMENT.
◆ SleepBeforePhase()
|
private |
Definition at line 254 of file quorums_dkgsessionhandler.cpp.
References cs, currentHeight, curSession, Consensus::LLMQParams::dkgPhaseBlocks, CChainParams::GetConsensus(), GetTimeMillis(), BCLog::LLMQ_DKG, LOCK, LogPrint, MilliSleep(), CChainParams::MineBlocksOnDemand(), Consensus::LLMQParams::name, Consensus::Params::nPowTargetSpacing, params, Params(), phase, quorumHash, ShutdownRequested(), Consensus::LLMQParams::size, and stopRequested.
Referenced by HandlePhase().
◆ StartThread()
void llmq::CDKGSessionHandler::StartThread | ( | ) |
Definition at line 143 of file quorums_dkgsessionhandler.cpp.
References params, phaseHandlerThread, PhaseHandlerThread(), strprintf, TraceThread(), and Consensus::LLMQParams::type.
◆ StopThread()
void llmq::CDKGSessionHandler::StopThread | ( | ) |
Definition at line 153 of file quorums_dkgsessionhandler.cpp.
References phaseHandlerThread, and stopRequested.
◆ UpdatedBlockTip()
void llmq::CDKGSessionHandler::UpdatedBlockTip | ( | const CBlockIndex * | pindexNew | ) |
Definition at line 107 of file quorums_dkgsessionhandler.cpp.
References cs, currentHeight, Consensus::LLMQParams::dkgInterval, Consensus::LLMQParams::dkgPhaseBlocks, CBlockIndex::GetAncestor(), CBlockIndex::GetBlockHash(), BCLog::LLMQ_DKG, LOCK, LogPrint, Consensus::LLMQParams::name, CBlockIndex::nHeight, params, phase, quorumHash, quorumHeight, llmq::QuorumPhase_Idle, and llmq::QuorumPhase_Initialized.
◆ WaitForNewQuorum()
|
private |
Definition at line 234 of file quorums_dkgsessionhandler.cpp.
References GetPhaseAndQuorumHash(), BCLog::LLMQ_DKG, LogPrint, MilliSleep(), Consensus::LLMQParams::name, params, ShutdownRequested(), and stopRequested.
Referenced by HandleDKGRound().
◆ WaitForNextPhase()
|
private |
Definition at line 192 of file quorums_dkgsessionhandler.cpp.
References GetPhaseAndQuorumHash(), base_blob< BITS >::IsNull(), BCLog::LLMQ_DKG, LogPrint, MilliSleep(), Consensus::LLMQParams::name, params, llmq::quorumDKGDebugManager, llmq::QuorumPhase_Initialized, llmq::QuorumPhase_None, llmq::CDKGDebugManager::ResetLocalSessionStatus(), ShutdownRequested(), stopRequested, Consensus::LLMQParams::type, and llmq::CDKGDebugManager::UpdateLocalSessionStatus().
Referenced by HandleDKGRound(), and HandlePhase().
Friends And Related Function Documentation
◆ CDKGSessionManager
|
friend |
Definition at line 99 of file quorums_dkgsessionhandler.h.
Member Data Documentation
◆ blsWorker
|
private |
Definition at line 106 of file quorums_dkgsessionhandler.h.
Referenced by InitNewQuorum().
◆ cs
|
mutableprivate |
Definition at line 102 of file quorums_dkgsessionhandler.h.
Referenced by GetPhaseAndQuorumHash(), HandleDKGRound(), SleepBeforePhase(), and UpdatedBlockTip().
◆ currentHeight
|
private |
Definition at line 110 of file quorums_dkgsessionhandler.h.
Referenced by SleepBeforePhase(), and UpdatedBlockTip().
◆ curSession
|
private |
Definition at line 113 of file quorums_dkgsessionhandler.h.
Referenced by HandleDKGRound(), InitNewQuorum(), and SleepBeforePhase().
◆ dkgManager
|
private |
Definition at line 107 of file quorums_dkgsessionhandler.h.
Referenced by InitNewQuorum().
◆ params
|
private |
Definition at line 105 of file quorums_dkgsessionhandler.h.
Referenced by CDKGSessionHandler(), HandleDKGRound(), HandlePhase(), InitNewQuorum(), PhaseHandlerThread(), SleepBeforePhase(), StartThread(), UpdatedBlockTip(), WaitForNewQuorum(), and WaitForNextPhase().
◆ pendingComplaints
|
private |
Definition at line 117 of file quorums_dkgsessionhandler.h.
Referenced by HandleDKGRound(), and ProcessMessage().
◆ pendingContributions
|
private |
Definition at line 116 of file quorums_dkgsessionhandler.h.
Referenced by HandleDKGRound(), and ProcessMessage().
◆ pendingJustifications
|
private |
Definition at line 118 of file quorums_dkgsessionhandler.h.
Referenced by HandleDKGRound(), and ProcessMessage().
◆ pendingPrematureCommitments
|
private |
Definition at line 119 of file quorums_dkgsessionhandler.h.
Referenced by HandleDKGRound(), and ProcessMessage().
◆ phase
|
private |
Definition at line 109 of file quorums_dkgsessionhandler.h.
Referenced by GetPhaseAndQuorumHash(), SleepBeforePhase(), and UpdatedBlockTip().
◆ phaseHandlerThread
|
private |
Definition at line 114 of file quorums_dkgsessionhandler.h.
Referenced by StartThread(), and StopThread().
◆ quorumHash
|
private |
Definition at line 112 of file quorums_dkgsessionhandler.h.
Referenced by GetPhaseAndQuorumHash(), HandleDKGRound(), SleepBeforePhase(), and UpdatedBlockTip().
◆ quorumHeight
|
private |
Definition at line 111 of file quorums_dkgsessionhandler.h.
Referenced by HandleDKGRound(), and UpdatedBlockTip().
◆ stopRequested
|
private |
Definition at line 103 of file quorums_dkgsessionhandler.h.
Referenced by PhaseHandlerThread(), SleepBeforePhase(), StopThread(), WaitForNewQuorum(), and WaitForNextPhase().
The documentation for this class was generated from the following files:
- src/llmq/quorums_dkgsessionhandler.h
- src/llmq/quorums_dkgsessionhandler.cpp