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>
This commit is contained in:
Odysseas Gabrielides 2022-10-20 22:47:50 +03:00 committed by GitHub
parent fa84fc5634
commit a99fe72cbe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -85,14 +85,14 @@ bool CDKGSession::Init(const CBlockIndex* _pQuorumBaseBlockIndex, const std::vec
CDKGLogger logger(*this, __func__); 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; int cycleQuorumBaseHeight = m_quorum_base_block_index->nHeight - quorumIndex;
const CBlockIndex* pCycleQuorumBaseBlockIndex = m_quorum_base_block_index->GetAncestor(cycleQuorumBaseHeight); const CBlockIndex* pCycleQuorumBaseBlockIndex = m_quorum_base_block_index->GetAncestor(cycleQuorumBaseHeight);
std::stringstream ss; std::stringstream ss;
for (const auto& mn : members) { for (const auto& mn : members) {
ss << mn->dmn->proTxHash.ToString().substr(0, 4) << " | "; 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)) { if (mns.size() < size_t(params.minSize)) {
@ -103,11 +103,13 @@ bool CDKGSession::Init(const CBlockIndex* _pQuorumBaseBlockIndex, const std::vec
if (!myProTxHash.IsNull()) { if (!myProTxHash.IsNull()) {
dkgDebugManager.InitLocalSessionStatus(params, quorumIndex, m_quorum_base_block_index->GetBlockHash(), m_quorum_base_block_index->nHeight); 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); relayMembers = utils::GetQuorumRelayMembers(params, m_quorum_base_block_index, myProTxHash, true);
std::stringstream ss; if (LogAcceptCategory(BCLog::LLMQ)) {
for (const auto& r : relayMembers) { std::stringstream ss;
ss << r.ToString().substr(0, 4) << " | "; 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()) { if (myProTxHash.IsNull()) {