Skip to content

Commit c25a37c

Browse files
committed
Tweak CDKGSessionHandler::StartThread()
1 parent 312b44b commit c25a37c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/llmq/quorums_dkgsessionhandler.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@ void CDKGSessionHandler::ProcessMessage(CNode* pfrom, const std::string& strComm
138138

139139
void CDKGSessionHandler::StartThread()
140140
{
141+
if (phaseHandlerThread.joinable()) {
142+
throw std::runtime_error("Tried to start an already started CDKGSessionHandler thread.");
143+
}
144+
141145
auto threadName = [&]() -> auto {
142146
switch (params.type) {
143147
case Consensus::LLMQ_50_60:
@@ -150,8 +154,10 @@ void CDKGSessionHandler::StartThread()
150154
return "q-phase-100";
151155
case Consensus::LLMQ_DEVNET:
152156
return "q-phase-101";
153-
default:
157+
case Consensus::LLMQ_NONE:
154158
throw std::runtime_error("Tried to start a CDKGSessionHandler thread for LLMQ_NONE.");
159+
default:
160+
throw std::runtime_error("Tried to start a CDKGSessionHandler thread for an unknown LLMQ type.");
155161
}
156162
};
157163
phaseHandlerThread = std::thread(&TraceThread<std::function<void()> >, threadName(), std::function<void()>(std::bind(&CDKGSessionHandler::PhaseHandlerThread, this)));

0 commit comments

Comments
 (0)