From 62be40dd7df1925e156a311317f42eb95ff7800c Mon Sep 17 00:00:00 2001 From: DCG-Claude Date: Tue, 22 Sep 2026 10:11:27 -0500 Subject: [PATCH 1/4] Merge bitcoin/bitcoin#26296: ci: Integrate `bitcoin-tidy` clang-tidy plugin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1c976c691cc4b20f43071aabf36c7afed1571057 tidy: Integrate bicoin-tidy clang-tidy plugin (fanquake) 7de23cceb8ac13fcc709453ef0fa14fb93c460b0 refactor: fix unterminated LogPrintf()s (fanquake) 0a1029aa2946787bfe91a84de882c2dd0de076e9 lint: remove /* Continued */ markers from codebase (fanquake) 910007995d8603ffc466878856227153a638caff lint: remove lint-logs.py (fanquake) d86a83d6b8587b0971e66c6910af23dd8c042969 lint: drop DIR_IWYU global (fanquake) Pull request description: Demo of integrating the [bitcoin-tidy](https://github.com/theuni/bitcoin-tidy-plugin), [clang-tidy plugin](https://clang.llvm.org/extra/clang-tidy/) written by theuni into our tidy CI job. The plugin currently has a single check, `bitcoin-unterminated-logprintf`. This would replace our current Python driven, `git-grep`-based, `.cpp` file only, lint-logs linter. ACKs for top commit: TheCharlatan: ACK 1c976c691cc4b20f43071aabf36c7afed1571057 theuni: ACK 1c976c691cc4b20f43071aabf36c7afed1571057 MarcoFalke: re-ACK 1c976c691cc4b20f43071aabf36c7afed1571057 👠 Tree-SHA512: 725b45c70e431d48e6f276671e05c694e10b6047cae1a31906ac3ee9093bc8105fb226b36a5bac6709557526ca6007222112d66aecec05a574434edc4897e4b8 Dash adaptations: - {'file': 'ci/dash/lint-tidy.sh', 'what': 'Upstream added the bitcoin-tidy plugin build and the run-clang-tidy `-load=` flag to ci/test/06_script_b.sh. Dash has no ci/test/06_script_b.sh; its clang-tidy job lives in ci/dash/lint-tidy.sh (driven from ci/dash/build_src.sh). Added the same three cmake invocations (configure /tidy-build from contrib/devtools/bitcoin-tidy, build, build target bitcoin-tidy-tests) right after the ctcache `--zero-stats` line, and added `-load="/tidy-build/libbitcoin-tidy.so"` to the run-clang-tidy invocation.'} - {'file': 'ci/dash/lint-tidy.sh', 'what': 'Upstream passes `-DLLVM_DIR=/usr/lib/llvm-${LLVM_VERSION}/lib/cmake/llvm`. In Dash, LLVM_VERSION is a Dockerfile ARG (build-time only) and is not in the CI runtime environment, so the same directory is obtained with `-DLLVM_DIR="$(llvm-config --cmakedir)"`.'} - {'file': 'src/init.cpp', 'what': 'Upstream\'s hunk removing the `/* Continued */` marker from the relative-datadir warning rewrites the following line; kept Dash\'s branding ("Dash Core" instead of "Bitcoin Core") in that continuation string.'} - {'file': 'src/test/logging_tests.cpp', 'what': "Upstream converts four `LogPrintf_` calls in logging_tests to the terminated form. Dash's test has six calls (extra BCLog::Level::Info / BCLog::LogFlags::ALL variants where upstream has Level::None / LogFlags::NONE); all six were converted the same way."} - {'file': 'test/lint/lint-format-strings.py', 'what': "Added `contrib/devtools/bitcoin-tidy/example_logprintf.cpp` to the exclusion regex, preserving Dash's existing exclusion list (dashbls, leveldb, secp256k1, minisketch, tinyformat, test/fuzz/strprintf.cpp, clientversion.cpp)."} - {'file': 'test/lint/lint-include-guards.py', 'what': "Added `contrib/devtools/bitcoin-tidy` to EXCLUDE_FILES_WITH_PREFIX, which in Dash is a local list concatenated with SHARED_EXCLUDED_SUBTREES from test/lint/lint_ignore_dirs.py rather than upstream's flat literal list."} - {'file': 'test/lint/lint-includes.py', 'what': 'Upstream adds `contrib/devtools/bitcoin-tidy/` to this file\'s local EXCLUDED_DIRS. Dash had replaced EXCLUDED_DIRS with the shared SHARED_EXCLUDED_SUBTREES list (also used by lint-spelling.py and lint-include-guards.py). Reintroduced a file-local `EXCLUDED_DIRS = ["contrib/devtools/bitcoin-tidy/"] + SHARED_EXCLUDED_SUBTREES` and pointed both use sites (list_files_by_suffix, find_quote_syntax_inclusions) at it, so the new exclusion applies only to lint-includes.py, as upstream intended.'} - {'file': 'src/coinjoin/client.cpp', 'what': "Dash-only call sites. Upstream's sweep removes every `/* Continued */` marker (the marker existed only for the now-deleted test/lint/lint-logs.py) and adds `// NOLINT(bitcoin-unterminated-logprintf)` where the format string genuinely does not end in \\n. Applied to the Dash-only markers in this file; one site (`WalletCJLogPrint(/* Continued */` on its own line followed by `m_wallet,`) collapses to `WalletCJLogPrint(m_wallet,` now that the marker is gone."} - {'file': 'src/coinjoin/server.cpp', 'what': 'Dash-only `/* Continued */` markers removed; `// NOLINT(bitcoin-unterminated-logprintf)` added at the six sites whose format string is genuinely unterminated (lines 81, 213, 410, 425, 531, 562).'} - {'file': 'src/coinjoin/coinjoin.cpp', 'what': 'Dash-only `/* Continued */` markers removed; NOLINT added at the three unterminated LogPrint sites.'} - {'file': 'src/masternode/payments.cpp', 'what': 'Dash-only `/* Continued */` markers removed; NOLINT added at the six unterminated LogPrintf/LogPrint sites.'} - {'file': 'src/governance/object.cpp', 'what': 'Dash-only `/* Continued */` marker removed; NOLINT added (RemoveInvalidVotes log line ends with %s).'} Not applicable to Dash (intentionally omitted): - ci/test/01_base_install.sh: - ci/test/06_script_b.sh: - ci/test/00_setup_env.sh: --- ci/dash/lint-tidy.sh | 7 ++ contrib/devtools/bitcoin-tidy/CMakeLists.txt | 45 +++++++++ contrib/devtools/bitcoin-tidy/README | 8 ++ .../devtools/bitcoin-tidy/bitcoin-tidy.cpp | 22 +++++ .../bitcoin-tidy/example_logprintf.cpp | 91 +++++++++++++++++++ contrib/devtools/bitcoin-tidy/logprintf.cpp | 62 +++++++++++++ contrib/devtools/bitcoin-tidy/logprintf.h | 28 ++++++ src/.clang-tidy | 1 + src/chainlock/signing.cpp | 2 +- src/coinjoin/client.cpp | 21 ++--- src/coinjoin/coinjoin.cpp | 6 +- src/coinjoin/server.cpp | 24 ++--- src/coinjoin/walletman.cpp | 2 +- src/dbwrapper.cpp | 2 +- src/evo/creditpool.cpp | 2 +- src/evo/specialtxman.cpp | 4 +- src/flat-database.h | 2 +- src/governance/governance.cpp | 2 +- src/governance/net_governance.cpp | 2 +- src/governance/object.cpp | 2 +- src/governance/signing.cpp | 4 +- src/governance/superblock.cpp | 4 +- src/gsl/assert.cpp | 2 +- src/index/base.cpp | 6 +- src/init.cpp | 4 +- src/instantsend/net_instantsend.cpp | 4 +- src/llmq/blockprocessor.cpp | 10 +- src/llmq/net_dkg.cpp | 2 +- src/llmq/net_quorum.cpp | 2 +- src/llmq/signing_shares.cpp | 14 +-- src/masternode/payments.cpp | 12 +-- src/net_processing.cpp | 2 +- src/node/sync_manager.cpp | 2 +- src/node/utxo_snapshot.cpp | 4 +- src/rpc/governance.cpp | 2 +- src/rpc/util.cpp | 2 +- src/stacktraces.cpp | 2 +- src/sync.cpp | 2 +- src/test/logging_tests.cpp | 12 +-- src/test/util/chainstate.h | 2 +- src/validation.cpp | 18 ++-- src/wallet/coinjoin.cpp | 2 +- src/wallet/init.cpp | 2 +- src/wallet/wallet.cpp | 2 +- test/lint/lint-format-strings.py | 2 +- test/lint/lint-include-guards.py | 3 +- test/lint/lint-includes.py | 6 +- test/lint/lint-logs.py | 34 ------- 48 files changed, 365 insertions(+), 133 deletions(-) create mode 100644 contrib/devtools/bitcoin-tidy/CMakeLists.txt create mode 100644 contrib/devtools/bitcoin-tidy/README create mode 100644 contrib/devtools/bitcoin-tidy/bitcoin-tidy.cpp create mode 100644 contrib/devtools/bitcoin-tidy/example_logprintf.cpp create mode 100644 contrib/devtools/bitcoin-tidy/logprintf.cpp create mode 100644 contrib/devtools/bitcoin-tidy/logprintf.h delete mode 100755 test/lint/lint-logs.py diff --git a/ci/dash/lint-tidy.sh b/ci/dash/lint-tidy.sh index 104ae29083e3..43d83ff3ba71 100755 --- a/ci/dash/lint-tidy.sh +++ b/ci/dash/lint-tidy.sh @@ -64,6 +64,12 @@ fi # Zero stats before run to get accurate statistics for this run only python3 "${CLANG_TIDY_CACHE_PY}" --zero-stats 2>&1 || true +# Build the bitcoin-tidy clang-tidy plugin, which implements the +# bitcoin-* checks enabled in src/.clang-tidy +cmake -B /tidy-build -DLLVM_DIR="$(llvm-config --cmakedir)" -DCMAKE_BUILD_TYPE=Release -S "${BASE_ROOT_DIR}/contrib/devtools/bitcoin-tidy" +cmake --build /tidy-build "${MAKEJOBS}" +cmake --build /tidy-build --target bitcoin-tidy-tests "${MAKEJOBS}" + cd "${BASE_ROOT_DIR}/build-ci/dashcore-${BUILD_TARGET}/src" CAST_LINT_DB="${PWD}/../cstyle-cast-compile-db" @@ -76,6 +82,7 @@ if ! ( run-clang-tidy \ -checks=clang-diagnostic-old-style-cast,google-readability-casting \ -warnings-as-errors=-clang-diagnostic-old-style-cast,-google-readability-casting \ -clang-tidy-binary="${CLANG_TIDY_CACHE}" \ + -load="/tidy-build/libbitcoin-tidy.so" \ -p "${CAST_LINT_DB}" \ -quiet "${MAKEJOBS}" | \ python3 "${BASE_ROOT_DIR}/ci/dash/lint-cstyle-casts.py" filter --source-root "${BASE_ROOT_DIR}" | \ diff --git a/contrib/devtools/bitcoin-tidy/CMakeLists.txt b/contrib/devtools/bitcoin-tidy/CMakeLists.txt new file mode 100644 index 000000000000..9ed18696d41b --- /dev/null +++ b/contrib/devtools/bitcoin-tidy/CMakeLists.txt @@ -0,0 +1,45 @@ +cmake_minimum_required(VERSION 3.9) + +project(bitcoin-tidy VERSION 1.0.0 DESCRIPTION "clang-tidy checks for Bitcoin Core") + +include(GNUInstallDirs) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED True) +set(CMAKE_CXX_EXTENSIONS False) + +# TODO: Figure out how to avoid the terminfo check +find_package(LLVM REQUIRED CONFIG) +find_program(CLANG_TIDY_EXE NAMES "clang-tidy-${LLVM_VERSION_MAJOR}" "clang-tidy" HINTS ${LLVM_TOOLS_BINARY_DIR}) +message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}") +message(STATUS "Found clang-tidy: ${CLANG_TIDY_EXE}") + +add_library(bitcoin-tidy MODULE bitcoin-tidy.cpp logprintf.cpp) +target_include_directories(bitcoin-tidy SYSTEM PRIVATE ${LLVM_INCLUDE_DIRS}) + +# Disable RTTI and exceptions as necessary +if (MSVC) + target_compile_options(bitcoin-tidy PRIVATE /GR-) +else() + target_compile_options(bitcoin-tidy PRIVATE -fno-rtti) + target_compile_options(bitcoin-tidy PRIVATE -fno-exceptions) +endif() + +# Add warnings +if (MSVC) + target_compile_options(bitcoin-tidy PRIVATE /W4) +else() + target_compile_options(bitcoin-tidy PRIVATE -Wall) + target_compile_options(bitcoin-tidy PRIVATE -Wextra) +endif() + +set(CLANG_TIDY_COMMAND "${CLANG_TIDY_EXE}" "--load=${CMAKE_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}bitcoin-tidy${CMAKE_SHARED_LIBRARY_SUFFIX}" "-checks=-*,bitcoin-*") + +# Create a dummy library that runs clang-tidy tests as a side-effect of building +add_library(bitcoin-tidy-tests OBJECT EXCLUDE_FROM_ALL example_logprintf.cpp) +add_dependencies(bitcoin-tidy-tests bitcoin-tidy) + +set_target_properties(bitcoin-tidy-tests PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_COMMAND}") + + +install(TARGETS bitcoin-tidy LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/contrib/devtools/bitcoin-tidy/README b/contrib/devtools/bitcoin-tidy/README new file mode 100644 index 000000000000..1669fe98f57f --- /dev/null +++ b/contrib/devtools/bitcoin-tidy/README @@ -0,0 +1,8 @@ +# Bitcoin Tidy + +Example Usage: + +```bash +cmake -S . -B build -DLLVM_DIR=/path/to/lib/cmake/llvm -DCMAKE_BUILD_TYPE=Release +make -C build -j$(nproc) +``` diff --git a/contrib/devtools/bitcoin-tidy/bitcoin-tidy.cpp b/contrib/devtools/bitcoin-tidy/bitcoin-tidy.cpp new file mode 100644 index 000000000000..0f34d3779387 --- /dev/null +++ b/contrib/devtools/bitcoin-tidy/bitcoin-tidy.cpp @@ -0,0 +1,22 @@ +// Copyright (c) 2023 Bitcoin Developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#include "logprintf.h" + +#include +#include + +class BitcoinModule final : public clang::tidy::ClangTidyModule +{ +public: + void addCheckFactories(clang::tidy::ClangTidyCheckFactories& CheckFactories) override + { + CheckFactories.registerCheck("bitcoin-unterminated-logprintf"); + } +}; + +static clang::tidy::ClangTidyModuleRegistry::Add + X("bitcoin-module", "Adds bitcoin checks."); + +volatile int BitcoinModuleAnchorSource = 0; diff --git a/contrib/devtools/bitcoin-tidy/example_logprintf.cpp b/contrib/devtools/bitcoin-tidy/example_logprintf.cpp new file mode 100644 index 000000000000..a3d2768964cc --- /dev/null +++ b/contrib/devtools/bitcoin-tidy/example_logprintf.cpp @@ -0,0 +1,91 @@ +// Copyright (c) 2023 Bitcoin Developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +// Warn about any use of LogPrintf that does not end with a newline. +#include + +enum LogFlags { + NONE +}; + +enum Level { + None +}; + +template +static inline void LogPrintf_(const std::string& logging_function, const std::string& source_file, const int source_line, const LogFlags flag, const Level level, const char* fmt, const Args&... args) +{ +} + +#define LogPrintLevel_(category, level, ...) LogPrintf_(__func__, __FILE__, __LINE__, category, level, __VA_ARGS__) +#define LogPrintf(...) LogPrintLevel_(LogFlags::NONE, Level::None, __VA_ARGS__) + +// Use a macro instead of a function for conditional logging to prevent +// evaluating arguments when logging for the category is not enabled. +#define LogPrint(category, ...) \ + do { \ + LogPrintf(__VA_ARGS__); \ + } while (0) + + +class CWallet +{ + std::string GetDisplayName() const + { + return "default wallet"; + } + +public: + template + void WalletLogPrintf(std::string fmt, Params... parameters) const + { + LogPrintf(("%s " + fmt).c_str(), GetDisplayName(), parameters...); + }; +}; + +void good_func() +{ + LogPrintf("hello world!\n"); +} +void good_func2() +{ + CWallet wallet; + wallet.WalletLogPrintf("hi\n"); + + const CWallet& walletref = wallet; + walletref.WalletLogPrintf("hi\n"); + + auto* walletptr = new CWallet(); + walletptr->WalletLogPrintf("hi\n"); + delete walletptr; +} +void bad_func() +{ + LogPrintf("hello world!"); +} +void bad_func2() +{ + LogPrintf(""); +} +void bad_func3() +{ + // Ending in "..." has no special meaning. + LogPrintf("hello world!..."); +} +void bad_func4_ignored() +{ + LogPrintf("hello world!"); // NOLINT(bitcoin-unterminated-logprintf) +} +void bad_func5() +{ + CWallet wallet; + wallet.WalletLogPrintf("hi"); + + const CWallet& walletref = wallet; + walletref.WalletLogPrintf("hi"); + + auto* walletptr = new CWallet(); + walletptr->WalletLogPrintf("hi"); + delete walletptr; +} diff --git a/contrib/devtools/bitcoin-tidy/logprintf.cpp b/contrib/devtools/bitcoin-tidy/logprintf.cpp new file mode 100644 index 000000000000..1690c8fde0a6 --- /dev/null +++ b/contrib/devtools/bitcoin-tidy/logprintf.cpp @@ -0,0 +1,62 @@ +// Copyright (c) 2023 Bitcoin Developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#include "logprintf.h" + +#include +#include + + +namespace { +AST_MATCHER(clang::StringLiteral, unterminated) +{ + size_t len = Node.getLength(); + if (len > 0 && Node.getCodeUnit(len - 1) == '\n') { + return false; + } + return true; +} +} // namespace + +namespace bitcoin { + +void LogPrintfCheck::registerMatchers(clang::ast_matchers::MatchFinder* finder) +{ + using namespace clang::ast_matchers; + + /* + Logprintf(..., ..., ..., ..., ..., "foo", ...) + */ + + finder->addMatcher( + callExpr( + callee(functionDecl(hasName("LogPrintf_"))), + hasArgument(5, stringLiteral(unterminated()).bind("logstring"))), + this); + + /* + CWallet wallet; + auto walletptr = &wallet; + wallet.WalletLogPrintf("foo"); + wallet->WalletLogPrintf("foo"); + */ + finder->addMatcher( + cxxMemberCallExpr( + thisPointerType(qualType(hasDeclaration(cxxRecordDecl(hasName("CWallet"))))), + callee(cxxMethodDecl(hasName("WalletLogPrintf"))), + hasArgument(0, stringLiteral(unterminated()).bind("logstring"))), + this); +} + +void LogPrintfCheck::check(const clang::ast_matchers::MatchFinder::MatchResult& Result) +{ + if (const clang::StringLiteral* lit = Result.Nodes.getNodeAs("logstring")) { + const clang::ASTContext& ctx = *Result.Context; + const auto user_diag = diag(lit->getEndLoc(), "Unterminated format string used with LogPrintf"); + const auto& loc = lit->getLocationOfByte(lit->getByteLength(), *Result.SourceManager, ctx.getLangOpts(), ctx.getTargetInfo()); + user_diag << clang::FixItHint::CreateInsertion(loc, "\\n"); + } +} + +} // namespace bitcoin diff --git a/contrib/devtools/bitcoin-tidy/logprintf.h b/contrib/devtools/bitcoin-tidy/logprintf.h new file mode 100644 index 000000000000..466849ef0114 --- /dev/null +++ b/contrib/devtools/bitcoin-tidy/logprintf.h @@ -0,0 +1,28 @@ +// Copyright (c) 2023 Bitcoin Developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#ifndef LOGPRINTF_CHECK_H +#define LOGPRINTF_CHECK_H + +#include + +namespace bitcoin { + +class LogPrintfCheck final : public clang::tidy::ClangTidyCheck +{ +public: + LogPrintfCheck(clang::StringRef Name, clang::tidy::ClangTidyContext* Context) + : clang::tidy::ClangTidyCheck(Name, Context) {} + + bool isLanguageVersionSupported(const clang::LangOptions& LangOpts) const override + { + return LangOpts.CPlusPlus; + } + void registerMatchers(clang::ast_matchers::MatchFinder* Finder) override; + void check(const clang::ast_matchers::MatchFinder::MatchResult& Result) override; +}; + +} // namespace bitcoin + +#endif // LOGPRINTF_CHECK_H diff --git a/src/.clang-tidy b/src/.clang-tidy index 8f1b842bb0ce..11cb5fbaf8a5 100644 --- a/src/.clang-tidy +++ b/src/.clang-tidy @@ -1,5 +1,6 @@ Checks: ' -*, +bitcoin-unterminated-logprintf, bugprone-argument-comment, bugprone-use-after-move, misc-unused-using-decls, diff --git a/src/chainlock/signing.cpp b/src/chainlock/signing.cpp index 3fe4f4e6e413..bc198c354395 100644 --- a/src/chainlock/signing.cpp +++ b/src/chainlock/signing.cpp @@ -149,7 +149,7 @@ void ChainLockSigner::TrySignChainTip() for (const auto& txid : *txids) { if (!m_clhandler.IsTxSafeForMining(txid) && !m_isman.IsLocked(txid)) { - LogPrint(BCLog::CHAINLOCKS, /* Continued */ + LogPrint(BCLog::CHAINLOCKS, "%s -- not signing block %s due to TX %s not being islocked and not old enough.\n", __func__, pindexWalk->GetBlockHash().ToString(), txid.ToString()); return; diff --git a/src/coinjoin/client.cpp b/src/coinjoin/client.cpp index 27dde4e95fa6..8653775e213e 100644 --- a/src/coinjoin/client.cpp +++ b/src/coinjoin/client.cpp @@ -117,7 +117,7 @@ void CCoinJoinClientSession::ProcessMessage(CNode& peer, Chainstate& active_chai return; } - WalletCJLogPrint(m_wallet, "DSFINALTX -- txNew %s", txNew.ToString()); /* Continued */ + WalletCJLogPrint(m_wallet, "DSFINALTX -- txNew %s", txNew.ToString()); // NOLINT(bitcoin-unterminated-logprintf) // check to see if input is spent already? (and probably not confirmed) SignFinalTransaction(peer, active_chainstate, connman, mempool, txNew); @@ -478,7 +478,7 @@ bool CCoinJoinClientSession::SignFinalTransaction(CNode& peer, Chainstate& activ LOCK(cs_coinjoin); finalMutableTransaction = CMutableTransaction{finalTransactionNew}; - WalletCJLogPrint(m_wallet, "CCoinJoinClientSession::%s -- finalMutableTransaction=%s", __func__, finalMutableTransaction.ToString()); /* Continued */ + WalletCJLogPrint(m_wallet, "CCoinJoinClientSession::%s -- finalMutableTransaction=%s", __func__, finalMutableTransaction.ToString()); // NOLINT(bitcoin-unterminated-logprintf) // STEP 1: check final transaction general rules @@ -621,7 +621,7 @@ bool CCoinJoinClientSession::SignFinalTransaction(CNode& peer, Chainstate& activ } // push all of our signatures to the Masternode - WalletCJLogPrint(m_wallet, "CCoinJoinClientSession::%s -- pushing signed inputs to the masternode, finalMutableTransaction=%s", __func__, finalMutableTransaction.ToString()); /* Continued */ + WalletCJLogPrint(m_wallet, "CCoinJoinClientSession::%s -- pushing signed inputs to the masternode, finalMutableTransaction=%s", __func__, finalMutableTransaction.ToString()); // NOLINT(bitcoin-unterminated-logprintf) CNetMsgMaker msgMaker(peer.GetCommonVersion()); connman.PushMessage(&peer, msgMaker.Make(NetMsgType::DSSIGNFINALTX, signed_inputs)); SetState(POOL_STATE_SIGNING); @@ -725,7 +725,7 @@ void CCoinJoinClientManager::AddPendingObservation(const std::vector& // runs, but a restart would make them selectable again while a valid mixing // transaction spending them may already be in flight. Nothing we can do about // it here beyond making the failure loud - the wallet database is broken. - LogPrintf("CCoinJoinClientManager::%s -- ERROR: failed to persist locks for %d successfully mixed input(s), " /* Continued */ + LogPrintf("CCoinJoinClientManager::%s -- ERROR: failed to persist locks for %d successfully mixed input(s), " "they will not survive a restart\n", __func__, outpoints.size()); } @@ -759,7 +759,7 @@ void CCoinJoinClientManager::LoadPendingObservations(wallet::WalletBatch& batch) // never becomes readable, and the retry runs for as long as this node does. if (!m_pending_obs_load_failed) { m_pending_obs_load_failed = true; - LogPrintf("CCoinJoinClientManager::%s -- ERROR: failed to read the pending observation record, will keep " /* Continued */ + LogPrintf("CCoinJoinClientManager::%s -- ERROR: failed to read the pending observation record, will keep " "retrying silently. The inputs it tracks stay locked until it can be read, `lockunspent` " "releases them manually\n", __func__); @@ -835,7 +835,7 @@ void CCoinJoinClientManager::CheckPendingObservations(const CTxMemPool& mempool) // Still unspent in chain and mempool long after the session completed - // the finalized transaction most likely never propagated, release the // input so the wallet does not lose it forever - LogPrintf("CCoinJoinClientManager::%s -- WARNING: never observed finalized mixing transaction for %s, " /* Continued */ + LogPrintf("CCoinJoinClientManager::%s -- WARNING: never observed finalized mixing transaction for %s, " "releasing lock after %d seconds\n", __func__, outpoint.ToStringShort(), COINJOIN_PENDING_OBSERVATION_TIMEOUT); m_wallet->UnlockCoin(outpoint, &get_batch()); @@ -851,7 +851,7 @@ void CCoinJoinClientManager::CheckPendingObservations(const CTxMemPool& mempool) // selected for another session - so only refresh the timer to keep the check // above from running on every pass. The refresh is deliberately not persisted, // the worst a restart can do is re-run the check once. - WalletCJLogPrint(m_wallet, "CCoinJoinClientManager::%s -- %s is spent in chain/mempool but not according to " /* Continued */ + WalletCJLogPrint(m_wallet, "CCoinJoinClientManager::%s -- %s is spent in chain/mempool but not according to " "the wallet, keeping it locked\n", __func__, outpoint.ToStringShort()); it->second = nNow; @@ -1436,7 +1436,7 @@ bool CCoinJoinClientSession::JoinExistingQueue(CAmount nBalanceNeedsAnonymized, m_mn_metaman.AddUsedMasternode(dmn->proTxHash); if (connman.IsMasternodeOrDisconnectRequested(dmn->pdmnState->netInfo->GetPrimary())) { - WalletCJLogPrint(m_wallet, /* Continued */ + WalletCJLogPrint(m_wallet, "CCoinJoinClientSession::JoinExistingQueue -- skipping connection, masternode=%s\n", dmn->proTxHash.ToString()); continue; } @@ -1511,7 +1511,7 @@ bool CCoinJoinClientSession::StartNewQueue(CAmount nBalanceNeedsAnonymized, CCon } if (m_mn_metaman.IsMixingThresholdExceeded(dmn->proTxHash, nMnCount)) { - WalletCJLogPrint(m_wallet, /* Continued */ + WalletCJLogPrint(m_wallet, "CCoinJoinClientSession::StartNewQueue -- too early to mix with node masternode=%s\n", dmn->proTxHash.ToString()); nTries++; @@ -1542,8 +1542,7 @@ bool CCoinJoinClientSession::StartNewQueue(CAmount nBalanceNeedsAnonymized, CCon pendingDsaRequest = CPendingDsaRequest(dmn->proTxHash, CCoinJoinAccept(nSessionDenom, txMyCollateral)); SetState(POOL_STATE_QUEUE); nTimeLastSuccessfulStep = GetTime(); - WalletCJLogPrint(/* Continued */ - m_wallet, + WalletCJLogPrint(m_wallet, "CCoinJoinClientSession::StartNewQueue -- pending connection, masternode=%s, nSessionDenom=%d " "(%s)\n", dmn->proTxHash.ToString(), nSessionDenom.load(), CoinJoin::DenominationToString(nSessionDenom)); diff --git a/src/coinjoin/coinjoin.cpp b/src/coinjoin/coinjoin.cpp index 5f104b853e71..232449109d3b 100644 --- a/src/coinjoin/coinjoin.cpp +++ b/src/coinjoin/coinjoin.cpp @@ -468,7 +468,7 @@ bool CoinJoin::IsCollateralValid(ChainstateManager& chainman, const llmq::CInsta nValueOut += txout.nValue; if (!txout.scriptPubKey.IsPayToPublicKeyHash() && !txout.scriptPubKey.IsUnspendable()) { - LogPrint(BCLog::COINJOIN, "CoinJoin::IsCollateralValid -- Invalid Script, txCollateral=%s", txCollateral.ToString()); /* Continued */ + LogPrint(BCLog::COINJOIN, "CoinJoin::IsCollateralValid -- Invalid Script, txCollateral=%s", txCollateral.ToString()); // NOLINT(bitcoin-unterminated-logprintf) return false; } } @@ -488,11 +488,11 @@ bool CoinJoin::IsCollateralValid(ChainstateManager& chainman, const llmq::CInsta //collateral transactions are required to pay out a small fee to the miners if (nValueIn - nValueOut < GetCollateralAmount()) { - LogPrint(BCLog::COINJOIN, "CoinJoin::IsCollateralValid -- did not include enough fees in transaction: fees: %d, txCollateral=%s", nValueOut - nValueIn, txCollateral.ToString()); /* Continued */ + LogPrint(BCLog::COINJOIN, "CoinJoin::IsCollateralValid -- did not include enough fees in transaction: fees: %d, txCollateral=%s", nValueOut - nValueIn, txCollateral.ToString()); // NOLINT(bitcoin-unterminated-logprintf) return false; } - LogPrint(BCLog::COINJOIN, "CoinJoin::IsCollateralValid -- %s", txCollateral.ToString()); /* Continued */ + LogPrint(BCLog::COINJOIN, "CoinJoin::IsCollateralValid -- %s", txCollateral.ToString()); // NOLINT(bitcoin-unterminated-logprintf) if (!ATMPIfSaneFee(chainman, MakeTransactionRef(txCollateral), /*test_accept=*/true)) { LogPrint(BCLog::COINJOIN, "CoinJoin::IsCollateralValid -- didn't pass ATMPIfSaneFee()\n"); diff --git a/src/coinjoin/server.cpp b/src/coinjoin/server.cpp index 8146bb269542..2605f340a0be 100644 --- a/src/coinjoin/server.cpp +++ b/src/coinjoin/server.cpp @@ -78,7 +78,7 @@ void CCoinJoinServer::ProcessDSACCEPT(CNode& peer, CDataStream& vRecv) CCoinJoinAccept dsa; vRecv >> dsa; - LogPrint(BCLog::COINJOIN, "DSACCEPT -- nDenom %d (%s) txCollateral %s", dsa.nDenom, CoinJoin::DenominationToString(dsa.nDenom), dsa.txCollateral.ToString()); /* Continued */ + LogPrint(BCLog::COINJOIN, "DSACCEPT -- nDenom %d (%s) txCollateral %s", dsa.nDenom, CoinJoin::DenominationToString(dsa.nDenom), dsa.txCollateral.ToString()); // NOLINT(bitcoin-unterminated-logprintf) auto mnList = m_dmnman.GetListAtChainTip(); auto dmn = mnList.GetValidMNByCollateral(m_mn_activeman.GetOutPoint()); @@ -210,7 +210,7 @@ void CCoinJoinServer::ProcessDSVIN(CNode& peer, CDataStream& vRecv) CCoinJoinEntry entry; vRecv >> entry; - LogPrint(BCLog::COINJOIN, "DSVIN -- txCollateral %s", entry.txCollateral->ToString()); /* Continued */ + LogPrint(BCLog::COINJOIN, "DSVIN -- txCollateral %s", entry.txCollateral->ToString()); // NOLINT(bitcoin-unterminated-logprintf) // Note: unbalanced (promotion/demotion) entries are only valid post-V24; AddEntry -> // IsValidInOuts rejects them pre-V24 and consumes the collateral to keep spam costly @@ -407,7 +407,7 @@ void CCoinJoinServer::CreateFinalTransaction(int session_id) sort(txNew.vout.begin(), txNew.vout.end(), CompareOutputBIP69()); finalMutableTransaction = txNew; - LogPrint(BCLog::COINJOIN, "CCoinJoinServer::CreateFinalTransaction -- finalMutableTransaction=%s", /* Continued */ + LogPrint(BCLog::COINJOIN, "CCoinJoinServer::CreateFinalTransaction -- finalMutableTransaction=%s", // NOLINT(bitcoin-unterminated-logprintf) txNew.ToString()); // request signatures from clients @@ -422,7 +422,7 @@ void CCoinJoinServer::CommitFinalTransaction() CTransactionRef finalTransaction = WITH_LOCK(cs_coinjoin, return MakeTransactionRef(finalMutableTransaction)); uint256 hashTx = finalTransaction->GetHash(); - LogPrint(BCLog::COINJOIN, "CCoinJoinServer::CommitFinalTransaction -- finalTransaction=%s", /* Continued */ + LogPrint(BCLog::COINJOIN, "CCoinJoinServer::CommitFinalTransaction -- finalTransaction=%s", // NOLINT(bitcoin-unterminated-logprintf) finalTransaction->ToString()); { @@ -430,7 +430,7 @@ void CCoinJoinServer::CommitFinalTransaction() TRY_LOCK(::cs_main, lockMain); mempool.PrioritiseTransaction(hashTx, 0.1 * COIN); if (!lockMain || !ATMPIfSaneFee(m_chainman, finalTransaction)) { - LogPrint(BCLog::COINJOIN, /* Continued */ + LogPrint(BCLog::COINJOIN, "CCoinJoinServer::CommitFinalTransaction -- ATMPIfSaneFee() error: Transaction not valid\n"); WITH_LOCK(cs_coinjoin, SetNull()); // not much we can do in this case, just notify clients @@ -495,7 +495,7 @@ void CCoinJoinServer::ChargeFees() const // This queue entry didn't send us the promised transaction if (!fFound) { - LogPrint(BCLog::COINJOIN, /* Continued */ + LogPrint(BCLog::COINJOIN, "CCoinJoinServer::ChargeFees -- found uncooperative node (didn't send transaction), found " "offence\n"); vecOffendersCollaterals.push_back(txCollateral); @@ -509,7 +509,7 @@ void CCoinJoinServer::ChargeFees() const for (const auto& entry : vecEntries) { for (const auto& txdsin : entry.vecTxDSIn) { if (!txdsin.fHasSig) { - LogPrint(BCLog::COINJOIN, /* Continued */ + LogPrint(BCLog::COINJOIN, "CCoinJoinServer::ChargeFees -- found uncooperative node (didn't sign), found offence\n"); vecOffendersCollaterals.push_back(entry.txCollateral); } @@ -530,8 +530,8 @@ void CCoinJoinServer::ChargeFees() const Shuffle(vecOffendersCollaterals.begin(), vecOffendersCollaterals.end(), FastRandomContext()); if (nState == POOL_STATE_ACCEPTING_ENTRIES || nState == POOL_STATE_SIGNING) { - LogPrint(BCLog::COINJOIN, /* Continued */ - "CCoinJoinServer::ChargeFees -- found uncooperative node (didn't %s transaction), charging fees: %s", + LogPrint(BCLog::COINJOIN, + "CCoinJoinServer::ChargeFees -- found uncooperative node (didn't %s transaction), charging fees: %s", // NOLINT(bitcoin-unterminated-logprintf) (nState == POOL_STATE_SIGNING) ? "sign" : "send", vecOffendersCollaterals[0]->ToString()); ConsumeCollateral(vecOffendersCollaterals[0]); } @@ -561,8 +561,8 @@ void CCoinJoinServer::ChargeRandomFees() const for (const auto& txCollateral : session_collaterals) { if (GetRand(/*nMax=*/100) > 10) return; - LogPrint(BCLog::COINJOIN, /* Continued */ - "CCoinJoinServer::ChargeRandomFees -- charging random fees, txCollateral=%s", txCollateral->ToString()); + LogPrint(BCLog::COINJOIN, + "CCoinJoinServer::ChargeRandomFees -- charging random fees, txCollateral=%s", txCollateral->ToString()); // NOLINT(bitcoin-unterminated-logprintf) ConsumeCollateral(txCollateral); } } @@ -776,7 +776,7 @@ bool CCoinJoinServer::AddEntry(const CCoinJoinEntry& entry, PoolMessage& nMessag // PROMOTION_RATIO outputs; pre-V24 entries are capped at COINJOIN_ENTRY_MAX_SIZE (9) const size_t nMaxEntrySize = fRebalanceSession ? static_cast(CoinJoin::PROMOTION_RATIO) : COINJOIN_ENTRY_MAX_SIZE; if (entry.vecTxDSIn.size() > nMaxEntrySize || entry.vecTxOut.size() > nMaxEntrySize) { - LogPrint(BCLog::COINJOIN, /* Continued */ + LogPrint(BCLog::COINJOIN, "CCoinJoinServer::%s -- ERROR: too many inputs or outputs! inputs=%s/%s, outputs=%s/%s\n", __func__, entry.vecTxDSIn.size(), nMaxEntrySize, entry.vecTxOut.size(), nMaxEntrySize); nMessageIDRet = ERR_MAXIMUM; diff --git a/src/coinjoin/walletman.cpp b/src/coinjoin/walletman.cpp index dc774c18bf87..1717929e6551 100644 --- a/src/coinjoin/walletman.cpp +++ b/src/coinjoin/walletman.cpp @@ -280,7 +280,7 @@ MessageProcessingResult CJWalletManagerImpl::ProcessDSQueue(NodeId from, CConnma if (m_queueman->HasQueueFromMasternode(dsq.masternodeOutpoint, dsq.fReady)) { // no way the same mn can send another dsq with the same readiness this soon - LogPrint(BCLog::COINJOIN, /* Continued */ + LogPrint(BCLog::COINJOIN, "DSQUEUE -- Peer %d is sending WAY too many dsq messages for a masternode with collateral %s\n", from, dsq.masternodeOutpoint.ToStringShort()); return ret; diff --git a/src/dbwrapper.cpp b/src/dbwrapper.cpp index b0aebb51919d..8ae386aaa832 100644 --- a/src/dbwrapper.cpp +++ b/src/dbwrapper.cpp @@ -76,7 +76,7 @@ class CBitcoinLevelDBLogger : public leveldb::Logger { assert(p <= limit); base[std::min(bufsize - 1, (int)(p - base))] = '\0'; - LogPrintLevel(BCLog::LEVELDB, BCLog::Level::Debug, "%s", base); /* Continued */ + LogPrintLevel(BCLog::LEVELDB, BCLog::Level::Debug, "%s", base); // NOLINT(bitcoin-unterminated-logprintf) if (base != buffer) { delete[] base; } diff --git a/src/evo/creditpool.cpp b/src/evo/creditpool.cpp index 1db8447a6058..6a34b36e0311 100644 --- a/src/evo/creditpool.cpp +++ b/src/evo/creditpool.cpp @@ -219,7 +219,7 @@ CCreditPool CCreditPoolManager::ConstructCreditPool(const gsl::not_null 0 || blockData.credit_pool > 0) { - LogPrint(BCLog::CREDITPOOL, /* Continued */ + LogPrint(BCLog::CREDITPOOL, "CCreditPoolManager: asset unlock limits on height: %d locked: %d.%08d limit: %d.%08d " "unlocked-in-window: %d.%08d\n", block_index->nHeight, blockData.credit_pool / COIN, blockData.credit_pool % COIN, currentLimit / COIN, diff --git a/src/evo/specialtxman.cpp b/src/evo/specialtxman.cpp index febe8b6fbc42..ec30cc19e1de 100644 --- a/src/evo/specialtxman.cpp +++ b/src/evo/specialtxman.cpp @@ -377,7 +377,7 @@ bool CSpecialTxProcessor::RebuildListFromBlock(const CBlock& block, gsl::not_nul // and the new one is added like a completely fresh one, which is also at the bottom of the payment list newList.RemoveMN(replacedDmn->proTxHash); if (debugLogs) { - LogPrintf("%s -- MN %s removed from list because collateral was used for " /* Continued */ + LogPrintf("%s -- MN %s removed from list because collateral was used for " "a new ProRegTx. collateralOutpoint=%s, nHeight=%d, mapCurMNs.allMNsCount=%d\n", __func__, replacedDmn->proTxHash.ToString(), dmn->collateralOutpoint.ToStringShort(), nHeight, newList.GetCounts().total()); @@ -752,7 +752,7 @@ bool CSpecialTxProcessor::RebuildListFromBlock(const CBlock& block, gsl::not_nul newList.RemoveMN(dmn->proTxHash); if (debugLogs) { - LogPrintf("%s -- MN %s removed from list because collateral was spent. " /* Continued */ + LogPrintf("%s -- MN %s removed from list because collateral was spent. " "collateralOutpoint=%s, nHeight=%d, mapCurMNs.allMNsCount=%d\n", __func__, dmn->proTxHash.ToString(), dmn->collateralOutpoint.ToStringShort(), nHeight, newList.GetCounts().total()); diff --git a/src/flat-database.h b/src/flat-database.h index a55231900545..b6ceb677f695 100644 --- a/src/flat-database.h +++ b/src/flat-database.h @@ -163,7 +163,7 @@ class CFlatDB if (readResult == ReadResult::FileError) LogPrintf("Missing file %s, will try to recreate\n", strFilename); else if (readResult != ReadResult::Ok) { - LogPrintf("ERROR: CFlatDB::Read Error reading %s: ", strFilename); + LogPrintf("ERROR: CFlatDB::Read Error reading %s: ", strFilename); // NOLINT(bitcoin-unterminated-logprintf) if (readResult == ReadResult::IncorrectFormat) { LogPrintf("%s: Magic is ok but data has invalid format, will try to recreate\n", __func__); } else { diff --git a/src/governance/governance.cpp b/src/governance/governance.cpp index a9fe430b4ec5..af6beec0b9b9 100644 --- a/src/governance/governance.cpp +++ b/src/governance/governance.cpp @@ -252,7 +252,7 @@ bool CGovernanceManager::ProcessObject(const std::string& peer_str, const uint25 bool unused_rcb; if (fRateCheckBypassed && fIsValid && !MasternodeRateCheck(govobj, true, true, unused_rcb)) { - LogPrint(BCLog::GOBJECT, /* Continued */ + LogPrint(BCLog::GOBJECT, "MNGOVERNANCEOBJECT -- masternode rate check failed (after signature verification) - %s - (current " "block height %d)\n", strHash, nCachedBlockHeight); diff --git a/src/governance/net_governance.cpp b/src/governance/net_governance.cpp index 2e8b5da79140..5d6541984a5b 100644 --- a/src/governance/net_governance.cpp +++ b/src/governance/net_governance.cpp @@ -231,7 +231,7 @@ void NetGovernance::ProcessMessage(CNode& peer, const std::string& msg_type, CDa ::cs_main, return m_peer_manager->PeerConsumeObjectRequest(peer.GetId(), CInv{MSG_GOVERNANCE_OBJECT_VOTE, nHash})); if (!announced_or_requested) { - LogPrint(BCLog::GOBJECT, /* Continued */ + LogPrint(BCLog::GOBJECT, "MNGOVERNANCEOBJECTVOTE -- Received unrequested vote object: %s, hash: %s, peer = %d\n", vote.ToString(tip_mn_list), strHash, peer.GetId()); return; diff --git a/src/governance/object.cpp b/src/governance/object.cpp index 7a30ce0760a5..08538f4324dd 100644 --- a/src/governance/object.cpp +++ b/src/governance/object.cpp @@ -525,7 +525,7 @@ std::set CGovernanceObject::RemoveInvalidVotes(const CDeterministicMNLi for (const auto& h : removedVotes) { removedStr += strprintf(" %s\n", h.ToString()); } - LogPrintf("CGovernanceObject::%s -- Removed %d invalid votes for %s from MN %s:\n%s", __func__, removedVotes.size(), nParentHash.ToString(), mnOutpoint.ToString(), removedStr); /* Continued */ + LogPrintf("CGovernanceObject::%s -- Removed %d invalid votes for %s from MN %s:\n%s", __func__, removedVotes.size(), nParentHash.ToString(), mnOutpoint.ToString(), removedStr); // NOLINT(bitcoin-unterminated-logprintf) fDirtyCache = true; return removedVotes; diff --git a/src/governance/signing.cpp b/src/governance/signing.cpp index 1eea9b60dac6..d103df8875ba 100644 --- a/src/governance/signing.cpp +++ b/src/governance/signing.cpp @@ -199,7 +199,7 @@ void GovernanceSigner::VoteGovernanceTriggers(const std::optionalGetDataAsPlainString()); if (nBlockHeight != entry.sb->GetBlockHeight()) { - LogPrint(BCLog::GOBJECT, /* Continued */ + LogPrint(BCLog::GOBJECT, "IsSuperblockTriggered -- block height doesn't match nBlockHeight = %d, blockStart = %d, " "continuing\n", nBlockHeight, entry.sb->GetBlockHeight()); diff --git a/src/gsl/assert.cpp b/src/gsl/assert.cpp index df98f8a1aa70..e1a6186cc436 100644 --- a/src/gsl/assert.cpp +++ b/src/gsl/assert.cpp @@ -33,7 +33,7 @@ namespace details << loc.column() << ":" << loc.function_name() << std::endl; std::cerr << s.str() << std::flush; - LogPrintf("%s", s.str()); /* Continued */ + LogPrintf("%s", s.str()); // NOLINT(bitcoin-unterminated-logprintf) std::terminate(); #endif // defined(GSL_MSVC_USE_STL_NOEXCEPTION_WORKAROUND) } diff --git a/src/index/base.cpp b/src/index/base.cpp index 828188c0b192..7980254c703e 100644 --- a/src/index/base.cpp +++ b/src/index/base.cpp @@ -280,7 +280,7 @@ void BaseIndex::BlockConnected(const std::shared_ptr& block, const // in the ValidationInterface queue backlog even after the sync thread has caught up to the // new chain tip. In this unlikely event, log a warning and let the queue clear. if (best_block_index->GetAncestor(pindex->nHeight - 1) != pindex->pprev) { - LogPrintf("%s: WARNING: Block %s does not connect to an ancestor of " /* Continued */ + LogPrintf("%s: WARNING: Block %s does not connect to an ancestor of " "known best chain (tip=%s); not updating index\n", __func__, pindex->GetBlockHash().ToString(), best_block_index->GetBlockHash().ToString()); @@ -319,7 +319,7 @@ void BaseIndex::BlockDisconnected(const std::shared_ptr& block, co // a parent — otherwise same-height siblings would incorrectly trigger a rewind. if (best_block_index && best_block_index->nHeight >= pindex->nHeight && pindex->pprev) { if (best_block_index->GetAncestor(pindex->nHeight) != pindex) { - LogPrintf("%s: WARNING: Block %s is not on the indexed chain " /* Continued */ + LogPrintf("%s: WARNING: Block %s is not on the indexed chain " "(tip=%s); not updating index\n", __func__, pindex->GetBlockHash().ToString(), best_block_index->GetBlockHash().ToString()); return; @@ -356,7 +356,7 @@ void BaseIndex::ChainStateFlushed(const CBlockLocator& locator) // event, log a warning and let the queue clear. const CBlockIndex* best_block_index = m_best_block_index.load(); if (best_block_index->GetAncestor(locator_tip_index->nHeight) != locator_tip_index) { - LogPrintf("%s: WARNING: Locator contains block (hash=%s) not on known best " /* Continued */ + LogPrintf("%s: WARNING: Locator contains block (hash=%s) not on known best " "chain (tip=%s); not writing index locator\n", __func__, locator_tip_hash.ToString(), best_block_index->GetBlockHash().ToString()); diff --git a/src/init.cpp b/src/init.cpp index bb788cfb711f..79b4837ca67c 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1500,7 +1500,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info) // Warn about relative -datadir path. if (args.IsArgSet("-datadir") && !args.GetPathArg("-datadir").is_absolute()) { - LogPrintf("Warning: relative datadir option '%s' specified, which will be interpreted relative to the " /* Continued */ + LogPrintf("Warning: relative datadir option '%s' specified, which will be interpreted relative to the " "current working directory '%s'. This is fragile, because if Dash Core is started in the future " "from a different location, it will be unable to locate the current data files. There could " "also be data loss if Dash Core is started while in a temporary directory.\n", @@ -2491,7 +2491,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info) if (!result.repair_errors.empty()) { // Critical errors occurred - reindex required - LogPrintf("Failed to repair masternode list diffs. Database corruption detected. " /* Continued */ + LogPrintf("Failed to repair masternode list diffs. Database corruption detected. " "Please restart with -reindex to rebuild the database.\n" "Errors:\n%s\n", Join(result.repair_errors, "\n")); diff --git a/src/instantsend/net_instantsend.cpp b/src/instantsend/net_instantsend.cpp index 6c51289ad749..ac3751f52297 100644 --- a/src/instantsend/net_instantsend.cpp +++ b/src/instantsend/net_instantsend.cpp @@ -210,7 +210,7 @@ Uint256HashSet NetInstantSend::ApplyVerificationResults( if (it != data.recSigs.end()) { auto recSig = std::make_shared(std::move(it->second)); if (!m_sigman.HasRecoveredSigForId(llmq_params.type, recSig->getId())) { - LogPrint(BCLog::INSTANTSEND, /* Continued */ + LogPrint(BCLog::INSTANTSEND, "NetInstantSend::%s -- txid=%s, islock=%s: " "passing reconstructed recSig to signing mgr, peer=%d\n", __func__, islock->txid.ToString(), hash.ToString(), nodeId); @@ -385,7 +385,7 @@ void NetInstantSend::ProcessInstantSendLock(NodeId from, const uint256& hash, co // Let's see if the TX that was locked by this islock is already mined in a ChainLocked block. If yes, // we can simply ignore the islock, as the ChainLock implies locking of all TXs in that chain if (minedHeight.has_value() && m_chainlocks.HasChainLock(*minedHeight, hashBlock)) { - LogPrint(BCLog::INSTANTSEND, /* Continued */ + LogPrint(BCLog::INSTANTSEND, "NetInstantSend::%s -- txlock=%s, islock=%s: dropping islock as it already got a " "ChainLock in block %s, peer=%d\n", __func__, islock->txid.ToString(), hash.ToString(), hashBlock.ToString(), from); diff --git a/src/llmq/blockprocessor.cpp b/src/llmq/blockprocessor.cpp index 6ef091bfd927..1e78e3ca3495 100644 --- a/src/llmq/blockprocessor.cpp +++ b/src/llmq/blockprocessor.cpp @@ -323,7 +323,7 @@ bool CQuorumBlockProcessor::ProcessCommitment(Chainstate& chainstate, int nHeigh uint256 quorumHash = GetQuorumBlockHash(llmq_params, chainstate.m_chain, nHeight, qc.quorumIndex); - LogPrint(BCLog::LLMQ, /* Continued */ + LogPrint(BCLog::LLMQ, "%s -- processing commitment for block height=%d, type=%d, quorumIndex=%d, quorumHash=%s, signers=%s, " "validMembers=%d, quorumPublicKey=%s " "fJustCheck[%d] processing commitment from block.\n", @@ -336,7 +336,7 @@ bool CQuorumBlockProcessor::ProcessCommitment(Chainstate& chainstate, int nHeigh } if (quorumHash.IsNull()) { - LogPrint(BCLog::LLMQ, /* Continued */ + LogPrint(BCLog::LLMQ, "%s -- height=%d, type=%d, quorumIndex=%d, quorumHash=%s, signers=%s, validMembers=%d, " "quorumPublicKey=%s quorumHash is null.\n", __func__, nHeight, std23::to_underlying(qc.llmqType), qc.quorumIndex, quorumHash.ToString(), qc.CountSigners(), @@ -344,7 +344,7 @@ bool CQuorumBlockProcessor::ProcessCommitment(Chainstate& chainstate, int nHeigh return state.Invalid(BlockValidationResult::BLOCK_CONSENSUS, "bad-qc-block"); } if (quorumHash != qc.quorumHash) { - LogPrint(BCLog::LLMQ, /* Continued */ + LogPrint(BCLog::LLMQ, "%s -- height=%d, type=%d, quorumIndex=%d, quorumHash=%s, qc.quorumHash=%s signers=%s, " "validMembers=%d, quorumPublicKey=%s non equal quorumHash.\n", __func__, nHeight, std23::to_underlying(qc.llmqType), qc.quorumIndex, quorumHash.ToString(), @@ -354,7 +354,7 @@ bool CQuorumBlockProcessor::ProcessCommitment(Chainstate& chainstate, int nHeigh if (qc.IsNull()) { if (!qc.VerifyNull()) { - LogPrint(BCLog::LLMQ, /* Continued */ + LogPrint(BCLog::LLMQ, "%s -- height=%d, type=%d, quorumIndex=%d, quorumHash=%s, signers=%s, validMembers=%dqc " "verifynull failed.\n", __func__, nHeight, std23::to_underlying(qc.llmqType), qc.quorumIndex, quorumHash.ToString(), @@ -392,7 +392,7 @@ bool CQuorumBlockProcessor::ProcessCommitment(Chainstate& chainstate, int nHeigh // we don't validate signatures here; they already validated on previous step if (!qc.Verify({m_dmnman, m_qsnapman, m_chainman, pQuorumBaseBlockIndex}, /*checksigs=*/false)) { - LogPrint(BCLog::LLMQ, /* Continued */ + LogPrint(BCLog::LLMQ, "%s -- height=%d, type=%d, quorumIndex=%d, quorumHash=%s, signers=%s, validMembers=%d, " "quorumPublicKey=%s qc verify failed.\n", __func__, nHeight, std23::to_underlying(qc.llmqType), qc.quorumIndex, quorumHash.ToString(), qc.CountSigners(), diff --git a/src/llmq/net_dkg.cpp b/src/llmq/net_dkg.cpp index f641cac46b3d..46d2420f211b 100644 --- a/src/llmq/net_dkg.cpp +++ b/src/llmq/net_dkg.cpp @@ -824,7 +824,7 @@ static void AddQuorumProbeConnections(const Consensus::LLMQParams& llmqParams, C dmn->pdmnState->netInfo->GetPrimary().ToStringAddrPort()); } } - LogPrint(BCLog::NET_NETCONN, debugMsg.c_str()); /* Continued */ + LogPrint(BCLog::NET_NETCONN, debugMsg.c_str()); } connman.AddPendingProbeConnections(probeConnections); } diff --git a/src/llmq/net_quorum.cpp b/src/llmq/net_quorum.cpp index 98bd4441def3..31becf44ce73 100644 --- a/src/llmq/net_quorum.cpp +++ b/src/llmq/net_quorum.cpp @@ -821,7 +821,7 @@ bool EnsureQuorumConnections(const Consensus::LLMQParams& llmqParams, CConnman& dmn->pdmnState->netInfo->GetPrimary().ToStringAddrPort()); } } - LogPrint(BCLog::NET_NETCONN, debugMsg.c_str()); /* Continued */ + LogPrint(BCLog::NET_NETCONN, debugMsg.c_str()); } connman.SetMasternodeQuorumNodes(llmqParams.type, util_params.m_base_index->GetBlockHash(), connections); } diff --git a/src/llmq/signing_shares.cpp b/src/llmq/signing_shares.cpp index ab94b91238b5..50ac6285bb45 100644 --- a/src/llmq/signing_shares.cpp +++ b/src/llmq/signing_shares.cpp @@ -460,7 +460,7 @@ bool CSigSharesManager::ProcessMessageSigShare(NodeId fromId, const CSigShare& s LOCK(cs); if (alreadyRecovered) { - LogPrint(BCLog::LLMQ_SIGS, /* Continued */ + LogPrint(BCLog::LLMQ_SIGS, "CSigSharesManager::%s -- dropping sigShare for recovered session. signHash=%s, id=%s, " "msgHash=%s, member=%d, node=%d\n", __func__, signHash.ToString(), sigShare.getId().ToString(), sigShare.getMsgHash().ToString(), @@ -685,7 +685,7 @@ std::shared_ptr CSigSharesManager::TryRecoverSig(const CQuorum& q std::shared_ptr singleMemberRecoveredSig; if (quorum.params.is_single_member()) { if (sigSharesForSignHash->empty()) { - LogPrint(BCLog::LLMQ_SIGS, /* Continued */ + LogPrint(BCLog::LLMQ_SIGS, "CSigSharesManager::%s -- impossible to recover single-node signature - no shares yet. id=%s, " "msgHash=%s\n", __func__, id.ToString(), msgHash.ToString()); @@ -810,12 +810,12 @@ bool CSigSharesManager::AsyncSignIfMember(Consensus::LLMQType llmqType, const ui db.GetVoteForId(llmqType, id, prevMsgHash); if (msgHash != prevMsgHash) { if (allowDiffMsgHashSigning) { - LogPrintf("%s -- already voted for id=%s and msgHash=%s. Signing for different " /* Continued */ + LogPrintf("%s -- already voted for id=%s and msgHash=%s. Signing for different " "msgHash=%s\n", __func__, id.ToString(), prevMsgHash.ToString(), msgHash.ToString()); hasVoted = false; } else { - LogPrintf("%s -- already voted for id=%s and msgHash=%s. Not voting on " /* Continued */ + LogPrintf("%s -- already voted for id=%s and msgHash=%s. Not voting on " "conflicting msgHash=%s\n", __func__, id.ToString(), prevMsgHash.ToString(), msgHash.ToString()); return false; @@ -1370,13 +1370,13 @@ void CSigSharesManager::Cleanup() } } - LogPrintLevel(BCLog::LLMQ_SIGS, BCLog::Level::Info, /* Continued */ + LogPrintLevel(BCLog::LLMQ_SIGS, BCLog::Level::Info, "CSigSharesManager::%s -- signing session timed out. signHash=%s, id=%s, msgHash=%s, " "sigShareCount=%d, missingMembers=%s\n", __func__, signHash.ToString(), oneSigShare.getId().ToString(), oneSigShare.getMsgHash().ToString(), count, strMissingMembers); } else { - LogPrintLevel(BCLog::LLMQ_SIGS, BCLog::Level::Info, /* Continued */ + LogPrintLevel(BCLog::LLMQ_SIGS, BCLog::Level::Info, "CSigSharesManager::%s -- signing session timed out. signHash=%s, sigShareCount=%d\n", __func__, signHash.ToString(), count); } @@ -1550,7 +1550,7 @@ std::optional CSigSharesManager::CreateSigShareForSingleMember(const sigShare.UpdateKey(); - LogPrint(BCLog::LLMQ_SIGS, /* Continued */ + LogPrint(BCLog::LLMQ_SIGS, "CSigSharesManager::%s -- created sigShare. signHash=%s, id=%s, msgHash=%s, llmqType=%d, quorum=%s, " "time=%s\n", __func__, signHash.ToString(), sigShare.getId().ToString(), sigShare.getMsgHash().ToString(), diff --git a/src/masternode/payments.cpp b/src/masternode/payments.cpp index b2eebcf2aea2..bddfc0c821d0 100644 --- a/src/masternode/payments.cpp +++ b/src/masternode/payments.cpp @@ -379,7 +379,7 @@ bool CMNPaymentsProcessor::IsBlockValueValid(const CChain& active_chain, const C const bool is_v24{check_superblock == SuperBlockCheckType::DisallowDuplicates}; if (!m_superblocks.IsValidSuperblock(active_chain, tip_mn_list, *block.vtx[0], nBlockHeight, blockReward, is_v24)) { // triggered but invalid? that's weird - LogPrintf("CMNPaymentsProcessor::%s -- ERROR! Invalid superblock detected at height %d: %s", __func__, nBlockHeight, block.vtx[0]->ToString()); /* Continued */ + LogPrintf("CMNPaymentsProcessor::%s -- ERROR! Invalid superblock detected at height %d: %s", __func__, nBlockHeight, block.vtx[0]->ToString()); // NOLINT(bitcoin-unterminated-logprintf) // should NOT allow invalid superblocks, when superblocks are enabled strErrorRet = strprintf("invalid superblock detected at height %d", nBlockHeight); return false; @@ -395,9 +395,9 @@ bool CMNPaymentsProcessor::IsBlockPayeeValid(const CChain& active_chain, const C // Check for correct masternode payment if (IsTransactionValid(txNew, pindexPrev, blockSubsidy, feeReward, era, strict_multiplicity)) { - LogPrint(BCLog::MNPAYMENTS, "CMNPaymentsProcessor::%s -- Valid masternode payment at height %d: %s", __func__, nBlockHeight, txNew.ToString()); /* Continued */ + LogPrint(BCLog::MNPAYMENTS, "CMNPaymentsProcessor::%s -- Valid masternode payment at height %d: %s", __func__, nBlockHeight, txNew.ToString()); // NOLINT(bitcoin-unterminated-logprintf) } else { - LogPrintf("CMNPaymentsProcessor::%s -- ERROR! Invalid masternode payment detected at height %d: %s", __func__, nBlockHeight, txNew.ToString()); /* Continued */ + LogPrintf("CMNPaymentsProcessor::%s -- ERROR! Invalid masternode payment detected at height %d: %s", __func__, nBlockHeight, txNew.ToString()); // NOLINT(bitcoin-unterminated-logprintf) return false; } @@ -425,11 +425,11 @@ bool CMNPaymentsProcessor::IsBlockPayeeValid(const CChain& active_chain, const C if (m_superblocks.IsSuperblockTriggered(tip_mn_list, nBlockHeight)) { if (m_superblocks.IsValidSuperblock(active_chain, tip_mn_list, txNew, nBlockHeight, blockSubsidy + feeReward, is_v24)) { - LogPrint(BCLog::GOBJECT, "CMNPaymentsProcessor::%s -- Valid superblock at height %d: %s", /* Continued */ + LogPrint(BCLog::GOBJECT, "CMNPaymentsProcessor::%s -- Valid superblock at height %d: %s", // NOLINT(bitcoin-unterminated-logprintf) __func__, nBlockHeight, txNew.ToString()); // continue validation, should also pay MN } else { - LogPrintf("CMNPaymentsProcessor::%s -- ERROR! Invalid superblock detected at height %d: %s", /* Continued */ + LogPrintf("CMNPaymentsProcessor::%s -- ERROR! Invalid superblock detected at height %d: %s", // NOLINT(bitcoin-unterminated-logprintf) __func__, nBlockHeight, txNew.ToString()); return false; } @@ -469,6 +469,6 @@ void CMNPaymentsProcessor::FillBlockPayments(CMutableTransaction& txNew, const C voutMasternodeStr += txout.ToString(); } - LogPrint(BCLog::MNPAYMENTS, "CMNPaymentsProcessor::%s -- nBlockHeight %d blockReward %lld voutMasternodePaymentsRet \"%s\" txNew %s", __func__, /* Continued */ + LogPrint(BCLog::MNPAYMENTS, "CMNPaymentsProcessor::%s -- nBlockHeight %d blockReward %lld voutMasternodePaymentsRet \"%s\" txNew %s", __func__, // NOLINT(bitcoin-unterminated-logprintf) nBlockHeight, blockSubsidy + feeReward, voutMasternodeStr, txNew.ToString()); } diff --git a/src/net_processing.cpp b/src/net_processing.cpp index ec55e821b12c..b1f01bf7038a 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -3454,7 +3454,7 @@ bool PeerManagerImpl::PrepareBlockFilterRequest(CNode& node, Peer& peer, uint32_t stop_height = stop_index->nHeight; if (start_height > stop_height) { - LogPrint(BCLog::NET, "peer %d sent invalid getcfilters/getcfheaders with " /* Continued */ + LogPrint(BCLog::NET, "peer %d sent invalid getcfilters/getcfheaders with " "start height %d and stop height %d\n", node.GetId(), start_height, stop_height); node.fDisconnect = true; diff --git a/src/node/sync_manager.cpp b/src/node/sync_manager.cpp index 4eb1598e284f..ed0bd2eda630 100644 --- a/src/node/sync_manager.cpp +++ b/src/node/sync_manager.cpp @@ -236,7 +236,7 @@ void SyncManager::ProcessTick() if (!pNodeTmp->IsInboundConn() && !fRequestedEarlier && !pNodeTmp->IsBlockRelayOnly()) { m_netfulfilledman.AddFulfilledRequest(pNodeTmp->addr, "mempool-sync"); m_connman.PushMessage(pNodeTmp, msgMaker.Make(NetMsgType::MEMPOOL)); - LogPrint(BCLog::MNSYNC, /* Continued */ + LogPrint(BCLog::MNSYNC, "Sync Tick -- nTick %d asset_id %d -- syncing mempool from peer=%d\n", nTick, asset_id, pNodeTmp->GetId()); } diff --git a/src/node/utxo_snapshot.cpp b/src/node/utxo_snapshot.cpp index 9a9e4332ea83..3a1d5006a8fb 100644 --- a/src/node/utxo_snapshot.cpp +++ b/src/node/utxo_snapshot.cpp @@ -53,7 +53,7 @@ bool WriteSnapshotBaseBlockhash(Chainstate& snapshot_chainstate) std::optional ReadSnapshotBaseBlockhash(fs::path chaindir) { if (!fs::exists(chaindir)) { - LogPrintf("[snapshot] cannot read base blockhash: no chainstate dir " /* Continued */ + LogPrintf("[snapshot] cannot read base blockhash: no chainstate dir " "exists at path %s\n", fs::PathToString(chaindir)); return std::nullopt; } @@ -61,7 +61,7 @@ std::optional ReadSnapshotBaseBlockhash(fs::path chaindir) const std::string read_from_str = fs::PathToString(read_from); if (!fs::exists(read_from)) { - LogPrintf("[snapshot] snapshot chainstate dir is malformed! no base blockhash file " /* Continued */ + LogPrintf("[snapshot] snapshot chainstate dir is malformed! no base blockhash file " "exists at path %s. Try deleting %s and calling loadtxoutset again?\n", fs::PathToString(chaindir), read_from_str); return std::nullopt; diff --git a/src/rpc/governance.cpp b/src/rpc/governance.cpp index a20146761b94..2ba772540133 100644 --- a/src/rpc/governance.cpp +++ b/src/rpc/governance.cpp @@ -335,7 +335,7 @@ static RPCHelpMan gobject_submit() if (node.active_ctx) { const auto& mn_activeman{*node.active_ctx->nodeman}; const bool fMnFound = mnList.HasValidMNByCollateral(mn_activeman.GetOutPoint()); - LogPrint(BCLog::GOBJECT, /* Continued */ + LogPrint(BCLog::GOBJECT, "gobject_submit -- pubKeyOperator = %s, outpoint = %s, params.size() = %lld, fMnFound = %d\n", mn_activeman.GetPubKey().ToString(false), mn_activeman.GetOutPoint().ToStringShort(), request.params.size(), fMnFound); diff --git a/src/rpc/util.cpp b/src/rpc/util.cpp index 29bc7bc93a40..12164b660211 100644 --- a/src/rpc/util.cpp +++ b/src/rpc/util.cpp @@ -158,7 +158,7 @@ bool ParseBoolV(const UniValue& v, const std::string &strName) } if (!v.isBool()) { - throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("%s must be a JSON boolean. " /* Continued */ + throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("%s must be a JSON boolean. " "Pass -deprecatedrpc=permissive_bool to allow legacy boolean parsing.", strName)); } return v.get_bool(); diff --git a/src/stacktraces.cpp b/src/stacktraces.cpp index a1d59b966941..b0e35c97dcb3 100644 --- a/src/stacktraces.cpp +++ b/src/stacktraces.cpp @@ -532,7 +532,7 @@ static std::string GetCrashInfoStr(const crash_info& ci, size_t spaces) static void PrintCrashInfo(const crash_info& ci) { auto str = GetCrashInfoStr(ci); - LogPrintf("%s", str); /* Continued */ + LogPrintf("%s", str); // NOLINT(bitcoin-unterminated-logprintf) tfm::format(std::cerr, "%s", str); fflush(stderr); } diff --git a/src/sync.cpp b/src/sync.cpp index 79453ed009bf..48799b35fdbb 100644 --- a/src/sync.cpp +++ b/src/sync.cpp @@ -134,7 +134,7 @@ static void double_lock_detected(const void* mutex, const LockStack& lock_stack) LogPrintf("Lock order:\n"); for (const LockStackItem& i : lock_stack) { if (i.first == mutex) { - LogPrintf(" (*)"); /* Continued */ + LogPrintf(" (*)"); // NOLINT(bitcoin-unterminated-logprintf) } LogPrintf(" %s\n", i.second.ToString()); } diff --git a/src/test/logging_tests.cpp b/src/test/logging_tests.cpp index f65c69e2ad37..cd6e6d1c57a1 100644 --- a/src/test/logging_tests.cpp +++ b/src/test/logging_tests.cpp @@ -83,12 +83,12 @@ BOOST_AUTO_TEST_CASE(logging_timer) BOOST_FIXTURE_TEST_CASE(logging_LogPrintf_, LogSetup) { LogInstance().m_log_sourcelocations = true; - LogPrintf_("fn1", "src1", 1, BCLog::LogFlags::NET, BCLog::Level::Debug, "foo1: %s", "bar1\n"); - LogPrintf_("fn2", "src2", 2, BCLog::LogFlags::NET, BCLog::Level::Info, "foo2: %s", "bar2\n"); - LogPrintf_("fn3", "src3", 3, BCLog::LogFlags::ALL, BCLog::Level::Debug, "foo3: %s", "bar3\n"); - LogPrintf_("fn4", "src4", 4, BCLog::LogFlags::ALL, BCLog::Level::Info, "foo4: %s", "bar4\n"); - LogPrintf_("fn5", "src5", 5, BCLog::LogFlags::NONE, BCLog::Level::Debug, "foo5: %s", "bar5\n"); - LogPrintf_("fn6", "src6", 6, BCLog::LogFlags::NONE, BCLog::Level::Info, "foo6: %s", "bar6\n"); + LogPrintf_("fn1", "src1", 1, BCLog::LogFlags::NET, BCLog::Level::Debug, "foo1: %s\n", "bar1"); + LogPrintf_("fn2", "src2", 2, BCLog::LogFlags::NET, BCLog::Level::Info, "foo2: %s\n", "bar2"); + LogPrintf_("fn3", "src3", 3, BCLog::LogFlags::ALL, BCLog::Level::Debug, "foo3: %s\n", "bar3"); + LogPrintf_("fn4", "src4", 4, BCLog::LogFlags::ALL, BCLog::Level::Info, "foo4: %s\n", "bar4"); + LogPrintf_("fn5", "src5", 5, BCLog::LogFlags::NONE, BCLog::Level::Debug, "foo5: %s\n", "bar5"); + LogPrintf_("fn6", "src6", 6, BCLog::LogFlags::NONE, BCLog::Level::Info, "foo6: %s\n", "bar6"); std::ifstream file{tmp_log_path}; std::vector log_lines; for (std::string log; std::getline(file, log);) { diff --git a/src/test/util/chainstate.h b/src/test/util/chainstate.h index 0e2c13e8f849..c26dbbcef4e7 100644 --- a/src/test/util/chainstate.h +++ b/src/test/util/chainstate.h @@ -50,7 +50,7 @@ CreateAndActivateUTXOSnapshot( UniValue result = CreateUTXOSnapshot( node, node.chainman->ActiveChainstate(), auto_outfile, snapshot_path, snapshot_path); LogPrintf( - "Wrote UTXO snapshot to %s: %s", fs::PathToString(snapshot_path.make_preferred()), result.write()); + "Wrote UTXO snapshot to %s: %s\n", fs::PathToString(snapshot_path.make_preferred()), result.write()); // Read the written snapshot in and then activate it. // diff --git a/src/validation.cpp b/src/validation.cpp index c58b1338f48a..5dd605260b8f 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -3712,7 +3712,7 @@ bool Chainstate::ActivateBestChain(BlockValidationState& state, std::shared_ptr< // Belt-and-suspenders check that we aren't attempting to advance the background // chainstate past the snapshot base block. if (WITH_LOCK(::cs_main, return m_disabled)) { - LogPrintf("m_disabled is set - this chainstate should not be in operation. " /* Continued */ + LogPrintf("m_disabled is set - this chainstate should not be in operation. " "Please report this as a bug. %s\n", PACKAGE_BUGREPORT); return false; } @@ -6175,7 +6175,7 @@ bool ChainstateManager::PopulateAndValidateSnapshot( auto maybe_au_data = ExpectedAssumeutxo(base_height, GetParams()); if (!maybe_au_data) { - LogPrintf("[snapshot] assumeutxo height in snapshot metadata not recognized " /* Continued */ + LogPrintf("[snapshot] assumeutxo height in snapshot metadata not recognized " "(%d) - refusing to load snapshot\n", base_height); return false; } @@ -6495,8 +6495,8 @@ SnapshotCompletionResult ChainstateManager::MaybeCompleteSnapshotValidation( }; if (index_new.GetBlockHash() != snapshot_blockhash) { - LogPrintf("[snapshot] supposed base block %s does not match the " /* Continued */ - "snapshot base block %s (height %d). Snapshot is not valid.", + LogPrintf("[snapshot] supposed base block %s does not match the " + "snapshot base block %s (height %d). Snapshot is not valid.\n", index_new.ToString(), snapshot_blockhash.ToString(), snapshot_base_height); handle_invalid_snapshot(); return SnapshotCompletionResult::BASE_BLOCKHASH_MISMATCH; @@ -6514,7 +6514,7 @@ SnapshotCompletionResult ChainstateManager::MaybeCompleteSnapshotValidation( auto maybe_au_data = ExpectedAssumeutxo(curr_height, ::Params()); if (!maybe_au_data) { - LogPrintf("[snapshot] assumeutxo data not found for height " /* Continued */ + LogPrintf("[snapshot] assumeutxo data not found for height " "(%d) - refusing to validate snapshot\n", curr_height); handle_invalid_snapshot(); return SnapshotCompletionResult::MISSING_CHAINPARAMS; @@ -6522,7 +6522,7 @@ SnapshotCompletionResult ChainstateManager::MaybeCompleteSnapshotValidation( const AssumeutxoData& au_data = *maybe_au_data; std::optional maybe_ibd_stats; - LogPrintf("[snapshot] computing UTXO stats for background chainstate to validate " /* Continued */ + LogPrintf("[snapshot] computing UTXO stats for background chainstate to validate " "snapshot - this could take a few minutes\n"); try { maybe_ibd_stats = ComputeUTXOStats( @@ -6889,7 +6889,7 @@ bool ChainstateManager::ValidatedSnapshotCleanup() // is in-memory, in which case we can't do on-disk cleanup. You'd better be // in a unittest! if (!ibd_chainstate_path_maybe || !snapshot_chainstate_path_maybe) { - LogPrintf("[snapshot] snapshot chainstate cleanup cannot happen with " /* Continued */ + LogPrintf("[snapshot] snapshot chainstate cleanup cannot happen with " "in-memory chainstates. You are testing, right?\n"); return false; } @@ -6936,7 +6936,7 @@ bool ChainstateManager::ValidatedSnapshotCleanup() throw; } - LogPrintf("[snapshot] moving snapshot chainstate (%s) to " /* Continued */ + LogPrintf("[snapshot] moving snapshot chainstate (%s) to " "default chainstate directory (%s)\n", fs::PathToString(snapshot_chainstate_path), fs::PathToString(ibd_chainstate_path)); @@ -6957,7 +6957,7 @@ bool ChainstateManager::ValidatedSnapshotCleanup() if (!DeleteCoinsDBFromDisk(tmp_old, /*is_snapshot=*/false)) { // No need to AbortNode because once the unneeded bg chainstate data is // moved, it will not interfere with subsequent initialization. - LogPrintf("Deletion of %s failed. Please remove it manually, as the " /* Continued */ + LogPrintf("Deletion of %s failed. Please remove it manually, as the " "directory is now unnecessary.\n", fs::PathToString(tmp_old)); } else { diff --git a/src/wallet/coinjoin.cpp b/src/wallet/coinjoin.cpp index 1421251034d4..8cd19e7f1761 100644 --- a/src/wallet/coinjoin.cpp +++ b/src/wallet/coinjoin.cpp @@ -223,7 +223,7 @@ std::vector CWallet::SelectCoinsGroupedByAddresses(bool fSkipD for (const auto& item : vecTallyRet) { strMessage += strprintf(" %s %f\n", EncodeDestination(item.txdest), float(item.nAmount) / COIN); } - LogPrint(BCLog::SELECTCOINS, "%s", strMessage); /* Continued */ + LogPrint(BCLog::SELECTCOINS, "%s", strMessage); // NOLINT(bitcoin-unterminated-logprintf) } return vecTallyRet; diff --git a/src/wallet/init.cpp b/src/wallet/init.cpp index b4dfeed6ff46..66a5818c13f1 100644 --- a/src/wallet/init.cpp +++ b/src/wallet/init.cpp @@ -207,7 +207,7 @@ void WalletInit::InitCoinJoinSettings(CCoinJoinClientManager& mgr) const if (fAutoStart) { mgr.startMixing(); } - LogPrintf("CoinJoin: autostart=%d, multisession=%d," /* Continued */ + LogPrintf("CoinJoin: autostart=%d, multisession=%d," "sessions=%d, rounds=%d, amount=%d, denoms_goal=%d, denoms_hardcap=%d\n", fAutoStart, CCoinJoinClientOptions::IsMultiSessionEnabled(), CCoinJoinClientOptions::GetSessions(), CCoinJoinClientOptions::GetRounds(), diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 0ae127473cd2..660b3d91568b 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -2423,7 +2423,7 @@ bool CWallet::SignGovernanceVote(const CKeyID& keyID, CGovernanceVote& vote) con void CWallet::CommitTransaction(CTransactionRef tx, mapValue_t mapValue, std::vector> orderForm) { LOCK(cs_wallet); - WalletLogPrintf("CommitTransaction:\n%s", tx->ToString()); /* Continued */ + WalletLogPrintf("CommitTransaction:\n%s", tx->ToString()); // Add tx to wallet, because if it has change it's also ours, // otherwise just for transaction history. diff --git a/test/lint/lint-format-strings.py b/test/lint/lint-format-strings.py index 6992343d6cf6..f42cbd278aa1 100755 --- a/test/lint/lint-format-strings.py +++ b/test/lint/lint-format-strings.py @@ -82,7 +82,7 @@ def main(): matching_files_filtered = [] for matching_file in matching_files: - if not re.search('^src/(dashbls|leveldb|secp256k1|minisketch|tinyformat|test/fuzz/strprintf.cpp|clientversion.cpp)', matching_file): + if not re.search('^src/(dashbls|leveldb|secp256k1|minisketch|tinyformat|test/fuzz/strprintf.cpp|clientversion.cpp)|contrib/devtools/bitcoin-tidy/example_logprintf.cpp', matching_file): matching_files_filtered.append(matching_file) matching_files_filtered.sort() diff --git a/test/lint/lint-include-guards.py b/test/lint/lint-include-guards.py index c5de3b4394a5..e5dfb0ca6b80 100755 --- a/test/lint/lint-include-guards.py +++ b/test/lint/lint-include-guards.py @@ -19,7 +19,8 @@ HEADER_ID_PREFIX = 'BITCOIN_' HEADER_ID_SUFFIX = '_H' -EXCLUDE_FILES_WITH_PREFIX = ['src/crypto/ctaes', +EXCLUDE_FILES_WITH_PREFIX = ['contrib/devtools/bitcoin-tidy', + 'src/crypto/ctaes', 'src/tinyformat.h', 'src/bench/nanobench.h', 'src/test/fuzz/FuzzedDataProvider.h', diff --git a/test/lint/lint-includes.py b/test/lint/lint-includes.py index 9cf5e2d99c8a..dee40afc9558 100755 --- a/test/lint/lint-includes.py +++ b/test/lint/lint-includes.py @@ -16,6 +16,8 @@ from lint_ignore_dirs import SHARED_EXCLUDED_SUBTREES +EXCLUDED_DIRS = ["contrib/devtools/bitcoin-tidy/"] + SHARED_EXCLUDED_SUBTREES + EXPECTED_BOOST_INCLUDES = ["boost/date_time/posix_time/posix_time.hpp", "boost/hana/for_each.hpp", "boost/hana/tuple.hpp", @@ -40,7 +42,7 @@ def get_toplevel(): def list_files_by_suffix(suffixes): - exclude_args = [":(exclude)" + dir for dir in SHARED_EXCLUDED_SUBTREES] + exclude_args = [":(exclude)" + dir for dir in EXCLUDED_DIRS] files_list = check_output(["git", "ls-files", "src"] + exclude_args, text=True, encoding="utf8").splitlines() @@ -98,7 +100,7 @@ def find_extra_boosts(): def find_quote_syntax_inclusions(): - exclude_args = [":(exclude)" + dir for dir in SHARED_EXCLUDED_SUBTREES] + exclude_args = [":(exclude)" + dir for dir in EXCLUDED_DIRS] quote_syntax_inclusions = list() try: diff --git a/test/lint/lint-logs.py b/test/lint/lint-logs.py deleted file mode 100755 index de04a1aecaf5..000000000000 --- a/test/lint/lint-logs.py +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (c) 2018-2022 The Bitcoin Core developers -# Distributed under the MIT software license, see the accompanying -# file COPYING or http://www.opensource.org/licenses/mit-license.php. -# -# Check that all logs are terminated with '\n' -# -# Some logs are continued over multiple lines. They should be explicitly -# commented with /* Continued */ - -import re -import sys - -from subprocess import check_output - - -def main(): - logs_list = check_output(["git", "grep", "--extended-regexp", r"(LogPrintLevel|LogPrintfCategory|LogPrintf?)\(", "--", "*.cpp"], text=True, encoding="utf8").splitlines() - - unterminated_logs = [line for line in logs_list if not re.search(r'(\\n"|/\* Continued \*/)', line)] - - if unterminated_logs != []: - print("All calls to LogPrintf(), LogPrintfCategory(), LogPrint(), LogPrintLevel(), and WalletLogPrintf() should be terminated with \"\\n\".") - print("") - - for line in unterminated_logs: - print(line) - - sys.exit(1) - - -if __name__ == "__main__": - main() From 77cd44efd485dcd430f4e026fb03f6b94a88b333 Mon Sep 17 00:00:00 2001 From: DCG-Claude Date: Tue, 22 Sep 2026 10:13:16 -0500 Subject: [PATCH 2/4] Merge bitcoin/bitcoin#28245: doc: use llvm-config for bitcoin-tidy example d82bb90a5b9dc1fd48b10514bdcd8f425aced256 doc: use llvm-config for bitcoin-tidy example (fanquake) Pull request description: An LLVM installation will have `llvm-config` available to query for info. Ask it for the `--cmakedir`, and use that in our bitcoin-tidy example, rather than listing multiple different (potential) paths per distro/OS etc. ACKs for top commit: theuni: ACK d82bb90a5b9dc1fd48b10514bdcd8f425aced256. jonatack: ACK d82bb90a5b9dc1fd48b10514bdcd8f425aced256 TheCharlatan: Nice, Re-ACK d82bb90a5b9dc1fd48b10514bdcd8f425aced256 Tree-SHA512: e07e979231f8f000deafce0751bed4b73ff0eff995bec49e90f579c9051cf5859dac5e49554b8219d33b00c81192db979eed98fee1c643a9205ea8babfce2c5d --- contrib/devtools/bitcoin-tidy/README | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/contrib/devtools/bitcoin-tidy/README b/contrib/devtools/bitcoin-tidy/README index 1669fe98f57f..c15e07c4ede5 100644 --- a/contrib/devtools/bitcoin-tidy/README +++ b/contrib/devtools/bitcoin-tidy/README @@ -3,6 +3,9 @@ Example Usage: ```bash -cmake -S . -B build -DLLVM_DIR=/path/to/lib/cmake/llvm -DCMAKE_BUILD_TYPE=Release -make -C build -j$(nproc) +cmake -S . -B build -DLLVM_DIR=$(llvm-config --cmakedir) -DCMAKE_BUILD_TYPE=Release + +cmake --build build -j$(nproc) + +cmake --build build --target bitcoin-tidy-tests -j$(nproc) ``` From 487b0c1f1bfcdaecfd629c9d73153516d987488d Mon Sep 17 00:00:00 2001 From: DCG-Claude Date: Tue, 22 Sep 2026 10:13:20 -0500 Subject: [PATCH 3/4] Merge bitcoin/bitcoin#28258: bitcoin-tidy: fix macOS build bb3263d3e3d9f9d4db86dde679f469e7278bf737 bitcoin-tidy: fix macOS build (Cory Fields) Pull request description: [LLVM uses these options](https://github.com/llvm/llvm-project/blob/main/llvm/cmake/modules/HandleLLVMOptions.cmake#L178) for building as well, so there's precedent. Also fix the shared library extension which was incorrectly being set to dylib. Thanks to jonatack for reporting and debugging. ACKs for top commit: jonatack: ACK bb3263d3e3d9f9d4db86dde679f469e7278bf737 tested with arm64 macos 13.5, llvm 16.0.6 and cmake 3.27.2 Tree-SHA512: de7bfd497f38f1565a14d217d0b057cbfa788bdda702b5942b7f0b55947ae5e1c05af13e7d6a073ed036bc4db57035868f180034508b6e084ab9b901a5baaf2f --- contrib/devtools/bitcoin-tidy/CMakeLists.txt | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/contrib/devtools/bitcoin-tidy/CMakeLists.txt b/contrib/devtools/bitcoin-tidy/CMakeLists.txt index 9ed18696d41b..35e60d1d87e2 100644 --- a/contrib/devtools/bitcoin-tidy/CMakeLists.txt +++ b/contrib/devtools/bitcoin-tidy/CMakeLists.txt @@ -25,6 +25,12 @@ else() target_compile_options(bitcoin-tidy PRIVATE -fno-exceptions) endif() +if(CMAKE_HOST_APPLE) + # ld64 expects no undefined symbols by default + target_link_options(bitcoin-tidy PRIVATE -Wl,-flat_namespace) + target_link_options(bitcoin-tidy PRIVATE -Wl,-undefined -Wl,suppress) +endif() + # Add warnings if (MSVC) target_compile_options(bitcoin-tidy PRIVATE /W4) @@ -33,7 +39,12 @@ else() target_compile_options(bitcoin-tidy PRIVATE -Wextra) endif() -set(CLANG_TIDY_COMMAND "${CLANG_TIDY_EXE}" "--load=${CMAKE_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}bitcoin-tidy${CMAKE_SHARED_LIBRARY_SUFFIX}" "-checks=-*,bitcoin-*") +if(CMAKE_VERSION VERSION_LESS 3.27) + set(CLANG_TIDY_COMMAND "${CLANG_TIDY_EXE}" "--load=${CMAKE_BINARY_DIR}/${CMAKE_SHARED_MODULE_PREFIX}bitcoin-tidy${CMAKE_SHARED_MODULE_SUFFIX}" "-checks=-*,bitcoin-*") +else() + # CLANG_TIDY_COMMAND supports generator expressions as of 3.27 + set(CLANG_TIDY_COMMAND "${CLANG_TIDY_EXE}" "--load=$" "-checks=-*,bitcoin-*") +endif() # Create a dummy library that runs clang-tidy tests as a side-effect of building add_library(bitcoin-tidy-tests OBJECT EXCLUDE_FROM_ALL example_logprintf.cpp) From deacf04e0ec91749534feb85923916ed31e41a39 Mon Sep 17 00:00:00 2001 From: DCG-Claude Date: Tue, 22 Sep 2026 10:13:24 -0500 Subject: [PATCH 4/4] Merge bitcoin/bitcoin#27907: bench: bugfix, disable birth time block skip for wallet_create_tx.cpp a72af2e833bcf7baa79a246609da90ae0ade2a82 bench: disable birth time block skip for wallet_create_tx.cpp (furszy) Pull request description: As the benchmarks inside `wallet_create_tx.cpp` assert the wallet balance at the end, they require all blocks to be scanned by the wallet. So, we need to ensure that no blocks are skipped by the recently added wallet birth time functionality. This just means setting the wallet birth time to the genesis block time. So the wallet is always older than any new block. ACKs for top commit: achow101: ACK a72af2e833bcf7baa79a246609da90ae0ade2a82 hernanmarino: ACK a72af2e833bcf7baa79a246609da90ae0ade2a82 TheCharlatan: ACK a72af2e833bcf7baa79a246609da90ae0ade2a82 Tree-SHA512: d3148659bd633d20978736e1292e3456a2c6dd2b6c8f60625a4160e16818d923487c889237eb3f34693f7dd78b7d124b89afdc56e4c9fad370026d0733ef1e08 Dash adaptations: - src/bench/wallet_create_tx.cpp: kept Dash's CWallet constructor call (extra coinjoin_loader + gArgs params, and CreateMockWalletDatabase() since Dash predates the CreateMockableWalletDatabase rename) as the anchor context for both hunks; only the 2x comment+SetMockTime lines were added --- src/bench/wallet_create_tx.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/bench/wallet_create_tx.cpp b/src/bench/wallet_create_tx.cpp index c528c16be754..3dc9c3c9f690 100644 --- a/src/bench/wallet_create_tx.cpp +++ b/src/bench/wallet_create_tx.cpp @@ -84,6 +84,8 @@ static void WalletCreateTx(benchmark::Bench& bench, const OutputType output_type { const auto test_setup = MakeNoLogFileContext(); + // Set clock to genesis block, so the descriptors/keys creation time don't interfere with the blocks scanning process. + SetMockTime(test_setup->m_node.chainman->GetParams().GenesisBlock().nTime); CWallet wallet{test_setup->m_node.chain.get(), test_setup->m_node.coinjoin_loader.get(), "", gArgs, CreateMockWalletDatabase()}; { LOCK(wallet.cs_wallet); @@ -137,6 +139,8 @@ static void WalletCreateTx(benchmark::Bench& bench, const OutputType output_type static void AvailableCoins(benchmark::Bench& bench, const std::vector& output_type) { const auto test_setup = MakeNoLogFileContext(); + // Set clock to genesis block, so the descriptors/keys creation time don't interfere with the blocks scanning process. + SetMockTime(test_setup->m_node.chainman->GetParams().GenesisBlock().nTime); CWallet wallet{test_setup->m_node.chain.get(), test_setup->m_node.coinjoin_loader.get(), "", gArgs, CreateMockWalletDatabase()}; { LOCK(wallet.cs_wallet);