Skip to content

Commit 8f280f3

Browse files
authored
Split "llmq" debug category into "llmq", "llmq-dkg" and "llmq-sigs" (#2799)
* Use llmq-sig log category for CSigSharesManager * Use llmq-dkg log category for DKG related logging
1 parent 15c720d commit 8f280f3

File tree

5 files changed

+27
-25
lines changed

5 files changed

+27
-25
lines changed

src/init.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ std::string HelpMessage(HelpMessageMode mode)
553553
strUsage += HelpMessageOpt("-watchquorums=<n>", strprintf("Watch and validate quorum communication (default: %u)", llmq::DEFAULT_WATCH_QUORUMS));
554554
}
555555
std::string debugCategories = "addrman, alert, bench, cmpctblock, coindb, db, http, leveldb, libevent, lock, mempool, mempoolrej, net, proxy, prune, rand, reindex, rpc, selectcoins, tor, zmq, "
556-
"dash (or specifically: chainlocks, gobject, instantsend, keepass, llmq, masternode, mnpayments, mnsync, privatesend, spork)"; // Don't translate these and qt below
556+
"dash (or specifically: chainlocks, gobject, instantsend, keepass, llmq, llmq-dkg, llmq-sigs, masternode, mnpayments, mnsync, privatesend, spork)"; // Don't translate these and qt below
557557
if (mode == HMM_BITCOIN_QT)
558558
debugCategories += ", qt";
559559
strUsage += HelpMessageOpt("-debug=<category>", strprintf(_("Output debugging information (default: %u, supplying <category> is optional)"), 0) + ". " +

src/llmq/quorums_dkgsession.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ CDKGLogger::CDKGLogger(const CDKGSession& _quorumDkg, const std::string& _func)
3939
}
4040

4141
CDKGLogger::CDKGLogger(Consensus::LLMQType _llmqType, const uint256& _quorumHash, int _height, bool _areWeMember, const std::string& _func) :
42-
CBatchedLogger("llmq", strprintf("QuorumDKG(type=%d, height=%d, member=%d, func=%s)", _llmqType, _height, _areWeMember, _func))
42+
CBatchedLogger("llmq-dkg", strprintf("QuorumDKG(type=%d, height=%d, member=%d, func=%s)", _llmqType, _height, _areWeMember, _func))
4343
{
4444
}
4545

src/llmq/quorums_dkgsessionhandler.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ void CDKGPendingMessages::PushPendingMessage(NodeId from, CDataStream& vRecv)
4545
LOCK2(cs_main, cs);
4646

4747
if (!seenMessages.emplace(hash).second) {
48-
LogPrint("llmq", "CDKGPendingMessages::%s -- already seen %s, peer=%d", __func__, from);
48+
LogPrint("llmq-dkg", "CDKGPendingMessages::%s -- already seen %s, peer=%d", __func__, from);
4949
return;
5050
}
5151

@@ -482,7 +482,7 @@ void CDKGSessionHandler::HandleDKGRound()
482482
for (const auto& c : connections) {
483483
debugMsg += strprintf(" %s\n", c.first.ToString(false));
484484
}
485-
LogPrint("llmq", debugMsg);
485+
LogPrint("llmq-dkg", debugMsg);
486486
g_connman->AddMasternodeQuorumNodes(params.type, curQuorumHash, connections);
487487
}
488488
}
@@ -541,7 +541,7 @@ void CDKGSessionHandler::PhaseHandlerThread()
541541
status.aborted = true;
542542
return true;
543543
});
544-
LogPrint("llmq", "CDKGSessionHandler::%s -- aborted current DKG session for llmq=%s\n", __func__, params.name);
544+
LogPrint("llmq-dkg", "CDKGSessionHandler::%s -- aborted current DKG session for llmq=%s\n", __func__, params.name);
545545
}
546546
}
547547
}

src/llmq/quorums_signing_shares.cpp

+20-20
Original file line numberDiff line numberDiff line change
@@ -303,12 +303,12 @@ bool CSigSharesManager::ProcessMessageSigSesAnn(CNode* pfrom, const CSigSesAnn&
303303
return false;
304304
}
305305

306-
LogPrint("llmq", "CSigSharesManager::%s -- ann={%s}, node=%d\n", __func__, ann.ToString(), pfrom->id);
306+
LogPrint("llmq-sigs", "CSigSharesManager::%s -- ann={%s}, node=%d\n", __func__, ann.ToString(), pfrom->id);
307307

