Skip to content

Commit 82238e6

Browse files
committed
refactor: Set log level in LogAcceptCategory() to Debug by default
1 parent 89ca1ae commit 82238e6

File tree

9 files changed

+23
-23
lines changed

9 files changed

+23
-23
lines changed

src/llmq/commitment.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ bool CFinalCommitment::Verify(CDeterministicMNManager& dmnman, gsl::not_null<con
8282
return false;
8383
}
8484
auto members = utils::GetAllQuorumMembers(llmqType, dmnman, pQuorumBaseBlockIndex);
85-
if (LogAcceptCategory(BCLog::LLMQ, BCLog::Level::Debug)) {
85+
if (LogAcceptCategory(BCLog::LLMQ)) {
8686
std::stringstream ss;
8787
std::stringstream ss2;
8888
for (const auto i: irange::range(llmq_params.size)) {
@@ -106,7 +106,7 @@ bool CFinalCommitment::Verify(CDeterministicMNManager& dmnman, gsl::not_null<con
106106
// sigs are only checked when the block is processed
107107
if (checkSigs) {
108108
uint256 commitmentHash = BuildCommitmentHash(llmq_params.type, quorumHash, validMembers, quorumPublicKey, quorumVvecHash);
109-
if (LogAcceptCategory(BCLog::LLMQ, BCLog::Level::Debug)) {
109+
if (LogAcceptCategory(BCLog::LLMQ)) {
110110
std::stringstream ss3;
111111
for (const auto &mn: members) {
112112
ss3 << mn->proTxHash.ToString().substr(0, 4) << " | ";
@@ -181,7 +181,7 @@ bool CheckLLMQCommitment(CDeterministicMNManager& dmnman, const ChainstateManage
181181
return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-qc-commitment-type");
182182
}
183183

184-
if (LogAcceptCategory(BCLog::LLMQ, BCLog::Level::Debug)) {
184+
if (LogAcceptCategory(BCLog::LLMQ)) {
185185
std::stringstream ss;
186186
for (const auto i: irange::range(llmq_params_opt->size)) {
187187
ss << "v[" << i << "]=" << qcTx.commitment.validMembers[i];

src/llmq/dkgsession.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ bool CDKGSession::Init(const uint256& _myProTxHash, int _quorumIndex)
120120

121121
CDKGLogger logger(*this, __func__, __LINE__);
122122

123-
if (LogAcceptCategory(BCLog::LLMQ, BCLog::Level::Debug) && IsQuorumRotationEnabled(params, m_quorum_base_block_index)) {
123+
if (LogAcceptCategory(BCLog::LLMQ) && IsQuorumRotationEnabled(params, m_quorum_base_block_index)) {
124124
int cycleQuorumBaseHeight = m_quorum_base_block_index->nHeight - quorumIndex;
125125
const CBlockIndex* pCycleQuorumBaseBlockIndex = m_quorum_base_block_index->GetAncestor(cycleQuorumBaseHeight);
126126
std::stringstream ss;
@@ -138,7 +138,7 @@ bool CDKGSession::Init(const uint256& _myProTxHash, int _quorumIndex)
138138
if (!myProTxHash.IsNull()) {
139139
dkgDebugManager.InitLocalSessionStatus(params, quorumIndex, m_quorum_base_block_index->GetBlockHash(), m_quorum_base_block_index->nHeight);
140140
relayMembers = utils::GetQuorumRelayMembers(params, m_dmnman, m_quorum_base_block_index, myProTxHash, true);
141-
if (LogAcceptCategory(BCLog::LLMQ, BCLog::Level::Debug)) {
141+
if (LogAcceptCategory(BCLog::LLMQ)) {
142142
std::stringstream ss;
143143
for (const auto& r : relayMembers) {
144144
ss << r.ToString().substr(0, 4) << " | ";

src/llmq/instantsend.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ void CInstantSendManager::HandleNewInputLockRecoveredSig(const CRecoveredSig& re
639639
return;
640640
}
641641

642-
if (LogAcceptCategory(BCLog::INSTANTSEND, BCLog::Level::Debug)) {
642+
if (LogAcceptCategory(BCLog::INSTANTSEND)) {
643643
for (const auto& in : tx->vin) {
644644
auto id = ::SerializeHash(std::make_pair(INPUTLOCK_REQUESTID_PREFIX, in.prevout));
645645
if (id == recoveredSig.getId()) {
@@ -1469,7 +1469,7 @@ void CInstantSendManager::ProcessPendingRetryLockTxs()
14691469

14701470
// CheckCanLock is already called by ProcessTx, so we should avoid calling it twice. But we also shouldn't spam
14711471
// the logs when retrying TXs that are not ready yet.
1472-
if (LogAcceptCategory(BCLog::INSTANTSEND, BCLog::Level::Debug)) {
1472+
if (LogAcceptCategory(BCLog::INSTANTSEND)) {
14731473
if (!CheckCanLock(*tx, false, Params().GetConsensus())) {
14741474
continue;
14751475
}

src/llmq/signing_shares.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1334,7 +1334,7 @@ void CSigSharesManager::Cleanup()
13341334
const auto& oneSigShare = m->begin()->second;
13351335

13361336
std::string strMissingMembers;
1337-
if (LogAcceptCategory(BCLog::LLMQ_SIGS, BCLog::Level::Debug)) {
1337+
if (LogAcceptCategory(BCLog::LLMQ_SIGS)) {
13381338
if (const auto quorumIt = quorums.find(std::make_pair(oneSigShare.getLlmqType(), oneSigShare.getQuorumHash())); quorumIt != quorums.end()) {
13391339
const auto& quorum = quorumIt->second;
13401340
for (const auto i : irange::range(quorum->members.size())) {

src/llmq/utils.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ std::vector<std::vector<CDeterministicMNCPtr>> ComputeQuorumMembersByQuarterRota
216216
//TODO Check if it is triggered from outside (P2P, block validation). Throwing an exception is probably a wiser choice
217217
//assert (!newQuarterMembers.empty());
218218

219-
if (LogAcceptCategory(BCLog::LLMQ, BCLog::Level::Debug)) {
219+
if (LogAcceptCategory(BCLog::LLMQ)) {
220220
for (const size_t i : irange::range(nQuorums)) {
221221
std::stringstream ss;
222222

@@ -249,7 +249,7 @@ std::vector<std::vector<CDeterministicMNCPtr>> ComputeQuorumMembersByQuarterRota
249249
std::move(previousQuarters.quarterHMinusC[i].begin(), previousQuarters.quarterHMinusC[i].end(), std::back_inserter(quorumMembers[i]));
250250
std::move(newQuarterMembers[i].begin(), newQuarterMembers[i].end(), std::back_inserter(quorumMembers[i]));
251251

252-
if (LogAcceptCategory(BCLog::LLMQ, BCLog::Level::Debug)) {
252+
if (LogAcceptCategory(BCLog::LLMQ)) {
253253
std::stringstream ss;
254254
ss << " [";
255255
for (const auto &m: quorumMembers[i]) {
@@ -397,7 +397,7 @@ std::vector<std::vector<CDeterministicMNCPtr>> BuildNewQuorumQuarterMembers(cons
397397
sortedCombinedMnsList.push_back(std::move(m));
398398
}
399399

400-
if (LogAcceptCategory(BCLog::LLMQ, BCLog::Level::Debug)) {
400+
if (LogAcceptCategory(BCLog::LLMQ)) {
401401
std::stringstream ss;
402402
ss << " [";
403403
for (const auto &m: sortedCombinedMnsList) {
@@ -517,7 +517,7 @@ std::vector<std::vector<CDeterministicMNCPtr>> GetQuorumQuarterMembersBySnapshot
517517
std::move(sortedMnsUsedAtH.begin(), sortedMnsUsedAtH.end(), std::back_inserter(sortedCombinedMns));
518518
}
519519

520-
if (LogAcceptCategory(BCLog::LLMQ, BCLog::Level::Debug)) {
520+
if (LogAcceptCategory(BCLog::LLMQ)) {
521521
std::stringstream ss;
522522
ss << " [";
523523
for (const auto &m: sortedCombinedMns) {
@@ -789,7 +789,7 @@ bool EnsureQuorumConnections(const Consensus::LLMQParams& llmqParams, CConnman&
789789
}
790790
if (!connections.empty()) {
791791
if (!connman.HasMasternodeQuorumNodes(llmqParams.type, pQuorumBaseBlockIndex->GetBlockHash()) &&
792-
LogAcceptCategory(BCLog::LLMQ, BCLog::Level::Debug)) {
792+
LogAcceptCategory(BCLog::LLMQ)) {
793793
std::string debugMsg = strprintf("%s -- adding masternodes quorum connections for quorum %s:\n", __func__, pQuorumBaseBlockIndex->GetBlockHash().ToString());
794794
for (const auto& c : connections) {
795795
auto dmn = tip_mn_list.GetValidMN(c);
@@ -836,7 +836,7 @@ void AddQuorumProbeConnections(const Consensus::LLMQParams& llmqParams, CConnman
836836
}
837837

838838
if (!probeConnections.empty()) {
839-
if (LogAcceptCategory(BCLog::LLMQ, BCLog::Level::Debug)) {
839+
if (LogAcceptCategory(BCLog::LLMQ)) {
840840
std::string debugMsg = strprintf("%s -- adding masternodes probes for quorum %s:\n", __func__, pQuorumBaseBlockIndex->GetBlockHash().ToString());
841841
for (const auto& c : probeConnections) {
842842
auto dmn = tip_mn_list.GetValidMN(c);

src/logging.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ namespace BCLog {
226226
BCLog::Logger& LogInstance();
227227

228228
/** Return true if log accepts specified category, at the specified level. */
229-
static inline bool LogAcceptCategory(BCLog::LogFlags category, BCLog::Level level)
229+
static inline bool LogAcceptCategory(BCLog::LogFlags category, BCLog::Level level = BCLog::Level::Debug)
230230
{
231231
return LogInstance().WillLogCategoryLevel(category, level);
232232
}

src/qt/coincontroldialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,7 @@ void CoinControlDialog::updateView()
770770

771771
// CoinJoin rounds
772772
int nRounds = model->getRealOutpointCoinJoinRounds(output);
773-
if (nRounds >= 0 || LogAcceptCategory(BCLog::COINJOIN, BCLog::Level::Debug)) {
773+
if (nRounds >= 0 || LogAcceptCategory(BCLog::COINJOIN)) {
774774
itemOutput->setText(COLUMN_COINJOIN_ROUNDS, QString::number(nRounds));
775775
} else {
776776
itemOutput->setText(COLUMN_COINJOIN_ROUNDS, tr("n/a"));

src/wallet/wallet.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3432,11 +3432,11 @@ std::vector<CompactTallyItem> CWallet::SelectCoinsGroupedByAddresses(bool fSkipD
34323432
}
34333433

34343434
// debug
3435-
if (LogAcceptCategory(BCLog::SELECTCOINS, BCLog::Level::Debug)) {
3435+
if (LogAcceptCategory(BCLog::SELECTCOINS)) {
34363436
std::string strMessage = "SelectCoinsGroupedByAddresses - vecTallyRet:\n";
34373437
for (const auto& item : vecTallyRet)
34383438
strMessage += strprintf(" %s %f\n", EncodeDestination(item.txdest), float(item.nAmount)/COIN);
3439-
LogPrint(BCLog::SELECTCOINS, "%s", strMessage); /* Continued */
3439+
LogPrintf("%s", strMessage); /* Continued */
34403440
}
34413441

34423442
return vecTallyRet;

src/wallet/wallet.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,11 @@ extern const std::map<uint64_t,std::string> WALLET_FLAG_CAVEATS;
150150

151151
// Use a macro instead of a function for conditional logging to prevent
152152
// evaluating arguments when logging for the category is not enabled.
153-
#define WalletCJLogPrint(wallet, ...) \
154-
do { \
155-
if (LogAcceptCategory(BCLog::COINJOIN, BCLog::Level::Debug)) { \
156-
wallet->WalletLogPrintf(__VA_ARGS__); \
157-
} \
153+
#define WalletCJLogPrint(wallet, ...) \
154+
do { \
155+
if (LogAcceptCategory(BCLog::COINJOIN)) { \
156+
wallet->WalletLogPrintf(__VA_ARGS__); \
157+
} \
158158
} while (0)
159159

160160
/** A wrapper to reserve an address from a wallet

0 commit comments

Comments
 (0)