Skip to content

Commit 1cf7fb9

Browse files
committed
Merge bitcoin/bitcoin#23104: log: Avoid breaking single log lines over multiple lines in the log file
2222c04 log: Adjust coin selection log string (MarcoFalke) fa6c1e8 test: Fix typos in tests (MarcoFalke) faeae29 log: Avoid broken DEBUG_LOCKORDER log (MarcoFalke) faffaa8 log: Avoid broken SELECTCOINS log (MarcoFalke) Pull request description: Follow up to commit d8b4b30 ACKs for top commit: laanwj: re-ACK 2222c04 practicalswift: cr ACK 2222c04 Tree-SHA512: e0daf76815a1b7c4898ceffedeaf7ede093223abf709874f9a0d78c8e41551c14e8b56d055c8fdf06ec698df64e67dfc168bbd8716131b23648d1d1294fa6636
2 parents 7f81f54 + 2222c04 commit 1cf7fb9

File tree

4 files changed

+16
-13
lines changed

4 files changed

+16
-13
lines changed

src/sync.cpp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,27 +97,29 @@ static void potential_deadlock_detected(const LockPair& mismatch, const LockStac
9797
LogPrintf("POTENTIAL DEADLOCK DETECTED\n");
9898
LogPrintf("Previous lock order was:\n");
9999
for (const LockStackItem& i : s1) {
100+
std::string prefix{};
100101
if (i.first == mismatch.first) {
101-
LogPrintf(" (1)"); /* Continued */
102+
prefix = " (1)";
102103
}
103104
if (i.first == mismatch.second) {
104-
LogPrintf(" (2)"); /* Continued */
105+
prefix = " (2)";
105106
}
106-
LogPrintf(" %s\n", i.second.ToString());
107+
LogPrintf("%s %s\n", prefix, i.second.ToString());
107108
}
108109

109110
std::string mutex_a, mutex_b;
110111
LogPrintf("Current lock order is:\n");
111112
for (const LockStackItem& i : s2) {
113+
std::string prefix{};
112114
if (i.first == mismatch.first) {
113-
LogPrintf(" (1)"); /* Continued */
115+
prefix = " (1)";
114116
mutex_a = i.second.Name();
115117
}
116118
if (i.first == mismatch.second) {
117-
LogPrintf(" (2)"); /* Continued */
119+
prefix = " (2)";
118120
mutex_b = i.second.Name();
119121
}
120-
LogPrintf(" %s\n", i.second.ToString());
122+
LogPrintf("%s %s\n", prefix, i.second.ToString());
121123
}
122124
if (g_debug_lockorder_abort) {
123125
tfm::format(std::cerr, "Assertion failed: detected inconsistent lock order for %s, details in debug log.\n", s2.back().second.ToString());
@@ -131,10 +133,11 @@ static void double_lock_detected(const void* mutex, const LockStack& lock_stack)
131133
LogPrintf("DOUBLE LOCK DETECTED\n");
132134
LogPrintf("Lock order:\n");
133135
for (const LockStackItem& i : lock_stack) {
136+
std::string prefix{};
134137
if (i.first == mutex) {
135-
LogPrintf(" (*)"); /* Continued */
138+
prefix = " (*)";
136139
}
137-
LogPrintf(" %s\n", i.second.ToString());
140+
LogPrintf("%s %s\n", prefix, i.second.ToString());
138141
}
139142
if (g_debug_lockorder_abort) {
140143
tfm::format(std::cerr,

src/wallet/coinselection.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,13 +305,13 @@ bool KnapsackSolver(const CAmount& nTargetValue, std::vector<OutputGroup>& group
305305
}
306306

307307
if (LogAcceptCategory(BCLog::SELECTCOINS)) {
308-
LogPrint(BCLog::SELECTCOINS, "SelectCoins() best subset: "); /* Continued */
308+
std::string log_message{"Coin selection best subset: "};
309309
for (unsigned int i = 0; i < applicable_groups.size(); i++) {
310310
if (vfBest[i]) {
311-
LogPrint(BCLog::SELECTCOINS, "%s ", FormatMoney(applicable_groups[i].m_value)); /* Continued */
311+
log_message += strprintf("%s ", FormatMoney(applicable_groups[i].m_value));
312312
}
313313
}
314-
LogPrint(BCLog::SELECTCOINS, "total %s\n", FormatMoney(nBest));
314+
LogPrint(BCLog::SELECTCOINS, "%stotal %s\n", log_message, FormatMoney(nBest));
315315
}
316316
}
317317

test/functional/test_framework/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ def write_config(config_path, *, n, chain, extra_config="", disable_autoconnect=
366366
f.write("listenonion=0\n")
367367
# Increase peertimeout to avoid disconnects while using mocktime.
368368
# peertimeout is measured in wall clock time, so setting it to the
369-
# duration of the longest test is sufficient. It can be overriden in
369+
# duration of the longest test is sufficient. It can be overridden in
370370
# tests.
371371
f.write("peertimeout=999999\n")
372372
f.write("printtoconsole=0\n")

test/lint/lint-logs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# Check that all logs are terminated with '\n'
88
#
99
# Some logs are continued over multiple lines. They should be explicitly
10-
# commented with \* Continued *\
10+
# commented with /* Continued */
1111
#
1212
# There are some instances of LogPrintf() in comments. Those can be
1313
# ignored

0 commit comments

Comments
 (0)