From a99fe72cbe0449061cc6827ad351ed8367adf435 Mon Sep 17 00:00:00 2001 From: Odysseas Gabrielides Date: Thu, 20 Oct 2022 22:47:50 +0300 Subject: [PATCH] refactor: restrict some llmq logging to only debug=llmq (#5050) * llmq only logging * llmq only logging * style: reference on the left * refactoring * fix * style: fix colon location in for loop Co-authored-by: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com> --- src/llmq/dkgsession.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/llmq/dkgsession.cpp b/src/llmq/dkgsession.cpp index a82e5d09e3..b5ecafed47 100644 --- a/src/llmq/dkgsession.cpp +++ b/src/llmq/dkgsession.cpp @@ -85,14 +85,14 @@ bool CDKGSession::Init(const CBlockIndex* _pQuorumBaseBlockIndex, const std::vec CDKGLogger logger(*this, __func__); - if (utils::IsQuorumRotationEnabled(params.type, m_quorum_base_block_index)) { + if (LogAcceptCategory(BCLog::LLMQ) && utils::IsQuorumRotationEnabled(params.type, m_quorum_base_block_index)) { int cycleQuorumBaseHeight = m_quorum_base_block_index->nHeight - quorumIndex; const CBlockIndex* pCycleQuorumBaseBlockIndex = m_quorum_base_block_index->GetAncestor(cycleQuorumBaseHeight); std::stringstream ss; for (const auto& mn : members) { ss << mn->dmn->proTxHash.ToString().substr(0, 4) << " | "; } - LogPrintf("DKGComposition h[%d] i[%d] DKG:%s\n", pCycleQuorumBaseBlockIndex->nHeight, quorumIndex, ss.str()); + logger.Batch("DKGComposition h[%d] i[%d] DKG:%s", pCycleQuorumBaseBlockIndex->nHeight, quorumIndex, ss.str()); } if (mns.size() < size_t(params.minSize)) { @@ -103,11 +103,13 @@ bool CDKGSession::Init(const CBlockIndex* _pQuorumBaseBlockIndex, const std::vec if (!myProTxHash.IsNull()) { dkgDebugManager.InitLocalSessionStatus(params, quorumIndex, m_quorum_base_block_index->GetBlockHash(), m_quorum_base_block_index->nHeight); relayMembers = utils::GetQuorumRelayMembers(params, m_quorum_base_block_index, myProTxHash, true); - std::stringstream ss; - for (const auto& r : relayMembers) { - ss << r.ToString().substr(0, 4) << " | "; + if (LogAcceptCategory(BCLog::LLMQ)) { + std::stringstream ss; + for (const auto& r : relayMembers) { + ss << r.ToString().substr(0, 4) << " | "; + } + logger.Batch("forMember[%s] relayMembers[%s]", myProTxHash.ToString().substr(0, 4), ss.str()); } - logger.Batch("forMember[%s] relayMembers[%s]", myProTxHash.ToString().substr(0, 4), ss.str()); } if (myProTxHash.IsNull()) {