308308
auto quorum = quorumManager->GetQuorum(llmqType, ann.quorumHash);
309309
if (!quorum) {
310310
// TODO should we ban here?
311-
LogPrint("llmq", "CSigSharesManager::%s -- quorum %s not found, node=%d\n", __func__,
311+
LogPrint("llmq-sigs", "CSigSharesManager::%s -- quorum %s not found, node=%d\n", __func__,
312312
ann.quorumHash.ToString(), pfrom->id);
313313
return true; // let's still try other announcements from the same message
314314
}
@@ -353,12 +353,12 @@ bool CSigSharesManager::ProcessMessageSigSharesInv(CNode* pfrom, const CSigShare
353353
return true;
354354
}
355355

356-
LogPrint("llmq", "CSigSharesManager::%s -- signHash=%s, inv={%s}, node=%d\n", __func__,
356+
LogPrint("llmq-sigs", "CSigSharesManager::%s -- signHash=%s, inv={%s}, node=%d\n", __func__,
357357
sessionInfo.signHash.ToString(), inv.ToString(), pfrom->id);
358358

359359
if (sessionInfo.quorum->quorumVvec == nullptr) {
360360
// TODO we should allow to ask other nodes for the quorum vvec if we missed it in the DKG
361-
LogPrint("llmq", "CSigSharesManager::%s -- we don't have the quorum vvec for %s, not requesting sig shares. node=%d\n", __func__,
361+
LogPrint("llmq-sigs", "CSigSharesManager::%s -- we don't have the quorum vvec for %s, not requesting sig shares. node=%d\n", __func__,
362362
sessionInfo.quorumHash.ToString(), pfrom->id);
363363
return true;
364364
}
@@ -390,7 +390,7 @@ bool CSigSharesManager::ProcessMessageGetSigShares(CNode* pfrom, const CSigShare
390390
return true;
391391
}
392392

393-
LogPrint("llmq", "CSigSharesManager::%s -- signHash=%s, inv={%s}, node=%d\n", __func__,
393+
LogPrint("llmq-sigs", "CSigSharesManager::%s -- signHash=%s, inv={%s}, node=%d\n", __func__,
394394
sessionInfo.signHash.ToString(), inv.ToString(), pfrom->id);
395395

396396
LOCK(cs);
@@ -444,7 +444,7 @@ bool CSigSharesManager::ProcessMessageBatchedSigShares(CNode* pfrom, const CBatc
444444
}
445445
}
446446

447-
LogPrint("llmq", "CSigSharesManager::%s -- signHash=%s, shares=%d, new=%d, inv={%s}, node=%d\n", __func__,
447+
LogPrint("llmq-sigs", "CSigSharesManager::%s -- signHash=%s, shares=%d, new=%d, inv={%s}, node=%d\n", __func__,
448448
sessionInfo.signHash.ToString(), batchedSigShares.sigShares.size(), sigShares.size(), batchedSigShares.ToInvString(), pfrom->id);
449449

450450
if (sigShares.empty()) {
@@ -473,7 +473,7 @@ bool CSigSharesManager::PreVerifyBatchedSigShares(NodeId nodeId, const CSigShare
473473
}
474474
if (session.quorum->quorumVvec == nullptr) {
475475
// TODO we should allow to ask other nodes for the quorum vvec if we missed it in the DKG
476-
LogPrint("llmq", "CSigSharesManager::%s -- we don't have the quorum vvec for %s, no verification possible. node=%d\n", __func__,
476+
LogPrint("llmq-sigs", "CSigSharesManager::%s -- we don't have the quorum vvec for %s, no verification possible. node=%d\n", __func__,
477477
session.quorumHash.ToString(), nodeId);
478478
return false;
479479
}
@@ -614,7 +614,7 @@ bool CSigSharesManager::ProcessPendingSigShares(CConnman& connman)
614614
batchVerifier.Verify();
615615
verifyTimer.stop();
616616

617-
LogPrint("llmq", "CSigSharesManager::%s -- verified sig shares. count=%d, vt=%d, nodes=%d\n", __func__, verifyCount, verifyTimer.count(), sigSharesByNodes.size());
617+
LogPrint("llmq-sigs", "CSigSharesManager::%s -- verified sig shares. count=%d, vt=%d, nodes=%d\n", __func__, verifyCount, verifyTimer.count(), sigSharesByNodes.size());
618618

619619
for (auto& p : sigSharesByNodes) {
620620
auto nodeId = p.first;
@@ -649,7 +649,7 @@ void CSigSharesManager::ProcessPendingSigSharesFromNode(NodeId nodeId,
649649
}
650650
t.stop();
651651

652-
LogPrint("llmq", "CSigSharesManager::%s -- processed sigShare batch. shares=%d, time=%d, node=%d\n", __func__,
652+
LogPrint("llmq-sigs", "CSigSharesManager::%s -- processed sigShare batch. shares=%d, time=%d, node=%d\n", __func__,
653653
sigShares.size(), t.count(), nodeId);
654654
}
655655

@@ -754,7 +754,7 @@ void CSigSharesManager::TryRecoverSig(const CQuorumCPtr& quorum, const uint256&
754754
return;
755755
}
756756

757-
LogPrint("llmq", "CSigSharesManager::%s -- recovered signature. id=%s, msgHash=%s, time=%d\n", __func__,
757+
LogPrint("llmq-sigs", "CSigSharesManager::%s -- recovered signature. id=%s, msgHash=%s, time=%d\n", __func__,
758758
id.ToString(), msgHash.ToString(), t.count());
759759

760760
CRecoveredSig rs;
@@ -805,7 +805,7 @@ void CSigSharesManager::CollectSigSharesToRequest(std::unordered_map<NodeId, std
805805
nodeState.requestedSigShares.EraseIf([&](const SigShareKey& k, int64_t t) {
806806
if (now - t >= SIG_SHARE_REQUEST_TIMEOUT) {
807807
// timeout while waiting for this one, so retry it with another node
808-
LogPrint("llmq", "CSigSharesManager::CollectSigSharesToRequest -- timeout while waiting for %s-%d, node=%d\n",
808+
LogPrint("llmq-sigs", "CSigSharesManager::CollectSigSharesToRequest -- timeout while waiting for %s-%d, node=%d\n",
809809
k.first.ToString(), k.second, nodeId);
810810
return true;
811811
}
@@ -840,7 +840,7 @@ void CSigSharesManager::CollectSigSharesToRequest(std::unordered_map<NodeId, std
840840
if (p) {
841841
if (now - p->second >= SIG_SHARE_REQUEST_TIMEOUT && nodeId != p->first) {
842842
// other node timed out, re-request from this node
843-
LogPrint("llmq", "CSigSharesManager::%s -- other node timeout while waiting for %s-%d, re-request from=%d, node=%d\n", __func__,
843+
LogPrint("llmq-sigs", "CSigSharesManager::%s -- other node timeout while waiting for %s-%d, re-request from=%d, node=%d\n", __func__,
844844
k.first.ToString(), k.second, nodeId, p->first);
845845
} else {
846846
continue;
@@ -1043,7 +1043,7 @@ bool CSigSharesManager::SendMessages()
10431043
std::vector<CSigSesAnn> msgs;
10441044
msgs.reserve(it1->second.size());
10451045
for (auto& sigSesAnn : it1->second) {
1046-
LogPrint("llmq", "CSigSharesManager::SendMessages -- QSIGSESANN signHash=%s, sessionId=%d, node=%d\n",
1046+
LogPrint("llmq-sigs", "CSigSharesManager::SendMessages -- QSIGSESANN signHash=%s, sessionId=%d, node=%d\n",
10471047
CLLMQUtils::BuildSignHash(sigSesAnn).ToString(), sigSesAnn.sessionId, pnode->id);
10481048
msgs.emplace_back(sigSesAnn);
10491049
if (msgs.size() == MAX_MSGS_CNT_QSIGSESANN) {
@@ -1063,7 +1063,7 @@ bool CSigSharesManager::SendMessages()
10631063
std::vector<CSigSharesInv> msgs;
10641064
for (auto& p : it->second) {
10651065
assert(p.second.CountSet() != 0);
1066-
LogPrint("llmq", "CSigSharesManager::SendMessages -- QGETSIGSHARES signHash=%s, inv={%s}, node=%d\n",
1066+
LogPrint("llmq-sigs", "CSigSharesManager::SendMessages -- QGETSIGSHARES signHash=%s, inv={%s}, node=%d\n",
10671067
p.first.ToString(), p.second.ToString(), pnode->id);
10681068
msgs.emplace_back(std::move(p.second));
10691069
if (msgs.size() == MAX_MSGS_CNT_QGETSIGSHARES) {
@@ -1084,7 +1084,7 @@ bool CSigSharesManager::SendMessages()
10841084
std::vector<CBatchedSigShares> msgs;
10851085
for (auto& p : jt->second) {
10861086
assert(!p.second.sigShares.empty());
1087-
LogPrint("llmq", "CSigSharesManager::SendMessages -- QBSIGSHARES signHash=%s, inv={%s}, node=%d\n",
1087+
LogPrint("llmq-sigs", "CSigSharesManager::SendMessages -- QBSIGSHARES signHash=%s, inv={%s}, node=%d\n",
10881088
p.first.ToString(), p.second.ToInvString(), pnode->id);
10891089
if (totalSigsCount + p.second.sigShares.size() > MAX_MSGS_TOTAL_BATCHED_SIGS) {
10901090
g_connman->PushMessage(pnode, msgMaker.Make(NetMsgType::QBSIGSHARES, msgs), false);
@@ -1107,7 +1107,7 @@ bool CSigSharesManager::SendMessages()
11071107
std::vector<CSigSharesInv> msgs;
11081108
for (auto& p : kt->second) {
11091109
assert(p.second.CountSet() != 0);
1110-
LogPrint("llmq", "CSigSharesManager::SendMessages -- QSIGSHARESINV signHash=%s, inv={%s}, node=%d\n",
1110+
LogPrint("llmq-sigs", "CSigSharesManager::SendMessages -- QSIGSHARESINV signHash=%s, inv={%s}, node=%d\n",
11111111
p.first.ToString(), p.second.ToString(), pnode->id);
11121112
msgs.emplace_back(std::move(p.second));
11131113
if (msgs.size() == MAX_MSGS_CNT_QSIGSHARESINV) {
@@ -1249,10 +1249,10 @@ void CSigSharesManager::Cleanup()
12491249
}
12501250
}
12511251

1252-
LogPrint("llmq", "CSigSharesManager::%s -- signing session timed out. signHash=%s, id=%s, msgHash=%s, sigShareCount=%d, missingMembers=%s\n", __func__,
1252+
LogPrint("llmq-sigs", "CSigSharesManager::%s -- signing session timed out. signHash=%s, id=%s, msgHash=%s, sigShareCount=%d, missingMembers=%s\n", __func__,
12531253
signHash.ToString(), oneSigShare.id.ToString(), oneSigShare.msgHash.ToString(), count, strMissingMembers);
12541254
} else {
1255-
LogPrint("llmq", "CSigSharesManager::%s -- signing session timed out. signHash=%s, sigShareCount=%d\n", __func__,
1255+
LogPrint("llmq-sigs", "CSigSharesManager::%s -- signing session timed out. signHash=%s, sigShareCount=%d\n", __func__,
12561256
signHash.ToString(), count);
12571257
}
12581258
RemoveSigSharesForSession(signHash);
@@ -1408,7 +1408,7 @@ void CSigSharesManager::Sign(const CQuorumCPtr& quorum, const uint256& id, const
14081408

14091409
CBLSSecretKey skShare = quorum->GetSkShare();
14101410
if (!skShare.IsValid()) {
1411-
LogPrint("llmq", "CSigSharesManager::%s -- we don't have our skShare for quorum %s\n", __func__, quorum->quorumHash.ToString());
1411+
LogPrint("llmq-sigs", "CSigSharesManager::%s -- we don't have our skShare for quorum %s\n", __func__, quorum->quorumHash.ToString());
14121412
return;
14131413
}
14141414

@@ -1435,7 +1435,7 @@ void CSigSharesManager::Sign(const CQuorumCPtr& quorum, const uint256& id, const
14351435

14361436
sigShare.UpdateKey();
14371437

1438-
LogPrint("llmq", "CSigSharesManager::%s -- signed sigShare. signHash=%s, id=%s, msgHash=%s, time=%s\n", __func__,
1438+
LogPrint("llmq-sigs", "CSigSharesManager::%s -- signed sigShare. signHash=%s, id=%s, msgHash=%s, time=%s\n", __func__,
14391439
signHash.ToString(), sigShare.id.ToString(), sigShare.msgHash.ToString(), t.count());
14401440
ProcessSigShare(-1, sigShare, *g_connman, quorum);
14411441
}

src/util.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,8 @@ bool LogAcceptCategory(const char* category)
286286
ptrCategory->insert(std::string("instantsend"));
287287
ptrCategory->insert(std::string("keepass"));
288288
ptrCategory->insert(std::string("llmq"));
289+
ptrCategory->insert(std::string("llmq-dkg"));
290+
ptrCategory->insert(std::string("llmq-sigs"));
289291
ptrCategory->insert(std::string("masternode"));
290292
ptrCategory->insert(std::string("mnpayments"));
291293
ptrCategory->insert(std::string("mnsync"));

0 commit comments

Comments
 (0)