mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-22 15:04:44 +01:00
Merge bitcoin/bitcoin#23104: log: Avoid breaking single log lines over multiple lines in the log file
2222c04e1b
log: Adjust coin selection log string (MarcoFalke)fa6c1e850f
test: Fix typos in tests (MarcoFalke)faeae2980f
log: Avoid broken DEBUG_LOCKORDER log (MarcoFalke)faffaa85cd
log: Avoid broken SELECTCOINS log (MarcoFalke) Pull request description: Follow up to commitd8b4b3077f
ACKs for top commit: laanwj: re-ACK2222c04e1b
practicalswift: cr ACK2222c04e1b
Tree-SHA512: e0daf76815a1b7c4898ceffedeaf7ede093223abf709874f9a0d78c8e41551c14e8b56d055c8fdf06ec698df64e67dfc168bbd8716131b23648d1d1294fa6636
This commit is contained in:
commit
1cf7fb9fd6
4 changed files with 16 additions and 13 deletions
19
src/sync.cpp
19
src/sync.cpp
|
@ -97,27 +97,29 @@ static void potential_deadlock_detected(const LockPair& mismatch, const LockStac
|
||||||
LogPrintf("POTENTIAL DEADLOCK DETECTED\n");
|
LogPrintf("POTENTIAL DEADLOCK DETECTED\n");
|
||||||
LogPrintf("Previous lock order was:\n");
|
LogPrintf("Previous lock order was:\n");
|
||||||
for (const LockStackItem& i : s1) {
|
for (const LockStackItem& i : s1) {
|
||||||
|
std::string prefix{};
|
||||||
if (i.first == mismatch.first) {
|
if (i.first == mismatch.first) {
|
||||||
LogPrintf(" (1)"); /* Continued */
|
prefix = " (1)";
|
||||||
}
|
}
|
||||||
if (i.first == mismatch.second) {
|
if (i.first == mismatch.second) {
|
||||||
LogPrintf(" (2)"); /* Continued */
|
prefix = " (2)";
|
||||||
}
|
}
|
||||||
LogPrintf(" %s\n", i.second.ToString());
|
LogPrintf("%s %s\n", prefix, i.second.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string mutex_a, mutex_b;
|
std::string mutex_a, mutex_b;
|
||||||
LogPrintf("Current lock order is:\n");
|
LogPrintf("Current lock order is:\n");
|
||||||
for (const LockStackItem& i : s2) {
|
for (const LockStackItem& i : s2) {
|
||||||
|
std::string prefix{};
|
||||||
if (i.first == mismatch.first) {
|
if (i.first == mismatch.first) {
|
||||||
LogPrintf(" (1)"); /* Continued */
|
prefix = " (1)";
|
||||||
mutex_a = i.second.Name();
|
mutex_a = i.second.Name();
|
||||||
}
|
}
|
||||||
if (i.first == mismatch.second) {
|
if (i.first == mismatch.second) {
|
||||||
LogPrintf(" (2)"); /* Continued */
|
prefix = " (2)";
|
||||||
mutex_b = i.second.Name();
|
mutex_b = i.second.Name();
|
||||||
}
|
}
|
||||||
LogPrintf(" %s\n", i.second.ToString());
|
LogPrintf("%s %s\n", prefix, i.second.ToString());
|
||||||
}
|
}
|
||||||
if (g_debug_lockorder_abort) {
|
if (g_debug_lockorder_abort) {
|
||||||
tfm::format(std::cerr, "Assertion failed: detected inconsistent lock order for %s, details in debug log.\n", s2.back().second.ToString());
|
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)
|
||||||
LogPrintf("DOUBLE LOCK DETECTED\n");
|
LogPrintf("DOUBLE LOCK DETECTED\n");
|
||||||
LogPrintf("Lock order:\n");
|
LogPrintf("Lock order:\n");
|
||||||
for (const LockStackItem& i : lock_stack) {
|
for (const LockStackItem& i : lock_stack) {
|
||||||
|
std::string prefix{};
|
||||||
if (i.first == mutex) {
|
if (i.first == mutex) {
|
||||||
LogPrintf(" (*)"); /* Continued */
|
prefix = " (*)";
|
||||||
}
|
}
|
||||||
LogPrintf(" %s\n", i.second.ToString());
|
LogPrintf("%s %s\n", prefix, i.second.ToString());
|
||||||
}
|
}
|
||||||
if (g_debug_lockorder_abort) {
|
if (g_debug_lockorder_abort) {
|
||||||
tfm::format(std::cerr,
|
tfm::format(std::cerr,
|
||||||
|
|
|
@ -305,13 +305,13 @@ bool KnapsackSolver(const CAmount& nTargetValue, std::vector<OutputGroup>& group
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LogAcceptCategory(BCLog::SELECTCOINS)) {
|
if (LogAcceptCategory(BCLog::SELECTCOINS)) {
|
||||||
LogPrint(BCLog::SELECTCOINS, "SelectCoins() best subset: "); /* Continued */
|
std::string log_message{"Coin selection best subset: "};
|
||||||
for (unsigned int i = 0; i < applicable_groups.size(); i++) {
|
for (unsigned int i = 0; i < applicable_groups.size(); i++) {
|
||||||
if (vfBest[i]) {
|
if (vfBest[i]) {
|
||||||
LogPrint(BCLog::SELECTCOINS, "%s ", FormatMoney(applicable_groups[i].m_value)); /* Continued */
|
log_message += strprintf("%s ", FormatMoney(applicable_groups[i].m_value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LogPrint(BCLog::SELECTCOINS, "total %s\n", FormatMoney(nBest));
|
LogPrint(BCLog::SELECTCOINS, "%stotal %s\n", log_message, FormatMoney(nBest));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -366,7 +366,7 @@ def write_config(config_path, *, n, chain, extra_config="", disable_autoconnect=
|
||||||
f.write("listenonion=0\n")
|
f.write("listenonion=0\n")
|
||||||
# Increase peertimeout to avoid disconnects while using mocktime.
|
# Increase peertimeout to avoid disconnects while using mocktime.
|
||||||
# peertimeout is measured in wall clock time, so setting it to the
|
# peertimeout is measured in wall clock time, so setting it to the
|
||||||
# duration of the longest test is sufficient. It can be overriden in
|
# duration of the longest test is sufficient. It can be overridden in
|
||||||
# tests.
|
# tests.
|
||||||
f.write("peertimeout=999999\n")
|
f.write("peertimeout=999999\n")
|
||||||
f.write("printtoconsole=0\n")
|
f.write("printtoconsole=0\n")
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
# Check that all logs are terminated with '\n'
|
# Check that all logs are terminated with '\n'
|
||||||
#
|
#
|
||||||
# Some logs are continued over multiple lines. They should be explicitly
|
# Some logs are continued over multiple lines. They should be explicitly
|
||||||
# commented with \* Continued *\
|
# commented with /* Continued */
|
||||||
#
|
#
|
||||||
# There are some instances of LogPrintf() in comments. Those can be
|
# There are some instances of LogPrintf() in comments. Those can be
|
||||||
# ignored
|
# ignored
|
||||||
|
|
Loading…
Add table
Reference in a new issue