Merge bitcoin/bitcoin#36397: scripted-diff: [wallet] Remove trailing newlines from one-line log messages
What changed, and why it matters
This is a code-cleanup change for Bitcoin Core's wallet logging. It removes manual newline characters from the end of one-line log messages and adds a compile-time check that prevents wallet log format strings from ending in a newline. The change is defensive: it reduces the chance that a future log message could accidentally inject fake log lines or confuse log parsing, but it does not by itself fix an active security bug.
No urgent action required. Treat as a defensive hardening and style cleanup. Reviewers of future wallet logging changes should ensure format strings do not end with newlines, which is now enforced at compile time.
Security signals we found
Compile-time rejection of trailing newlines in wallet log format strings
Mass removal of trailing newlines from wallet log messages
Reference in PR description to log-injection discussion
Existing LogEscapeMessage already escapes control characters including newlines in log output
Evidence from the diff
The commit merges PR #36397. It introduces util::log::FormatString, a consteval wrapper around util::ConstevalFormatString that throws a compile-time error if the format string ends with ‘\n’. Wallet logging helpers (WalletLogPrintf in CWallet and ScriptPubKeyMan) are switched from util::ConstevalFormatString to util::log::FormatString, making trailing newlines a build failure for wallet code. The bulk of the diff is a scripted removal of trailing ‘\n’ from wallet log and SQLite error strings. A test for LogEscapeMessage is moved to logging_tests.cpp and augmented with static assertions for the new format-string concept. The PR description explicitly frames this as a low-priority style cleanup motivated partly by prior discussion of log injection.
Changed components
src/util/log.hsrc/wallet/wallet.hsrc/wallet/scriptpubkeyman.hsrc/wallet/*.cpp logging callssrc/wallet/sqlite.cpp error stringssrc/test/logging_tests.cppInspect captured patch +119 / −102
### src/test/logging_tests.cpp
@@ -14,22 +14,34 @@
#include <util/fs_helpers.h>
#include <util/string.h>
+#include <boost/test/unit_test.hpp>
+
#include <chrono>
#include <fstream>
#include <future>
#include <ios>
#include <iostream>
#include <source_location>
#include <string>
+#include <type_traits>
#include <unordered_map>
#include <utility>
#include <vector>
-#include <boost/test/unit_test.hpp>
-
using util::SplitString;
using util::TrimString;
+/* defined in logging.cpp */
+namespace BCLog {
+ std::string LogEscapeMessage(std::string_view str);
+}
+
+template <auto str>
+concept IsLogFormatString = requires { typename std::bool_constant<(util::log::FormatString<0>{str()}, true)>; };
+
+static_assert(IsLogFormatString<[] { return "format string without a trailing newline"; }>);
+static_assert(!IsLogFormatString<[] { return "format string ending in a newline\n"; }>);
+
BOOST_FIXTURE_TEST_SUITE(logging_tests, BasicTestingSetup)
static void ResetLogger()
@@ -110,6 +122,19 @@ BOOST_AUTO_TEST_CASE(logging_timer)
BOOST_CHECK_EQUAL(micro_timer.LogMsg("msg").substr(0, result_prefix.size()), result_prefix);
}
+BOOST_AUTO_TEST_CASE(test_LogEscapeMessage)
+{
+ // ASCII and UTF-8 must pass through unaltered.
+ BOOST_CHECK_EQUAL(BCLog::LogEscapeMessage("Valid log message貓"), "Valid log message貓");
+ // Newlines are escaped too, so a message can't forge log lines.
+ BOOST_CHECK_EQUAL(BCLog::LogEscapeMessage("Message\n with newlines\n"), R"(Message\x0a with newlines\x0a)");
+ // Other control characters are escaped in C syntax.
+ BOOST_CHECK_EQUAL(BCLog::LogEscapeMessage("\x01\x7f Corrupted log message\x0d"), R"(\x01\x7f Corrupted log message\x0d)");
+ // Embedded NULL characters are escaped too.
+ const std::string NUL("O\x00O", 3);
+ BOOST_CHECK_EQUAL(BCLog::LogEscapeMessage(NUL), R"(O\x00O)");
+}
+
BOOST_FIXTURE_TEST_CASE(logging_LogPrint, LogSetup)
{
LogInstance().m_log_sourcelocations = true;
### src/test/util_tests.cpp
@@ -65,11 +65,6 @@ using util::TrimStringView;
static const std::string STRING_WITH_EMBEDDED_NULL_CHAR{"1"s "\0" "1"s};
-/* defined in logging.cpp */
-namespace BCLog {
- std::string LogEscapeMessage(std::string_view str);
-}
-
BOOST_FIXTURE_TEST_SUITE(util_tests, BasicTestingSetup)
namespace {
@@ -1394,19 +1389,6 @@ BOOST_AUTO_TEST_CASE(test_SplitString)
}
}
-BOOST_AUTO_TEST_CASE(test_LogEscapeMessage)
-{
- // ASCII and UTF-8 must pass through unaltered.
- BOOST_CHECK_EQUAL(BCLog::LogEscapeMessage("Valid log message貓"), "Valid log message貓");
- // Newlines are escaped too, so a message can't forge log lines.
- BOOST_CHECK_EQUAL(BCLog::LogEscapeMessage("Message\n with newlines\n"), R"(Message\x0a with newlines\x0a)");
- // Other control characters are escaped in C syntax.
- BOOST_CHECK_EQUAL(BCLog::LogEscapeMessage("\x01\x7f Corrupted log message\x0d"), R"(\x01\x7f Corrupted log message\x0d)");
- // Embedded NULL characters are escaped too.
- const std::string NUL("O\x00O", 3);
- BOOST_CHECK_EQUAL(BCLog::LogEscapeMessage(NUL), R"(O\x00O)");
-}
-
namespace {
struct Tracker
### src/util/log.h
@@ -80,6 +80,16 @@ bool ShouldTraceLog(Category category);
/** Send message to be logged. Applications using the logging library need to provide this. */
void Log(Entry entry);
+/// A format string for a log entry. The logger appends the trailing newline,
+/// so reject one in the format.
+template <unsigned num_params>
+struct FormatString : util::ConstevalFormatString<num_params> {
+ consteval FormatString(const char* str) : util::ConstevalFormatString<num_params>{str}
+ {
+ if (std::string_view{str}.ends_with('\n')) throw "Format string must not end with a newline";
+ }
+};
+
template <typename... Args>
inline void LogPrintFormatInternal_(SourceLocation&& source_loc, BCLog::LogFlags flag, util::log::Level level, bool should_ratelimit, util::ConstevalFormatString<sizeof...(Args)> fmt, const Args&... args)
{
### src/wallet/dump.cpp
@@ -114,7 +114,7 @@ bool DumpWallet(const ArgsManager& args, WalletDatabase& db, bilingual_str& erro
// deleter here.
static void WalletToolReleaseWallet(CWallet* wallet)
{
- wallet->WalletLogPrintf("Releasing wallet\n");
+ wallet->WalletLogPrintf("Releasing wallet");
wallet->Close();
delete wallet;
}
### src/wallet/receive.cpp
@@ -175,7 +175,7 @@ void CachedTxGetAmounts(const CWallet& wallet, const CWalletTx& wtx,
if (!ExtractDestination(txout.scriptPubKey, address) && !txout.scriptPubKey.IsUnspendable())
{
- wallet.WalletLogPrintf("CWalletTx::GetAmounts: Unknown transaction type found, txid %s\n",
+ wallet.WalletLogPrintf("CWalletTx::GetAmounts: Unknown transaction type found, txid %s",
wtx.GetHash().ToString());
address = CNoDestination();
}
### src/wallet/scan.cpp
@@ -23,7 +23,7 @@ int64_t ChainScanner::ScanFromTime(int64_t startTime, const WalletRescanReserver
int start_height = 0;
uint256 start_block;
bool start = m_wallet.chain().findFirstBlockWithTimeAndHeight(startTime - TIMESTAMP_WINDOW, 0, FoundBlock().hash(start_block).height(start_height));
- m_wallet.WalletLogPrintf("%s: Rescanning last %i blocks\n", __func__, start ? WITH_LOCK(m_wallet.cs_wallet, return m_wallet.GetLastBlockHeight()) - start_height + 1 : 0);
+ m_wallet.WalletLogPrintf("%s: Rescanning last %i blocks", __func__, start ? WITH_LOCK(m_wallet.cs_wallet, return m_wallet.GetLastBlockHeight()) - start_height + 1 : 0);
if (start) {
// TODO: this should take into account failure by ScanResult::USER_ABORT
@@ -207,7 +207,7 @@ bool ChainScanner::ScanBlock(const uint256& block_hash, int block_height, bool s
}
if (!loc.IsNull()) {
- m_wallet.WalletLogPrintf("Saving scan progress %d.\n", block_height);
+ m_wallet.WalletLogPrintf("Saving scan progress %d.", block_height);
WalletBatch batch(m_wallet.GetDatabase());
batch.WriteBestBlock(loc);
}
@@ -227,7 +227,7 @@ ScanResult ChainScanner::Scan(const uint256& start_block, int start_height, std:
std::unique_ptr<FastWalletRescanFilter> fast_rescan_filter;
if (chain.hasBlockFilterIndex(BlockFilterType::BASIC)) fast_rescan_filter = std::make_unique<FastWalletRescanFilter>(m_wallet);
- m_wallet.WalletLogPrintf("Rescan started from block %s... (%s)\n", start_block.ToString(),
+ m_wallet.WalletLogPrintf("Rescan started from block %s... (%s)", start_block.ToString(),
fast_rescan_filter ? "fast variant using block filters" : "slow variant inspecting all blocks");
// show rescan progress in GUI as dialog or on splashscreen, if rescan required on startup (e.g. due to corruption)
@@ -260,7 +260,7 @@ ScanResult ChainScanner::Scan(const uint256& start_block, int start_height, std:
bool next_interval = reserver.now() >= current_time + INTERVAL_TIME;
if (next_interval) {
current_time = reserver.now();
- m_wallet.WalletLogPrintf("Still rescanning. At block %d. Progress=%f\n", block_height, progress_current);
+ m_wallet.WalletLogPrintf("Still rescanning. At block %d. Progress=%f", block_height, progress_current);
}
bool fetch_block{true};
@@ -305,18 +305,18 @@ ScanResult ChainScanner::Scan(const uint256& start_block, int start_height, std:
if (!max_height) UpdateTipIfChanged(state);
}
if (!max_height) {
- m_wallet.WalletLogPrintf("Scanning current mempool transactions.\n");
+ m_wallet.WalletLogPrintf("Scanning current mempool transactions.");
WITH_LOCK(m_wallet.cs_wallet, chain.requestMempoolTransactions(m_wallet));
}
m_wallet.ShowProgress(strprintf("[%s] %s", m_wallet.DisplayName(), _("Rescanning…")), 100); // hide progress dialog in GUI
if (m_abort) {
- m_wallet.WalletLogPrintf("Rescan aborted at block %d. Progress=%f\n", block_height, progress_current);
+ m_wallet.WalletLogPrintf("Rescan aborted at block %d. Progress=%f", block_height, progress_current);
result.status = ScanResult::USER_ABORT;
} else if (chain.shutdownRequested()) {
- m_wallet.WalletLogPrintf("Rescan interrupted by shutdown request at block %d. Progress=%f\n", block_height, progress_current);
+ m_wallet.WalletLogPrintf("Rescan interrupted by shutdown request at block %d. Progress=%f", block_height, progress_current);
result.status = ScanResult::USER_ABORT;
} else {
- m_wallet.WalletLogPrintf("Rescan completed in %15dms\n", Ticks<std::chrono::milliseconds>(reserver.now() - start_time));
+ m_wallet.WalletLogPrintf("Rescan completed in %15dms", Ticks<std::chrono::milliseconds>(reserver.now() - start_time));
}
return result;
}
### src/wallet/scriptpubkeyman.cpp
@@ -294,7 +294,7 @@ bool LegacyDataSPKM::LoadCScript(const CScript& redeemScript)
if (redeemScript.size() > MAX_SCRIPT_ELEMENT_SIZE)
{
std::string strAddr = EncodeDestination(ScriptHash(redeemScript));
- WalletLogPrintf("%s: Warning: This wallet contains a redeemScript of size %i which exceeds maximum size %i thus can never be redeemed. Do not use address %s.\n", __func__, redeemScript.size(), MAX_SCRIPT_ELEMENT_SIZE, strAddr);
+ WalletLogPrintf("%s: Warning: This wallet contains a redeemScript of size %i which exceeds maximum size %i thus can never be redeemed. Do not use address %s.", __func__, redeemScript.size(), MAX_SCRIPT_ELEMENT_SIZE, strAddr);
return true;
}
@@ -1192,7 +1192,7 @@ std::vector<WalletDestination> DescriptorScriptPubKeyMan::MarkUnusedAddresses(co
if (IsMine(script)) {
int32_t index = m_map_script_pub_keys[script];
if (index >= m_wallet_descriptor.GetNext()) {
- WalletLogPrintf("%s: Detected a used keypool item at index %d, mark all keypool items up to this item as used\n", __func__, index);
+ WalletLogPrintf("%s: Detected a used keypool item at index %d, mark all keypool items up to this item as used", __func__, index);
auto out_keys = std::make_unique<FlatSigningProvider>();
std::vector<CScript> scripts_temp;
while (index >= m_wallet_descriptor.GetNext()) {
@@ -1206,7 +1206,7 @@ std::vector<WalletDestination> DescriptorScriptPubKeyMan::MarkUnusedAddresses(co
}
}
if (!TopUp()) {
- WalletLogPrintf("%s: Topping up keypool failed (locked wallet)\n", __func__);
+ WalletLogPrintf("%s: Topping up keypool failed (locked wallet)", __func__);
}
}
### src/wallet/scriptpubkeyman.h
@@ -147,7 +147,7 @@ class ScriptPubKeyMan
/** Prepends the wallet name in logging output to ease debugging in multi-wallet use cases */
template <typename... Params>
- void WalletLogPrintf(util::ConstevalFormatString<sizeof...(Params)> wallet_fmt, const Params&... params) const
+ void WalletLogPrintf(util::log::FormatString<sizeof...(Params)> wallet_fmt, const Params&... params) const
{
LogInfo("[%s] %s", m_storage.LogName(), tfm::format(wallet_fmt, params...));
};
### src/wallet/spend.cpp
@@ -1439,8 +1439,8 @@ static util::Result<CreatedTransactionResult> CreateTransactionInternal(
// accidental reuse.
reservedest.KeepDestination();
- wallet.WalletLogPrintf("Coin Selection: Algorithm:%s, Waste Metric Score:%d\n", GetAlgorithmName(result.GetAlgo()), result.GetWaste());
- wallet.WalletLogPrintf("Fee Calculation: Fee:%d Bytes:%u, Source: %s\n",
+ wallet.WalletLogPrintf("Coin Selection: Algorithm:%s, Waste Metric Score:%d", GetAlgorithmName(result.GetAlgo()), result.GetWaste());
+ wallet.WalletLogPrintf("Fee Calculation: Fee:%d Bytes:%u, Source: %s",
current_fee, nBytes, StringForFeeReason(min_fee_rate.fee_reason));
return CreatedTransactionResult(tx, current_fee, change_pos, min_fee_rate.fee_reason);
}
@@ -1491,7 +1491,7 @@ util::Result<CreatedTransactionResult> CreateTransaction(
txr_grouped.has_value() ? txr_grouped->fee : 0,
txr_grouped.has_value() && txr_grouped->change_pos.has_value() ? int32_t(*txr_grouped->change_pos) : -1);
if (txr_grouped) {
- wallet.WalletLogPrintf("Fee non-grouped = %lld, grouped = %lld, using %s\n",
+ wallet.WalletLogPrintf("Fee non-grouped = %lld, grouped = %lld, using %s",
txr_ungrouped.fee, txr_grouped->fee, use_aps ? "grouped" : "non-grouped");
if (use_aps) return txr_grouped;
}
### src/wallet/sqlite.cpp
@@ -104,7 +104,7 @@ static void SetPragma(sqlite3* db, const std::string& key, const std::string& va
std::string stmt_text = strprintf("PRAGMA %s = %s", key, value);
int ret = sqlite3_exec(db, stmt_text.c_str(), nullptr, nullptr, nullptr);
if (ret != SQLITE_OK) {
- throw std::runtime_error(strprintf("SQLiteDatabase: %s: %s\n", err_msg, sqlite3_errstr(ret)));
+ throw std::runtime_error(strprintf("SQLiteDatabase: %s: %s", err_msg, sqlite3_errstr(ret)));
}
}
@@ -124,17 +124,17 @@ SQLiteDatabase::SQLiteDatabase(const fs::path& dir_path, const fs::path& file_pa
// Setup logging
int ret = sqlite3_config(SQLITE_CONFIG_LOG, ErrorLogCallback, nullptr);
if (ret != SQLITE_OK) {
- throw std::runtime_error(strprintf("SQLiteDatabase: Failed to setup error log: %s\n", sqlite3_errstr(ret)));
+ throw std::runtime_error(strprintf("SQLiteDatabase: Failed to setup error log: %s", sqlite3_errstr(ret)));
}
// Force serialized threading mode
ret = sqlite3_config(SQLITE_CONFIG_SERIALIZED);
if (ret != SQLITE_OK) {
- throw std::runtime_error(strprintf("SQLiteDatabase: Failed to configure serialized threading mode: %s\n", sqlite3_errstr(ret)));
+ throw std::runtime_error(strprintf("SQLiteDatabase: Failed to configure serialized threading mode: %s", sqlite3_errstr(ret)));
}
}
int ret = sqlite3_initialize(); // This is a no-op if sqlite3 is already initialized
if (ret != SQLITE_OK) {
- throw std::runtime_error(strprintf("SQLiteDatabase: Failed to initialize SQLite: %s\n", sqlite3_errstr(ret)));
+ throw std::runtime_error(strprintf("SQLiteDatabase: Failed to initialize SQLite: %s", sqlite3_errstr(ret)));
}
}
@@ -162,7 +162,7 @@ void SQLiteBatch::SetupSQLStatements()
int res = sqlite3_prepare_v2(m_database.m_db, stmt_text, -1, stmt_prepared, nullptr);
if (res != SQLITE_OK) {
throw std::runtime_error(strprintf(
- "SQLiteDatabase: Failed to setup SQL statements: %s\n", sqlite3_errstr(res)));
+ "SQLiteDatabase: Failed to setup SQL statements: %s", sqlite3_errstr(res)));
}
}
}
@@ -267,11 +267,11 @@ void SQLiteDatabase::Open(int additional_flags)
int ret = sqlite3_open_v2(m_file_path.c_str(), &m_db, flags, nullptr);
if (ret != SQLITE_OK) {
- throw std::runtime_error(strprintf("SQLiteDatabase: Failed to open database: %s\n", sqlite3_errstr(ret)));
+ throw std::runtime_error(strprintf("SQLiteDatabase: Failed to open database: %s", sqlite3_errstr(ret)));
}
ret = sqlite3_extended_result_codes(m_db, 1);
if (ret != SQLITE_OK) {
- throw std::runtime_error(strprintf("SQLiteDatabase: Failed to enable extended result codes: %s\n", sqlite3_errstr(ret)));
+ throw std::runtime_error(strprintf("SQLiteDatabase: Failed to enable extended result codes: %s", sqlite3_errstr(ret)));
}
// Trace SQL statements if tracing is enabled with -debug=walletdb -loglevel=walletdb:trace
if (util::log::ShouldTraceLog(BCLog::WALLETDB)) {
@@ -292,11 +292,11 @@ void SQLiteDatabase::Open(int additional_flags)
// Now begin a transaction to acquire the exclusive lock. This lock won't be released until we close because of the exclusive locking mode.
int ret = sqlite3_exec(m_db, "BEGIN EXCLUSIVE TRANSACTION", nullptr, nullptr, nullptr);
if (ret != SQLITE_OK) {
- throw std::runtime_error("SQLiteDatabase: Unable to obtain an exclusive lock on the database, is it being used by another instance of " CLIENT_NAME "?\n");
+ throw std::runtime_error("SQLiteDatabase: Unable to obtain an exclusive lock on the database, is it being used by another instance of " CLIENT_NAME "?");
}
ret = sqlite3_exec(m_db, "COMMIT", nullptr, nullptr, nullptr);
if (ret != SQLITE_OK) {
- throw std::runtime_error(strprintf("SQLiteDatabase: Unable to end exclusive lock transaction: %s\n", sqlite3_errstr(ret)));
+ throw std::runtime_error(strprintf("SQLiteDatabase: Unable to end exclusive lock transaction: %s", sqlite3_errstr(ret)));
}
// Enable fullfsync for the platforms that use it
@@ -313,26 +313,26 @@ void SQLiteDatabase::Open(int additional_flags)
sqlite3_stmt* check_main_stmt{nullptr};
ret = sqlite3_prepare_v2(m_db, "SELECT name FROM sqlite_master WHERE type='table' AND name='main'", -1, &check_main_stmt, nullptr);
if (ret != SQLITE_OK) {
- throw std::runtime_error(strprintf("SQLiteDatabase: Failed to prepare statement to check table existence: %s\n", sqlite3_errstr(ret)));
+ throw std::runtime_error(strprintf("SQLiteDatabase: Failed to prepare statement to check table existence: %s", sqlite3_errstr(ret)));
}
ret = sqlite3_step(check_main_stmt);
if (sqlite3_finalize(check_main_stmt) != SQLITE_OK) {
- throw std::runtime_error(strprintf("SQLiteDatabase: Failed to finalize statement checking table existence: %s\n", sqlite3_errstr(ret)));
+ throw std::runtime_error(strprintf("SQLiteDatabase: Failed to finalize statement checking table existence: %s", sqlite3_errstr(ret)));
}
bool table_exists;
if (ret == SQLITE_DONE) {
table_exists = false;
} else if (ret == SQLITE_ROW) {
table_exists = true;
} else {
- throw std::runtime_error(strprintf("SQLiteDatabase: Failed to execute statement to check table existence: %s\n", sqlite3_errstr(ret)));
+ throw std::runtime_error(strprintf("SQLiteDatabase: Failed to execute statement to check table existence: %s", sqlite3_errstr(ret)));
}
// Do the db setup things because the table doesn't exist only when we are creating a new wallet
if (!table_exists) {
ret = sqlite3_exec(m_db, "CREATE TABLE main(key BLOB PRIMARY KEY NOT NULL, value BLOB NOT NULL)", nullptr, nullptr, nullptr);
if (ret != SQLITE_OK) {
- throw std::runtime_error(strprintf("SQLiteDatabase: Failed to create new database: %s\n", sqlite3_errstr(ret)));
+ throw std::runtime_error(strprintf("SQLiteDatabase: Failed to create new database: %s", sqlite3_errstr(ret)));
}
// Set the application id
@@ -384,7 +384,7 @@ void SQLiteDatabase::Close()
{
int res = sqlite3_close(m_db);
if (res != SQLITE_OK) {
- throw std::runtime_error(strprintf("SQLiteDatabase: Failed to close database: %s\n", sqlite3_errstr(res)));
+ throw std::runtime_error(strprintf("SQLiteDatabase: Failed to close database: %s", sqlite3_errstr(res)));
}
m_db = nullptr;
}
@@ -613,7 +613,7 @@ std::unique_ptr<DatabaseCursor> SQLiteBatch::GetNewCursor()
int res = sqlite3_prepare_v2(m_database.m_db, stmt_text, -1, &cursor->m_cursor_stmt, nullptr);
if (res != SQLITE_OK) {
throw std::runtime_error(strprintf(
- "%s: Failed to setup cursor SQL statement: %s\n", __func__, sqlite3_errstr(res)));
+ "%s: Failed to setup cursor SQL statement: %s", __func__, sqlite3_errstr(res)));
}
return cursor;
@@ -650,7 +650,7 @@ std::unique_ptr<DatabaseCursor> SQLiteBatch::GetNewPrefixCursor(std::span<const
int res = sqlite3_prepare_v2(m_database.m_db, stmt_text, -1, &cursor->m_cursor_stmt, nullptr);
if (res != SQLITE_OK) {
throw std::runtime_error(strprintf(
- "SQLiteDatabase: Failed to setup cursor SQL statement: %s\n", sqlite3_errstr(res)));
+ "SQLiteDatabase: Failed to setup cursor SQL statement: %s", sqlite3_errstr(res)));
}
if (!BindBlobToStatement(cursor->m_cursor_stmt, 1, cursor->m_prefix_range_start, "prefix_start")) return nullptr;
### src/wallet/wallet.cpp
@@ -250,7 +250,7 @@ static std::set<std::string> g_unloading_wallet_set GUARDED_BY(g_wallet_release_
static void FlushAndDeleteWallet(CWallet* wallet)
{
const std::string name = wallet->GetName();
- wallet->WalletLogPrintf("Releasing wallet %s..\n", name);
+ wallet->WalletLogPrintf("Releasing wallet %s..", name);
delete wallet;
// Wallet is now released, notify WaitForDeleteWallet, if any.
{
@@ -662,7 +662,7 @@ util::Expected<void, WalletError> CWallet::ChangeWalletPassphrase(const SecureSt
if (!WalletBatch(GetDatabase()).WriteMasterKey(master_key_id, new_master_key)) {
return util::Unexpected{WalletError{WalletErrorCode::GenericError, _("Error: Writing the new encryption key to the wallet database failed")}};
}
- WalletLogPrintf("Wallet passphrase changed to an nDeriveIterations of %i\n", new_master_key.nDeriveIterations);
+ WalletLogPrintf("Wallet passphrase changed to an nDeriveIterations of %i", new_master_key.nDeriveIterations);
master_key = std::move(new_master_key);
return {};
}
@@ -864,7 +864,7 @@ bool CWallet::EncryptWallet(const SecureString& strWalletPassphrase)
if (!EncryptMasterKey(strWalletPassphrase, plain_master_key, master_key)) {
return false;
}
- WalletLogPrintf("Encrypting Wallet with an nDeriveIterations of %i\n", master_key.nDeriveIterations);
+ WalletLogPrintf("Encrypting Wallet with an nDeriveIterations of %i", master_key.nDeriveIterations);
{
LOCK2(m_relock_mutex, cs_wallet);
@@ -1005,7 +1005,7 @@ bool CWallet::MarkReplaced(const Txid& originalHash, const Txid& newHash)
bool success = true;
if (!batch.WriteTxMetadata(wtx)) {
- WalletLogPrintf("%s: Updating batch tx %s failed\n", __func__, wtx.GetHash().ToString());
+ WalletLogPrintf("%s: Updating batch tx %s failed", __func__, wtx.GetHash().ToString());
success = false;
}
@@ -1015,7 +1015,7 @@ bool CWallet::MarkReplaced(const Txid& originalHash, const Txid& newHash)
if (variant == &wtx) continue;
variant->m_replaced_by_txid = newHash;
if (!batch.WriteTxMetadata(*variant)) {
- WalletLogPrintf("%s: Updating variant tx %s failed\n", __func__, variant->GetHash().ToString());
+ WalletLogPrintf("%s: Updating variant tx %s failed", __func__, variant->GetHash().ToString());
success = false;
}
}
@@ -1225,7 +1225,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransactionRef& ptx, const SyncTxS
std::pair<TxSpends::const_iterator, TxSpends::const_iterator> range = mapTxSpends.equal_range(txin.prevout);
while (range.first != range.second) {
if (range.first->second != tx.GetHash()) {
- WalletLogPrintf("Transaction %s (in block %s) conflicts with wallet transaction %s (both spend %s:%i)\n", tx.GetHash().ToString(), conf->confirmed_block_hash.ToString(), range.first->second.ToString(), range.first->first.hash.ToString(), range.first->first.n);
+ WalletLogPrintf("Transaction %s (in block %s) conflicts with wallet transaction %s (both spend %s:%i)", tx.GetHash().ToString(), conf->confirmed_block_hash.ToString(), range.first->second.ToString(), range.first->first.hash.ToString(), range.first->first.n);
MarkConflicted(conf->confirmed_block_hash, conf->confirmed_block_height, range.first->second);
}
range.first++;
@@ -1856,7 +1856,7 @@ bool CWallet::SubmitTxMemoryPoolAndRelay(CWalletTx& wtx,
what = "for private broadcast without adding to the mempool";
break;
}
- WalletLogPrintf("Submitting wtx %s %s\n", wtx.GetHash().ToString(), what);
+ WalletLogPrintf("Submitting wtx %s %s", wtx.GetHash().ToString(), what);
// We must set TxStateInMempool here. Even though it will also be set later by the
// entered-mempool callback, if we did not there would be a race where a
// user could call sendmoney in a loop and hit spurious out of funds errors
@@ -1956,7 +1956,7 @@ void CWallet::ResubmitWalletTransactions(node::TxBroadcast broadcast_method, boo
} // cs_wallet
if (submitted_tx_count > 0) {
- WalletLogPrintf("%s: resubmit %u unconfirmed transactions\n", __func__, submitted_tx_count);
+ WalletLogPrintf("%s: resubmit %u unconfirmed transactions", __func__, submitted_tx_count);
}
}
@@ -2145,7 +2145,7 @@ void CWallet::CommitTransaction(
)
{
LOCK(cs_wallet);
- WalletLogPrintf("CommitTransaction:\n%s\n", util::RemoveSuffixView(tx->ToString(), "\n"));
+ WalletLogPrintf("CommitTransaction:\n%s", util::RemoveSuffixView(tx->ToString(), "\n"));
// Add tx to wallet, because if it has change it's also ours,
// otherwise just for transaction history.
@@ -2177,7 +2177,7 @@ void CWallet::CommitTransaction(
std::string err_string;
if (!SubmitTxMemoryPoolAndRelay(*wtx, err_string, node::TxBroadcast::MEMPOOL_AND_BROADCAST_TO_ALL)) {
- WalletLogPrintf("CommitTransaction(): Transaction cannot be broadcast immediately, %s\n", err_string);
+ WalletLogPrintf("CommitTransaction(): Transaction cannot be broadcast immediately, %s", err_string);
// TODO: if we expect the failure to be long term or permanent, instead delete wtx from the wallet and return failure.
}
}
@@ -2318,11 +2318,11 @@ bool CWallet::SetAddressBookWithDB(WalletBatch& batch, const CTxDestination& add
const std::string& encoded_dest = EncodeDestination(address);
if (new_purpose && !batch.WritePurpose(encoded_dest, PurposeToString(*new_purpose))) {
- WalletLogPrintf("Error: fail to write address book 'purpose' entry\n");
+ WalletLogPrintf("Error: fail to write address book 'purpose' entry");
return false;
}
if (!batch.WriteName(encoded_dest, strName)) {
- WalletLogPrintf("Error: fail to write address book 'name' entry\n");
+ WalletLogPrintf("Error: fail to write address book 'name' entry");
return false;
}
@@ -2355,24 +2355,24 @@ bool CWallet::DelAddressBookWithDB(WalletBatch& batch, const CTxDestination& add
// NOTE: This isn't a problem for sending addresses because they don't have any data that needs to be kept.
// When adding new address data, it should be considered here whether to retain or delete it.
if (IsMine(address)) {
- WalletLogPrintf("%s called with IsMine address, NOT SUPPORTED. Please report this bug! %s\n", __func__, CLIENT_BUGREPORT);
+ WalletLogPrintf("%s called with IsMine address, NOT SUPPORTED. Please report this bug! %s", __func__, CLIENT_BUGREPORT);
return false;
}
// Delete data rows associated with this address
if (!batch.EraseAddressData(address)) {
- WalletLogPrintf("Error: cannot erase address book entry data\n");
+ WalletLogPrintf("Error: cannot erase address book entry data");
return false;
}
// Delete purpose entry
if (!batch.ErasePurpose(dest)) {
- WalletLogPrintf("Error: cannot erase address book entry purpose\n");
+ WalletLogPrintf("Error: cannot erase address book entry purpose");
return false;
}
// Delete name entry
if (!batch.EraseName(dest)) {
- WalletLogPrintf("Error: cannot erase address book entry name\n");
+ WalletLogPrintf("Error: cannot erase address book entry name");
return false;
}
@@ -2674,7 +2674,7 @@ unsigned int CWallet::ComputeTimeSmart(const CWalletTx& wtx, bool rescanning_old
nTimeSmart = std::max(latestEntry, std::min(blocktime, latestNow));
}
} else {
- WalletLogPrintf("%s: found %s in block %s not in index\n", __func__, wtx.GetHash().ToString(), block_hash->ToString());
+ WalletLogPrintf("%s: found %s in block %s not in index", __func__, wtx.GetHash().ToString(), block_hash->ToString());
}
}
return nTimeSmart;
@@ -2982,7 +2982,7 @@ std::shared_ptr<CWallet> CWallet::CreateNew(WalletContext& context, const std::s
}
}
- walletInstance->WalletLogPrintf("Wallet completed creation in %15dms\n", Ticks<std::chrono::milliseconds>(SteadyClock::now() - start));
+ walletInstance->WalletLogPrintf("Wallet completed creation in %15dms", Ticks<std::chrono::milliseconds>(SteadyClock::now() - start));
// Try to top up keypool. No-op if the wallet is locked.
walletInstance->TopUpKeyPool();
@@ -3023,7 +3023,7 @@ std::shared_ptr<CWallet> CWallet::LoadExisting(WalletContext& context, const std
}
}
- walletInstance->WalletLogPrintf("Wallet completed loading in %15dms\n", Ticks<std::chrono::milliseconds>(SteadyClock::now() - start));
+ walletInstance->WalletLogPrintf("Wallet completed loading in %15dms", Ticks<std::chrono::milliseconds>(SteadyClock::now() - start));
// Try to top up keypool. No-op if the wallet is locked.
walletInstance->TopUpKeyPool();
@@ -3136,7 +3136,7 @@ bool CWallet::AttachChain(const std::shared_ptr<CWallet>& walletInstance, interf
}
chain.initMessage(_("Rescanning…"));
- walletInstance->WalletLogPrintf("Rescanning last %i blocks (from block %i)...\n", *tip_height - rescan_height, rescan_height);
+ walletInstance->WalletLogPrintf("Rescanning last %i blocks (from block %i)...", *tip_height - rescan_height, rescan_height);
{
WalletRescanReserver reserver(*walletInstance);
@@ -3565,7 +3565,7 @@ void CWallet::LoadActiveScriptPubKeyMan(uint256 id, OutputType type, bool intern
// Legacy wallets have only one ScriptPubKeyManager and it's active for all output and change types.
Assert(IsWalletFlagSet(WALLET_FLAG_DESCRIPTORS));
- WalletLogPrintf("Setting spkMan to active: id = %s, type = %s, internal = %s\n", id.ToString(), FormatOutputType(type), internal ? "true" : "false");
+ WalletLogPrintf("Setting spkMan to active: id = %s, type = %s, internal = %s", id.ToString(), FormatOutputType(type), internal ? "true" : "false");
auto& spk_mans = internal ? m_internal_spk_managers : m_external_spk_managers;
auto& spk_mans_other = internal ? m_external_spk_managers : m_internal_spk_managers;
auto spk_man = m_spk_managers.at(id).get();
@@ -3583,7 +3583,7 @@ void CWallet::DeactivateScriptPubKeyMan(uint256 id, OutputType type, bool intern
{
auto spk_man = GetScriptPubKeyMan(type, internal);
if (spk_man != nullptr && spk_man->GetID() == id) {
- WalletLogPrintf("Deactivate spkMan: id = %s, type = %s, internal = %s\n", id.ToString(), FormatOutputType(type), internal ? "true" : "false");
+ WalletLogPrintf("Deactivate spkMan: id = %s, type = %s, internal = %s", id.ToString(), FormatOutputType(type), internal ? "true" : "false");
WalletBatch batch(GetDatabase());
if (!batch.EraseActiveScriptPubKeyMan(static_cast<uint8_t>(type), internal)) {
throw std::runtime_error(std::string(__func__) + ": erasing active ScriptPubKeyMan id failed");
@@ -3637,7 +3637,7 @@ util::Result<std::reference_wrapper<DescriptorScriptPubKeyMan>> CWallet::AddWall
auto spk_man = GetDescriptorScriptPubKeyMan(desc);
if (spk_man) {
- WalletLogPrintf("Update existing descriptor: %s\n", desc.descriptor->ToString());
+ WalletLogPrintf("Update existing descriptor: %s", desc.descriptor->ToString());
if (auto spkm_res = spk_man->UpdateWalletDescriptor(desc, signing_provider); !spkm_res) {
return util::Error{util::ErrorString(spkm_res)};
}
@@ -3758,7 +3758,7 @@ bool CWallet::MigrateToSQLite(bilingual_str& error)
{
AssertLockHeld(cs_wallet);
- WalletLogPrintf("Migrating wallet storage database from BerkeleyDB to SQLite.\n");
+ WalletLogPrintf("Migrating wallet storage database from BerkeleyDB to SQLite.");
if (m_database->Format() == "sqlite") {
error = _("Error: This wallet already uses SQLite");
@@ -4110,7 +4110,7 @@ bool DoMigration(CWallet& wallet, WalletContext& context, bilingual_str& error,
options.create_flags |= WALLET_FLAG_KEY_ORIGIN_METADATA;
}
if (data->watch_descs.size() > 0) {
- wallet.WalletLogPrintf("Making a new watchonly wallet containing the watched scripts\n");
+ wallet.WalletLogPrintf("Making a new watchonly wallet containing the watched scripts");
DatabaseStatus status;
std::vector<bilingual_str> warnings;
@@ -4150,7 +4150,7 @@ bool DoMigration(CWallet& wallet, WalletContext& context, bilingual_str& error,
UpdateWalletSetting(*context.chain, wallet_name, load_on_startup, warnings);
}
if (data->solvable_descs.size() > 0) {
- wallet.WalletLogPrintf("Making a new watchonly wallet containing the unwatched solvable scripts\n");
+ wallet.WalletLogPrintf("Making a new watchonly wallet containing the unwatched solvable scripts");
DatabaseStatus status;
std::vector<bilingual_str> warnings;
@@ -4197,7 +4197,7 @@ bool DoMigration(CWallet& wallet, WalletContext& context, bilingual_str& error,
error = util::ErrorString(res_migration);
return false;
}
- wallet.WalletLogPrintf("Wallet migration complete.\n");
+ wallet.WalletLogPrintf("Wallet migration complete.");
return true;
});
}
### src/wallet/wallet.h
@@ -923,17 +923,17 @@ class CWallet final : public WalletStorage, public interfaces::Chain::Notificati
/** Prepends the wallet name in logging output to ease debugging in multi-wallet use cases */
template <typename... Params>
- void WalletLogPrintf(util::ConstevalFormatString<sizeof...(Params)> wallet_fmt, const Params&... params) const
+ void WalletLogPrintf(util::log::FormatString<sizeof...(Params)> wallet_fmt, const Params&... params) const
{
LogInfo("[%s] %s", LogName(), tfm::format(wallet_fmt, params...));
};
void LogStats() const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
{
AssertLockHeld(cs_wallet);
- WalletLogPrintf("setKeyPool.size() = %u\n", GetKeyPoolSize());
- WalletLogPrintf("mapWallet.size() = %u\n", mapWallet.size());
- WalletLogPrintf("m_address_book.size() = %u\n", m_address_book.size());
+ WalletLogPrintf("setKeyPool.size() = %u", GetKeyPoolSize());
+ WalletLogPrintf("mapWallet.size() = %u", mapWallet.size());
+ WalletLogPrintf("m_address_book.size() = %u", m_address_book.size());
};
//! Returns all unique ScriptPubKeyMans in m_internal_spk_managers and m_external_spk_managers
### src/wallet/walletdb.cpp
@@ -459,7 +459,7 @@ static DBErrors LoadWalletFlags(CWallet* pwallet, DatabaseBatch& batch) EXCLUSIV
uint64_t flags;
if (batch.Read(DBKeys::FLAGS, flags)) {
if (!pwallet->LoadWalletFlags(flags)) {
- pwallet->WalletLogPrintf("Error reading wallet database: Unknown non-tolerable wallet flags found\n");
+ pwallet->WalletLogPrintf("Error reading wallet database: Unknown non-tolerable wallet flags found");
return DBErrors::TOO_NEW;
}
// All wallets must be descriptor wallets unless opened with a bdb_ro db
@@ -487,7 +487,7 @@ static LoadResult LoadRecords(CWallet* pwallet, DatabaseBatch& batch, const std:
Assume(!prefix.empty());
std::unique_ptr<DatabaseCursor> cursor = batch.GetNewPrefixCursor(prefix);
if (!cursor) {
- pwallet->WalletLogPrintf("Error getting database cursor for '%s' records\n", key);
+ pwallet->WalletLogPrintf("Error getting database cursor for '%s' records", key);
result.m_result = DBErrors::CORRUPT;
return result;
}
@@ -497,7 +497,7 @@ static LoadResult LoadRecords(CWallet* pwallet, DatabaseBatch& batch, const std:
if (status == DatabaseCursor::Status::DONE) {
break;
} else if (status == DatabaseCursor::Status::FAIL) {
- pwallet->WalletLogPrintf("Error reading next '%s' record for wallet database\n", key);
+ pwallet->WalletLogPrintf("Error reading next '%s' record for wallet database", key);
result.m_result = DBErrors::CORRUPT;
return result;
}
@@ -507,7 +507,7 @@ static LoadResult LoadRecords(CWallet* pwallet, DatabaseBatch& batch, const std:
std::string error;
DBErrors record_res = load_func(pwallet, ssKey, ssValue, error);
if (record_res != DBErrors::LOAD_OK) {
- pwallet->WalletLogPrintf("%s\n", error);
+ pwallet->WalletLogPrintf("%s", error);
}
result.m_result = std::max(result.m_result, record_res);
++result.m_records;
@@ -558,7 +558,7 @@ static DBErrors LoadLegacyWalletRecords(CWallet* pwallet, DatabaseBatch& batch,
// Make sure descriptor wallets don't have any legacy records
if (pwallet->IsWalletFlagSet(WALLET_FLAG_DESCRIPTORS)) {
if (HasLegacyRecords(*pwallet, batch)) {
- pwallet->WalletLogPrintf("Error: Unexpected legacy entry found in descriptor wallet %s. The wallet might have been tampered with or created with malicious intent.\n", pwallet->GetName());
+ pwallet->WalletLogPrintf("Error: Unexpected legacy entry found in descriptor wallet %s. The wallet might have been tampered with or created with malicious intent.", pwallet->GetName());
return DBErrors::UNEXPECTED_LEGACY_ENTRY;
}
@@ -686,7 +686,7 @@ static DBErrors LoadLegacyWalletRecords(CWallet* pwallet, DatabaseBatch& batch,
}
}
} else {
- pwallet->WalletLogPrintf("Inactive HD chains found but no LegacyDataSPKM\n");
+ pwallet->WalletLogPrintf("Inactive HD chains found but no LegacyDataSPKM");
result = DBErrors::CORRUPT;
}
}
@@ -750,7 +750,7 @@ static DBErrors LoadLegacyWalletRecords(CWallet* pwallet, DatabaseBatch& batch,
if (result <= DBErrors::NONCRITICAL_ERROR) {
// Only do logging and time first key update if there were no critical errors
- pwallet->WalletLogPrintf("Legacy Wallet Keys: %u plaintext, %u encrypted, %u w/ metadata, %u total.\n",
+ pwallet->WalletLogPrintf("Legacy Wallet Keys: %u plaintext, %u encrypted, %u w/ metadata, %u total.",
key_res.m_records, ckey_res.m_records, keymeta_res.m_records, key_res.m_records + ckey_res.m_records);
}
@@ -932,7 +932,7 @@ static DBErrors LoadDescriptorWalletRecords(CWallet* pwallet, DatabaseBatch& bat
if (desc_res.m_result <= DBErrors::NONCRITICAL_ERROR) {
// Only log if there are no critical errors
- pwallet->WalletLogPrintf("Descriptors: %u, Descriptor Keys: %u plaintext, %u encrypted, %u total.\n",
+ pwallet->WalletLogPrintf("Descriptors: %u, Descriptor Keys: %u plaintext, %u encrypted, %u total.",
desc_res.m_records, num_keys, num_ckeys, num_keys + num_ckeys);
}
@@ -965,7 +965,7 @@ static DBErrors LoadAddressBookRecords(CWallet* pwallet, DatabaseBatch& batch) E
value >> purpose_str;
std::optional<AddressPurpose> purpose{PurposeFromString(purpose_str)};
if (!purpose) {
- pwallet->WalletLogPrintf("Warning: nonstandard purpose string '%s' for address '%s'\n", purpose_str, strAddress);
+ pwallet->WalletLogPrintf("Warning: nonstandard purpose string '%s' for address '%s'", purpose_str, strAddress);
}
pwallet->m_address_book[DecodeDestination(strAddress)].purpose = purpose;
return DBErrors::LOAD_OK;
@@ -1156,7 +1156,7 @@ DBErrors WalletBatch::LoadWallet(CWallet* pwallet)
// Last client version to open this wallet
int last_client = VERSION_LATEST;
bool has_last_client = m_batch->Read(DBKeys::VERSION, last_client);
- if (has_last_client) pwallet->WalletLogPrintf("Last client version = %d\n", last_client);
+ if (has_last_client) pwallet->WalletLogPrintf("Last client version = %d", last_client);
std::optional<uint64_t> last_client_features;
if (last_client >= VERSION_LAST_CLIENT_FEATURES) {
@@ -1178,7 +1178,7 @@ DBErrors WalletBatch::LoadWallet(CWallet* pwallet)
#ifndef ENABLE_EXTERNAL_SIGNER
if (pwallet->IsWalletFlagSet(WALLET_FLAG_EXTERNAL_SIGNER)) {
- pwallet->WalletLogPrintf("Error: External signer wallet being loaded without external signer support compiled\n");
+ pwallet->WalletLogPrintf("Error: External signer wallet being loaded without external signer support compiled");
return DBErrors::EXTERNAL_SIGNER_SUPPORT_REQUIRED;
}
#endif
@@ -1209,7 +1209,7 @@ DBErrors WalletBatch::LoadWallet(CWallet* pwallet)
// Any uncaught exceptions will be caught here and treated as critical.
// Catch std::runtime_error specifically as many functions throw these and they at least have some message that
// we can log
- pwallet->WalletLogPrintf("%s\n", e.what());
+ pwallet->WalletLogPrintf("%s", e.what());
result = DBErrors::CORRUPT;
} catch (...) {
// All other exceptions are still problematic, but we can't log them
@@ -1237,10 +1237,10 @@ DBErrors WalletBatch::LoadWallet(CWallet* pwallet)
// Although wallets without private keys should not have *ckey records, we should double check that.
// Removing the mkey records is only safe if there are no *ckey records.
if (pwallet->IsWalletFlagSet(WALLET_FLAG_DISABLE_PRIVATE_KEYS) && pwallet->HasEncryptionKeys() && !pwallet->HaveCryptedKeys()) {
- pwallet->WalletLogPrintf("Detected extraneous encryption keys in this wallet without private keys. Removing extraneous encryption keys.\n");
+ pwallet->WalletLogPrintf("Detected extraneous encryption keys in this wallet without private keys. Removing extraneous encryption keys.");
for (const auto& [id, _] : pwallet->mapMasterKeys) {
if (!EraseMasterKey(id)) {
- pwallet->WalletLogPrintf("Error: Unable to remove extraneous encryption key '%u'. Wallet corrupt.\n", id);
+ pwallet->WalletLogPrintf("Error: Unable to remove extraneous encryption key '%u'. Wallet corrupt.", id);
return DBErrors::CORRUPT;
}
}
@@ -1251,7 +1251,7 @@ DBErrors WalletBatch::LoadWallet(CWallet* pwallet)
// reload cannot restore the features recorded before a downgrade.
if (last_client < VERSION_LAST_CLIENT_FEATURES && m_batch->Exists(DBKeys::LAST_DECRYPTED_FEATURES)) {
if (!EraseIC(DBKeys::LAST_DECRYPTED_FEATURES)) {
- pwallet->WalletLogPrintf("Error: Unable to erase last decrypted client features.\n");
+ pwallet->WalletLogPrintf("Error: Unable to erase last decrypted client features.");
return DBErrors::LOAD_FAIL;
}
}
@@ -1261,14 +1261,14 @@ DBErrors WalletBatch::LoadWallet(CWallet* pwallet)
// in an upgrade-downgrade-upgrade scenario.
if (!has_last_client || last_client != VERSION_LATEST) {
if (!WriteLastOpenedVersion()) {
- pwallet->WalletLogPrintf("Error: Unable to write the last opened version. Wallet corrupt.\n");
+ pwallet->WalletLogPrintf("Error: Unable to write the last opened version. Wallet corrupt.");
return DBErrors::CORRUPT;
}
}
// Record the current client features as the features of the last client to successfully open this wallet file.
if (!last_client_features || *last_client_features != WALLET_CLIENT_FEATURES) {
if (!WriteLastOpenedFeatures()) {
- pwallet->WalletLogPrintf("Error: Unable to write the last opened features. Wallet corrupt.\n");
+ pwallet->WalletLogPrintf("Error: Unable to write the last opened features. Wallet corrupt.");
return DBErrors::CORRUPT;
}
}
### src/wallet/wallettool.cpp
@@ -20,7 +20,7 @@ namespace WalletTool {
// deleter here.
static void WalletToolReleaseWallet(CWallet* wallet)
{
- wallet->WalletLogPrintf("Releasing wallet\n");
+ wallet->WalletLogPrintf("Releasing wallet");
wallet->Close();
delete wallet;
}Why this scored 19/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.