This commit is contained in:
maflcko 2025-03-13 02:06:09 +01:00 committed by GitHub
commit 32428eb776
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
62 changed files with 367 additions and 373 deletions

View file

@ -753,8 +753,7 @@ logging messages. They should be used as follows:
messages or for infrequent and important events such as a new block tip
being found or a new outbound connection being made. These log messages
are unconditional, so care must be taken that they can't be used by an
attacker to fill up storage. Note that `LogPrintf(fmt, params...)` is
a deprecated alias for `LogInfo`.
attacker to fill up storage.
- `LogError(fmt, params...)` should be used in place of `LogInfo` for
severe problems that require the node (or a subsystem) to shut down

View file

@ -150,7 +150,7 @@ bool CBanDB::Write(const banmap_t& banSet)
bool CBanDB::Read(banmap_t& banSet)
{
if (fs::exists(m_banlist_dat)) {
LogPrintf("banlist.dat ignored because it can only be read by " CLIENT_NAME " version 22.x. Remove %s to silence this warning.\n", fs::quoted(fs::PathToString(m_banlist_dat)));
LogInfo("banlist.dat ignored because it can only be read by " CLIENT_NAME " version 22.x. Remove %s to silence this warning.\n", fs::quoted(fs::PathToString(m_banlist_dat)));
}
// If the JSON banlist does not exist, then recreate it
if (!fs::exists(m_banlist_json)) {
@ -162,7 +162,7 @@ bool CBanDB::Read(banmap_t& banSet)
if (!common::ReadSettings(m_banlist_json, settings, errors)) {
for (const auto& err : errors) {
LogPrintf("Cannot load banlist %s: %s\n", fs::PathToString(m_banlist_json), err);
LogInfo("Cannot load banlist %s: %s\n", fs::PathToString(m_banlist_json), err);
}
return false;
}
@ -170,7 +170,7 @@ bool CBanDB::Read(banmap_t& banSet)
try {
BanMapFromJson(settings[JSON_KEY], banSet);
} catch (const std::runtime_error& e) {
LogPrintf("Cannot parse banlist %s: %s\n", fs::PathToString(m_banlist_json), e.what());
LogInfo("Cannot parse banlist %s: %s\n", fs::PathToString(m_banlist_json), e.what());
return false;
}
@ -199,11 +199,11 @@ util::Result<std::unique_ptr<AddrMan>> LoadAddrman(const NetGroupManager& netgro
const auto path_addr{args.GetDataDirNet() / "peers.dat"};
try {
DeserializeFileDB(path_addr, *addrman);
LogPrintf("Loaded %i addresses from peers.dat %dms\n", addrman->Size(), Ticks<std::chrono::milliseconds>(SteadyClock::now() - start));
LogInfo("Loaded %i addresses from peers.dat %dms\n", addrman->Size(), Ticks<std::chrono::milliseconds>(SteadyClock::now() - start));
} catch (const DbNotFoundError&) {
// Addrman can be in an inconsistent state after failure, reset it
addrman = std::make_unique<AddrMan>(netgroupman, deterministic, /*consistency_check_ratio=*/check_addrman);
LogPrintf("Creating peers.dat because the file was not found (%s)\n", fs::quoted(fs::PathToString(path_addr)));
LogInfo("Creating peers.dat because the file was not found (%s)\n", fs::quoted(fs::PathToString(path_addr)));
DumpPeerAddresses(args, *addrman);
} catch (const InvalidAddrManVersionError&) {
if (!RenameOver(path_addr, (fs::path)path_addr + ".bak")) {
@ -211,7 +211,7 @@ util::Result<std::unique_ptr<AddrMan>> LoadAddrman(const NetGroupManager& netgro
}
// Addrman can be in an inconsistent state after failure, reset it
addrman = std::make_unique<AddrMan>(netgroupman, deterministic, /*consistency_check_ratio=*/check_addrman);
LogPrintf("Creating new peers.dat because the file version was not compatible (%s). Original backed up to peers.dat.bak\n", fs::quoted(fs::PathToString(path_addr)));
LogInfo("Creating new peers.dat because the file version was not compatible (%s). Original backed up to peers.dat.bak\n", fs::quoted(fs::PathToString(path_addr)));
DumpPeerAddresses(args, *addrman);
} catch (const std::exception& e) {
return util::Error{strprintf(_("Invalid or corrupt peers.dat (%s). If you believe this is a bug, please report it to %s. As a workaround, you can move the file (%s) out of the way (rename, move, or delete) to have a new one created on the next start."),
@ -231,7 +231,7 @@ std::vector<CAddress> ReadAnchors(const fs::path& anchors_db_path)
std::vector<CAddress> anchors;
try {
DeserializeFileDB(anchors_db_path, CAddress::V2_DISK(anchors));
LogPrintf("Loaded %i addresses from %s\n", anchors.size(), fs::quoted(fs::PathToString(anchors_db_path.filename())));
LogInfo("Loaded %i addresses from %s\n", anchors.size(), fs::quoted(fs::PathToString(anchors_db_path.filename())));
} catch (const std::exception&) {
anchors.clear();
}

View file

@ -1055,7 +1055,7 @@ void AddrManImpl::Check() const
const int err{CheckAddrman()};
if (err) {
LogPrintf("ADDRMAN CONSISTENCY CHECK FAILED!!! err=%i\n", err);
LogInfo("ADDRMAN CONSISTENCY CHECK FAILED!!! err=%i\n", err);
assert(false);
}
}

View file

@ -39,7 +39,7 @@ void BanMan::LoadBanlist()
LogDebug(BCLog::NET, "Loaded %d banned node addresses/subnets %dms\n", m_banned.size(),
Ticks<std::chrono::milliseconds>(SteadyClock::now() - start));
} else {
LogPrintf("Recreating the banlist database\n");
LogInfo("Recreating the banlist database\n");
m_banned = {};
m_is_dirty = true;
}

View file

@ -90,7 +90,7 @@ void ReadRegTestArgs(const ArgsManager& args, CChainParams::RegTestOptions& opti
if (vDeploymentParams[0] == VersionBitsDeploymentInfo[j].name) {
options.version_bits_parameters[Consensus::DeploymentPos(j)] = vbparams;
found = true;
LogPrintf("Setting version bits activation parameters for %s to start=%ld, timeout=%ld, min_activation_height=%d\n", vDeploymentParams[0], vbparams.start_time, vbparams.timeout, vbparams.min_activation_height);
LogInfo("Setting version bits activation parameters for %s to start=%ld, timeout=%ld, min_activation_height=%d\n", vDeploymentParams[0], vbparams.start_time, vbparams.timeout, vbparams.min_activation_height);
break;
}
}

View file

@ -115,7 +115,7 @@ std::optional<common::SettingsValue> InterpretValue(const KeyInfo& key, const st
}
// Double negatives like -nofoo=0 are supported (but discouraged)
if (value && !InterpretBool(*value)) {
LogPrintf("Warning: parsed potentially confusing double-negative -%s=%s\n", key.name, *value);
LogInfo("Warning: parsed potentially confusing double-negative -%s=%s\n", key.name, *value);
return true;
}
return false;
@ -394,7 +394,7 @@ static void SaveErrors(const std::vector<std::string> errors, std::vector<std::s
if (error_out) {
error_out->emplace_back(error);
} else {
LogPrintf("%s\n", error);
LogInfo("%s\n", error);
}
}
}
@ -416,7 +416,7 @@ bool ArgsManager::ReadSettingsFile(std::vector<std::string>* errors)
for (const auto& setting : m_settings.rw_settings) {
KeyInfo key = InterpretKey(setting.first); // Split setting key into section and argname
if (!GetArgFlags('-' + key.name)) {
LogPrintf("Ignoring unknown rw_settings value %s\n", setting.first);
LogInfo("Ignoring unknown rw_settings value %s\n", setting.first);
}
}
return true;
@ -847,7 +847,7 @@ void ArgsManager::logArgsPrefix(
std::optional<unsigned int> flags = GetArgFlags('-' + arg.first);
if (flags) {
std::string value_str = (*flags & SENSITIVE) ? "****" : value.write();
LogPrintf("%s %s%s=%s\n", prefix, section_str, arg.first, value_str);
LogInfo("%s %s%s=%s\n", prefix, section_str, arg.first, value_str);
}
}
}
@ -860,7 +860,7 @@ void ArgsManager::LogArgs() const
logArgsPrefix("Config file arg:", section.first, section.second);
}
for (const auto& setting : m_settings.rw_settings) {
LogPrintf("Setting file arg: %s = %s\n", setting.first, setting.second.write());
LogInfo("Setting file arg: %s = %s\n", setting.first, setting.second.write());
}
logArgsPrefix("Command-line arg:", "", m_settings.command_line_options);
}

View file

@ -84,7 +84,7 @@ bool IsConfSupported(KeyInfo& key, std::string& error) {
if (key.name == "reindex") {
// reindex can be set in a config file but it is strongly discouraged as this will cause the node to reindex on
// every restart. Allow the config but throw a warning
LogPrintf("Warning: reindex=1 is set in the configuration file, which will significantly slow down startup. Consider removing or commenting out this option for better performance, unless there is currently a condition which makes rebuilding the indexes necessary\n");
LogInfo("Warning: reindex=1 is set in the configuration file, which will significantly slow down startup. Consider removing or commenting out this option for better performance, unless there is currently a condition which makes rebuilding the indexes necessary\n");
return true;
}
return true;
@ -109,7 +109,7 @@ bool ArgsManager::ReadConfigStream(std::istream& stream, const std::string& file
m_settings.ro_config[key.section][key.name].push_back(*value);
} else {
if (ignore_invalid_keys) {
LogPrintf("Ignoring unknown configuration value %s\n", option.first);
LogInfo("Ignoring unknown configuration value %s\n", option.first);
} else {
error = strprintf("Invalid configuration value %s", option.first);
return false;
@ -192,7 +192,7 @@ bool ArgsManager::ReadConfigFiles(std::string& error, bool ignore_invalid_keys)
if (!ReadConfigStream(conf_file_stream, conf_file_name, error, ignore_invalid_keys)) {
return false;
}
LogPrintf("Included configuration file %s\n", conf_file_name);
LogInfo("Included configuration file %s\n", conf_file_name);
} else {
error = "Failed to include configuration file " + conf_file_name;
return false;

View file

@ -52,7 +52,7 @@ void runCommand(const std::string& strCommand)
int nErr = ::_wsystem(std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>,wchar_t>().from_bytes(strCommand).c_str());
#endif
if (nErr)
LogPrintf("runCommand error: system(%s) returned %d\n", strCommand, nErr);
LogInfo("runCommand error: system(%s) returned %d\n", strCommand, nErr);
}
#endif

View file

@ -46,8 +46,8 @@ static void HandleError(const leveldb::Status& status)
if (status.ok())
return;
const std::string errmsg = "Fatal LevelDB error: " + status.ToString();
LogPrintf("%s\n", errmsg);
LogPrintf("You can use -debug=leveldb to get more complete diagnostic messages\n");
LogInfo("%s\n", errmsg);
LogInfo("You can use -debug=leveldb to get more complete diagnostic messages\n");
throw dbwrapper_error(errmsg);
}
@ -234,12 +234,12 @@ CDBWrapper::CDBWrapper(const DBParams& params)
DBContext().options.env = DBContext().penv;
} else {
if (params.wipe_data) {
LogPrintf("Wiping LevelDB in %s\n", fs::PathToString(params.path));
LogInfo("Wiping LevelDB in %s\n", fs::PathToString(params.path));
leveldb::Status result = leveldb::DestroyDB(fs::PathToString(params.path), DBContext().options);
HandleError(result);
}
TryCreateDirectories(params.path);
LogPrintf("Opening LevelDB in %s\n", fs::PathToString(params.path));
LogInfo("Opening LevelDB in %s\n", fs::PathToString(params.path));
}
// PathToString() return value is safe to pass to leveldb open function,
// because on POSIX leveldb passes the byte string directly to ::open(), and
@ -247,12 +247,12 @@ CDBWrapper::CDBWrapper(const DBParams& params)
// (see env_posix.cc and env_windows.cc).
leveldb::Status status = leveldb::DB::Open(DBContext().options, fs::PathToString(params.path), &DBContext().pdb);
HandleError(status);
LogPrintf("Opened LevelDB successfully\n");
LogInfo("Opened LevelDB successfully\n");
if (params.options.force_compact) {
LogPrintf("Starting database compaction of %s\n", fs::PathToString(params.path));
LogInfo("Starting database compaction of %s\n", fs::PathToString(params.path));
DBContext().pdb->CompactRange(nullptr, nullptr);
LogPrintf("Finished database compaction of %s\n", fs::PathToString(params.path));
LogInfo("Finished database compaction of %s\n", fs::PathToString(params.path));
}
// The base-case obfuscation key, which is a noop.
@ -269,10 +269,10 @@ CDBWrapper::CDBWrapper(const DBParams& params)
Write(OBFUSCATE_KEY_KEY, new_key);
obfuscate_key = new_key;
LogPrintf("Wrote new obfuscate key for %s: %s\n", fs::PathToString(params.path), HexStr(obfuscate_key));
LogInfo("Wrote new obfuscate key for %s: %s\n", fs::PathToString(params.path), HexStr(obfuscate_key));
}
LogPrintf("Using obfuscation key for %s: %s\n", fs::PathToString(params.path), HexStr(obfuscate_key));
LogInfo("Using obfuscation key for %s: %s\n", fs::PathToString(params.path), HexStr(obfuscate_key));
}
CDBWrapper::~CDBWrapper()
@ -344,7 +344,7 @@ std::optional<std::string> CDBWrapper::ReadImpl(Span<const std::byte> key) const
if (!status.ok()) {
if (status.IsNotFound())
return std::nullopt;
LogPrintf("LevelDB read failure: %s\n", status.ToString());
LogInfo("LevelDB read failure: %s\n", status.ToString());
HandleError(status);
}
return strValue;
@ -359,7 +359,7 @@ bool CDBWrapper::ExistsImpl(Span<const std::byte> key) const
if (!status.ok()) {
if (status.IsNotFound())
return false;
LogPrintf("LevelDB read failure: %s\n", status.ToString());
LogInfo("LevelDB read failure: %s\n", status.ToString());
HandleError(status);
}
return true;

View file

@ -21,7 +21,7 @@ public:
bool HasWalletSupport() const override {return false;}
void AddWalletOptions(ArgsManager& argsman) const override;
bool ParameterInteraction() const override {return true;}
void Construct(node::NodeContext& node) const override {LogPrintf("No wallet support compiled in!\n");}
void Construct(node::NodeContext& node) const override {LogInfo("No wallet support compiled in!\n");}
};
void DummyWalletInit::AddWalletOptions(ArgsManager& argsman) const

View file

@ -41,11 +41,11 @@ FILE* FlatFileSeq::Open(const FlatFilePos& pos, bool read_only) const
if (!file && !read_only)
file = fsbridge::fopen(path, "wb+");
if (!file) {
LogPrintf("Unable to open file %s\n", fs::PathToString(path));
LogInfo("Unable to open file %s\n", fs::PathToString(path));
return nullptr;
}
if (pos.nPos && fseek(file, pos.nPos, SEEK_SET)) {
LogPrintf("Unable to seek to position %u of %s\n", pos.nPos, fs::PathToString(path));
LogInfo("Unable to seek to position %u of %s\n", pos.nPos, fs::PathToString(path));
fclose(file);
return nullptr;
}

View file

@ -172,7 +172,7 @@ static bool HTTPReq_JSONRPC(const std::any& context, HTTPRequest* req)
jreq.context = context;
jreq.peerAddr = req->GetPeer().ToStringAddrPort();
if (!RPCAuthorized(authHeader.second, jreq.authUser)) {
LogPrintf("ThreadRPCServer incorrect password attempt from %s\n", jreq.peerAddr);
LogInfo("ThreadRPCServer incorrect password attempt from %s\n", jreq.peerAddr);
/* Deter brute-forcing
If this results in a DoS the user really
@ -196,7 +196,7 @@ static bool HTTPReq_JSONRPC(const std::any& context, HTTPRequest* req)
UniValue reply;
bool user_has_whitelist = g_rpc_whitelist.count(jreq.authUser);
if (!user_has_whitelist && g_rpc_whitelist_default) {
LogPrintf("RPC User %s not allowed to call any methods\n", jreq.authUser);
LogInfo("RPC User %s not allowed to call any methods\n", jreq.authUser);
req->WriteReply(HTTP_FORBIDDEN);
return false;
@ -204,7 +204,7 @@ static bool HTTPReq_JSONRPC(const std::any& context, HTTPRequest* req)
} else if (valRequest.isObject()) {
jreq.parse(valRequest);
if (user_has_whitelist && !g_rpc_whitelist[jreq.authUser].count(jreq.strMethod)) {
LogPrintf("RPC User %s not allowed to call method %s\n", jreq.authUser, jreq.strMethod);
LogInfo("RPC User %s not allowed to call method %s\n", jreq.authUser, jreq.strMethod);
req->WriteReply(HTTP_FORBIDDEN);
return false;
}
@ -234,7 +234,7 @@ static bool HTTPReq_JSONRPC(const std::any& context, HTTPRequest* req)
// Parse method
std::string strMethod = request.find_value("method").get_str();
if (!g_rpc_whitelist[jreq.authUser].count(strMethod)) {
LogPrintf("RPC User %s not allowed to call method %s\n", jreq.authUser, strMethod);
LogInfo("RPC User %s not allowed to call method %s\n", jreq.authUser, strMethod);
req->WriteReply(HTTP_FORBIDDEN);
return false;
}
@ -314,7 +314,7 @@ static bool InitRPCAuthentication()
LogInfo("Using random cookie authentication.");
}
} else {
LogPrintf("Config options rpcuser and rpcpassword will soon be deprecated. Locally-run instances may remove rpcuser to use cookie-based auth, or may be replaced with rpcauth. Please see share/rpcauth for rpcauth auth generation.\n");
LogInfo("Config options rpcuser and rpcpassword will soon be deprecated. Locally-run instances may remove rpcuser to use cookie-based auth, or may be replaced with rpcauth. Please see share/rpcauth for rpcauth auth generation.\n");
strRPCUserColonPass = gArgs.GetArg("-rpcuser", "") + ":" + gArgs.GetArg("-rpcpassword", "");
}
@ -328,7 +328,7 @@ static bool InitRPCAuthentication()
fields.insert(fields.end(), salt_hmac.begin(), salt_hmac.end());
g_rpcauth.push_back(fields);
} else {
LogPrintf("Invalid -rpcauth argument.\n");
LogInfo("Invalid -rpcauth argument.\n");
return false;
}
}

View file

@ -330,7 +330,7 @@ static void http_request_cb(struct evhttp_request* req, void* arg)
if (g_work_queue->Enqueue(item.get())) {
item.release(); /* if true, queue took ownership */
} else {
LogPrintf("WARNING: request rejected because http work queue depth exceeded, it can be increased with the -rpcworkqueue= setting\n");
LogInfo("WARNING: request rejected because http work queue depth exceeded, it can be increased with the -rpcworkqueue= setting\n");
item->req->WriteReply(HTTP_SERVICE_UNAVAILABLE, "Work queue depth exceeded");
}
} else {
@ -370,10 +370,10 @@ static bool HTTPBindAddresses(struct evhttp* http)
endpoints.emplace_back("::1", http_port);
endpoints.emplace_back("127.0.0.1", http_port);
if (!gArgs.GetArgs("-rpcallowip").empty()) {
LogPrintf("WARNING: option -rpcallowip was specified without -rpcbind; this doesn't usually make sense\n");
LogInfo("WARNING: option -rpcallowip was specified without -rpcbind; this doesn't usually make sense\n");
}
if (!gArgs.GetArgs("-rpcbind").empty()) {
LogPrintf("WARNING: option -rpcbind was ignored because -rpcallowip was not specified, refusing to allow everyone to connect\n");
LogInfo("WARNING: option -rpcbind was ignored because -rpcallowip was not specified, refusing to allow everyone to connect\n");
}
} else { // Specific bind addresses
for (const std::string& strRPCBind : gArgs.GetArgs("-rpcbind")) {
@ -389,12 +389,12 @@ static bool HTTPBindAddresses(struct evhttp* http)
// Bind addresses
for (std::vector<std::pair<std::string, uint16_t> >::iterator i = endpoints.begin(); i != endpoints.end(); ++i) {
LogPrintf("Binding RPC on address %s port %i\n", i->first, i->second);
LogInfo("Binding RPC on address %s port %i\n", i->first, i->second);
evhttp_bound_socket *bind_handle = evhttp_bind_socket_with_handle(http, i->first.empty() ? nullptr : i->first.c_str(), i->second);
if (bind_handle) {
const std::optional<CNetAddr> addr{LookupHost(i->first, false)};
if (i->first.empty() || (addr.has_value() && addr->IsBindAny())) {
LogPrintf("WARNING: the RPC server is not safe to expose to untrusted networks such as the public internet\n");
LogInfo("WARNING: the RPC server is not safe to expose to untrusted networks such as the public internet\n");
}
// Set the no-delay option (disable Nagle's algorithm) on the TCP socket.
evutil_socket_t fd = evhttp_bound_socket_get_fd(bind_handle);
@ -404,7 +404,7 @@ static bool HTTPBindAddresses(struct evhttp* http)
}
boundSockets.push_back(bind_handle);
} else {
LogPrintf("Binding RPC on address %s port %i failed.\n", i->first, i->second);
LogInfo("Binding RPC on address %s port %i failed.\n", i->first, i->second);
}
}
return !boundSockets.empty();
@ -460,7 +460,7 @@ bool InitHTTPServer(const util::SignalInterrupt& interrupt)
raii_evhttp http_ctr = obtain_evhttp(base_ctr.get());
struct evhttp* http = http_ctr.get();
if (!http) {
LogPrintf("couldn't create evhttp. Exiting.\n");
LogInfo("couldn't create evhttp. Exiting.\n");
return false;
}
@ -470,7 +470,7 @@ bool InitHTTPServer(const util::SignalInterrupt& interrupt)
evhttp_set_gencb(http, http_request_cb, (void*)&interrupt);
if (!HTTPBindAddresses(http)) {
LogPrintf("Unable to bind any endpoint for RPC server\n");
LogInfo("Unable to bind any endpoint for RPC server\n");
return false;
}
@ -600,7 +600,7 @@ HTTPRequest::~HTTPRequest()
{
if (!replySent) {
// Keep track of whether reply was sent to avoid request leaks
LogPrintf("%s: Unhandled request\n", __func__);
LogInfo("%s: Unhandled request\n", __func__);
WriteReply(HTTP_INTERNAL_SERVER_ERROR, "Unhandled request");
}
// evhttpd cleans up the request, as long as a reply was sent.

View file

@ -149,7 +149,7 @@ void BaseIndex::Sync()
std::chrono::steady_clock::time_point last_locator_write_time{0s};
while (true) {
if (m_interrupt) {
LogPrintf("%s: m_interrupt set; exiting ThreadSync\n", GetName());
LogInfo("%s: m_interrupt set; exiting ThreadSync\n", GetName());
SetBestBlockIndex(pindex);
// No need to handle errors in Commit. If it fails, the error will be already be
@ -203,7 +203,7 @@ void BaseIndex::Sync()
auto current_time{std::chrono::steady_clock::now()};
if (last_log_time + SYNC_LOG_INTERVAL < current_time) {
LogPrintf("Syncing %s with block chain from height %d\n",
LogInfo("Syncing %s with block chain from height %d\n",
GetName(), pindex->nHeight);
last_log_time = current_time;
}
@ -218,9 +218,9 @@ void BaseIndex::Sync()
}
if (pindex) {
LogPrintf("%s is enabled at height %d\n", GetName(), pindex->nHeight);
LogInfo("%s is enabled at height %d\n", GetName(), pindex->nHeight);
} else {
LogPrintf("%s is enabled\n", GetName());
LogInfo("%s is enabled\n", GetName());
}
}
@ -299,7 +299,7 @@ void BaseIndex::BlockConnected(ChainstateRole role, const std::shared_ptr<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 "
LogInfo("%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());
@ -357,7 +357,7 @@ void BaseIndex::ChainStateFlushed(ChainstateRole role, const CBlockLocator& loca
// 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 "
LogInfo("%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());
@ -389,7 +389,7 @@ bool BaseIndex::BlockUntilSyncedToCurrentChain() const
}
}
LogPrintf("%s: %s is catching up on block notifications\n", __func__, GetName());
LogInfo("%s: %s is catching up on block notifications\n", __func__, GetName());
m_chain->context()->validation_signals->SyncWithValidationInterfaceQueue();
return true;
}

View file

@ -198,15 +198,15 @@ size_t BlockFilterIndex::WriteFilterToDisk(FlatFilePos& pos, const BlockFilter&
if (pos.nPos + data_size > MAX_FLTR_FILE_SIZE) {
AutoFile last_file{m_filter_fileseq->Open(pos)};
if (last_file.IsNull()) {
LogPrintf("%s: Failed to open filter file %d\n", __func__, pos.nFile);
LogInfo("%s: Failed to open filter file %d\n", __func__, pos.nFile);
return 0;
}
if (!last_file.Truncate(pos.nPos)) {
LogPrintf("%s: Failed to truncate filter file %d\n", __func__, pos.nFile);
LogInfo("%s: Failed to truncate filter file %d\n", __func__, pos.nFile);
return 0;
}
if (!last_file.Commit()) {
LogPrintf("%s: Failed to commit filter file %d\n", __func__, pos.nFile);
LogInfo("%s: Failed to commit filter file %d\n", __func__, pos.nFile);
return 0;
}
@ -218,13 +218,13 @@ size_t BlockFilterIndex::WriteFilterToDisk(FlatFilePos& pos, const BlockFilter&
bool out_of_space;
m_filter_fileseq->Allocate(pos, data_size, out_of_space);
if (out_of_space) {
LogPrintf("%s: out of disk space\n", __func__);
LogInfo("%s: out of disk space\n", __func__);
return 0;
}
AutoFile fileout{m_filter_fileseq->Open(pos)};
if (fileout.IsNull()) {
LogPrintf("%s: Failed to open filter file %d\n", __func__, pos.nFile);
LogInfo("%s: Failed to open filter file %d\n", __func__, pos.nFile);
return 0;
}

View file

@ -134,7 +134,7 @@ bool CoinStatsIndex::CustomAppend(const interfaces::BlockInfo& block)
uint256 expected_block_hash{*Assert(block.prev_hash)};
if (read_out.first != expected_block_hash) {
LogPrintf("WARNING: previous block header belongs to unexpected block %s; expected %s\n",
LogInfo("WARNING: previous block header belongs to unexpected block %s; expected %s\n",
read_out.first.ToString(), expected_block_hash.ToString());
if (!m_db->Read(DBHashKey(expected_block_hash), read_out)) {
@ -425,7 +425,7 @@ bool CoinStatsIndex::ReverseBlock(const CBlock& block, const CBlockIndex* pindex
uint256 expected_block_hash{pindex->pprev->GetBlockHash()};
if (read_out.first != expected_block_hash) {
LogPrintf("WARNING: previous block header belongs to unexpected block %s; expected %s\n",
LogInfo("WARNING: previous block header belongs to unexpected block %s; expected %s\n",
read_out.first.ToString(), expected_block_hash.ToString());
if (!m_db->Read(DBHashKey(expected_block_hash), read_out)) {

View file

@ -198,7 +198,7 @@ static void RemovePidFile(const ArgsManager& args)
const auto pid_path{GetPidFile(args)};
if (std::error_code error; !fs::remove(pid_path, error)) {
std::string msg{error ? error.message() : "File does not exist"};
LogPrintf("Unable to remove PID file (%s): %s\n", fs::PathToString(pid_path), msg);
LogInfo("Unable to remove PID file (%s): %s\n", fs::PathToString(pid_path), msg);
}
}
@ -284,7 +284,7 @@ void Shutdown(NodeContext& node)
static Mutex g_shutdown_mutex;
TRY_LOCK(g_shutdown_mutex, lock_shutdown);
if (!lock_shutdown) return;
LogPrintf("%s: In progress...\n", __func__);
LogInfo("%s: In progress...\n", __func__);
Assert(node.args);
/// Note: Shutdown() must be able to handle cases in which initialization failed part of the way,
@ -398,7 +398,7 @@ void Shutdown(NodeContext& node)
RemovePidFile(*node.args);
LogPrintf("%s: done\n", __func__);
LogInfo("%s: done\n", __func__);
}
/**
@ -905,7 +905,7 @@ bool AppInitParameterInteraction(const ArgsManager& args)
// on the command line or in this chain's section of the config file.
ChainType chain = args.GetChainType();
if (chain == ChainType::SIGNET) {
LogPrintf("Signet derived magic (message start): %s\n", HexStr(chainparams.MessageStart()));
LogInfo("Signet derived magic (message start): %s\n", HexStr(chainparams.MessageStart()));
}
bilingual_str errors;
for (const auto& arg : args.GetUnsuitableSectionOnlyArgs()) {
@ -1239,7 +1239,7 @@ static ChainstateLoadResult InitAndLoadChainstate(
if (!mempool_error.empty()) {
return {ChainstateLoadStatus::FAILURE_FATAL, mempool_error};
}
LogPrintf("* Using %.1f MiB for in-memory UTXO set (plus up to %.1f MiB of unused mempool space)\n", cache_sizes.coins * (1.0 / 1024 / 1024), mempool_opts.max_size_bytes * (1.0 / 1024 / 1024));
LogInfo("* Using %.1f MiB for in-memory UTXO set (plus up to %.1f MiB of unused mempool space)\n", cache_sizes.coins * (1.0 / 1024 / 1024), mempool_opts.max_size_bytes * (1.0 / 1024 / 1024));
ChainstateManager::Options chainman_opts{
.chainparams = chainparams,
.datadir = args.GetDataDirNet(),
@ -1279,10 +1279,10 @@ static ChainstateLoadResult InitAndLoadChainstate(
// libbitcoinkernel.
chainman.snapshot_download_completed = [&node]() {
if (!node.chainman->m_blockman.IsPruneMode()) {
LogPrintf("[snapshot] re-enabling NODE_NETWORK services\n");
LogInfo("[snapshot] re-enabling NODE_NETWORK services\n");
node.connman->AddLocalServices(NODE_NETWORK);
}
LogPrintf("[snapshot] restarting indexes\n");
LogInfo("[snapshot] restarting indexes\n");
// Drain the validation interface queue to ensure that the old indexes
// don't have any pending work.
Assert(node.validation_signals)->SyncWithValidationInterfaceQueue();
@ -1290,7 +1290,7 @@ static ChainstateLoadResult InitAndLoadChainstate(
index->Interrupt();
index->Stop();
if (!(index->Init() && index->StartBackgroundSync())) {
LogPrintf("[snapshot] WARNING failed to restart index %s on snapshot chain\n", index->GetName());
LogInfo("[snapshot] WARNING failed to restart index %s on snapshot chain\n", index->GetName());
}
}
};
@ -1350,11 +1350,11 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
return false;
}
LogPrintf("Using at most %i automatic connections (%i file descriptors available)\n", nMaxConnections, available_fds);
LogInfo("Using at most %i automatic connections (%i file descriptors available)\n", nMaxConnections, available_fds);
// 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 "
LogInfo("Warning: relative datadir option '%s' specified, which will be interpreted relative to the "
"current working directory '%s'. This is fragile, because if bitcoin 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 bitcoin is started while in a temporary directory.\n",
@ -1402,7 +1402,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
} catch (const std::exception& e) {
return InitError(Untranslated(strprintf("Unable to bind to IPC address '%s'. %s", address, e.what())));
}
LogPrintf("Listening for IPC requests on address %s\n", address);
LogInfo("Listening for IPC requests on address %s\n", address);
}
}
@ -1469,9 +1469,9 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
return false;
}
const uint256 asmap_version = (HashWriter{} << asmap).GetHash();
LogPrintf("Using asmap version %s for IP bucketing\n", asmap_version.ToString());
LogInfo("Using asmap version %s for IP bucketing\n", asmap_version.ToString());
} else {
LogPrintf("Using /16 prefix for IP bucketing\n");
LogInfo("Using /16 prefix for IP bucketing\n");
}
// Initialize netgroup manager
@ -1718,7 +1718,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
// As LoadBlockIndex can take several minutes, it's possible the user
// requested to kill the GUI during the last operation. If so, exit.
if (ShutdownRequested(node)) {
LogPrintf("Shutdown requested. Exiting.\n");
LogInfo("Shutdown requested. Exiting.\n");
return false;
}
@ -1773,10 +1773,10 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
} else {
// Prior to setting NODE_NETWORK, check if we can provide historical blocks.
if (!WITH_LOCK(chainman.GetMutex(), return chainman.BackgroundSyncInProgress())) {
LogPrintf("Setting NODE_NETWORK on non-prune mode\n");
LogInfo("Setting NODE_NETWORK on non-prune mode\n");
g_local_services = ServiceFlags(g_local_services | NODE_NETWORK);
} else {
LogPrintf("Running node in NODE_NETWORK_LIMITED mode until snapshot background sync completes\n");
LogInfo("Running node in NODE_NETWORK_LIMITED mode until snapshot background sync completes\n");
}
}
@ -1835,7 +1835,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
// Import blocks and ActivateBestChain()
ImportBlocks(chainman, vImportFiles);
if (args.GetBoolArg("-stopafterblockimport", DEFAULT_STOPAFTERBLOCKIMPORT)) {
LogPrintf("Stopping after block import\n");
LogInfo("Stopping after block import\n");
if (!(Assert(node.shutdown_request))()) {
LogError("Failed to send shutdown signal after finishing block import\n");
}
@ -1883,7 +1883,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
{
LOCK(chainman.GetMutex());
const auto& tip{*Assert(chainman.ActiveTip())};
LogPrintf("block tree size = %u\n", chainman.BlockIndex().size());
LogInfo("block tree size = %u\n", chainman.BlockIndex().size());
chain_active_height = tip.nHeight;
best_block_time = tip.GetBlockTime();
if (tip_info) {
@ -1896,7 +1896,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
tip_info->header_time = chainman.m_best_header->GetBlockTime();
}
}
LogPrintf("nBestHeight = %d\n", chain_active_height);
LogInfo("nBestHeight = %d\n", chain_active_height);
if (node.peerman) node.peerman->SetBestBlock(chain_active_height, std::chrono::seconds{best_block_time});
// Map ports with NAT-PMP
@ -2026,11 +2026,11 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
connOptions.m_specified_outgoing = connect;
}
if (!connOptions.m_specified_outgoing.empty() && !connOptions.vSeedNodes.empty()) {
LogPrintf("-seednode is ignored when -connect is used\n");
LogInfo("-seednode is ignored when -connect is used\n");
}
if (args.IsArgSet("-dnsseed") && args.GetBoolArg("-dnsseed", DEFAULT_DNSSEED) && args.IsArgSet("-proxy")) {
LogPrintf("-dnsseed is ignored when -connect is used and -proxy is specified\n");
LogInfo("-dnsseed is ignored when -connect is used and -proxy is specified\n");
}
}

View file

@ -115,9 +115,9 @@ bool StartLogging(const ArgsManager& args)
}
if (!LogInstance().m_log_timestamps)
LogPrintf("Startup time: %s\n", FormatISO8601DateTime(GetTime()));
LogPrintf("Default data directory %s\n", fs::PathToString(GetDefaultDataDir()));
LogPrintf("Using data directory %s\n", fs::PathToString(gArgs.GetDataDirNet()));
LogInfo("Startup time: %s\n", FormatISO8601DateTime(GetTime()));
LogInfo("Default data directory %s\n", fs::PathToString(GetDefaultDataDir()));
LogInfo("Using data directory %s\n", fs::PathToString(gArgs.GetDataDirNet()));
// Only log conf file usage message if conf file actually exists.
fs::path config_file_path = args.GetConfigFilePath();
@ -126,12 +126,12 @@ bool StartLogging(const ArgsManager& args)
} else if (fs::is_directory(config_file_path)) {
LogWarning("Config file: %s (is directory, not file)", fs::PathToString(config_file_path));
} else if (fs::exists(config_file_path)) {
LogPrintf("Config file: %s\n", fs::PathToString(config_file_path));
LogInfo("Config file: %s\n", fs::PathToString(config_file_path));
} else if (args.IsArgSet("-conf")) {
InitWarning(strprintf(_("The specified config file %s does not exist"), fs::PathToString(config_file_path)));
} else {
// Not categorizing as "Warning" because it's the default behavior
LogPrintf("Config file: %s (not found, skipping)\n", fs::PathToString(config_file_path));
LogInfo("Config file: %s (not found, skipping)\n", fs::PathToString(config_file_path));
}
// Log the config arguments to debug.log
@ -148,6 +148,6 @@ void LogPackageVersion()
#else
version_string += " (release build)";
#endif
LogPrintf(CLIENT_NAME " version %s\n", version_string);
LogInfo(CLIENT_NAME " version %s\n", version_string);
}
} // namespace init

View file

@ -114,7 +114,7 @@ int ProcessImpl::connect(const fs::path& data_dir,
}
int connect_error = errno;
if (::close(fd) != 0) {
LogPrintf("Error closing file descriptor %i '%s': %s\n", fd, address, SysErrorString(errno));
LogInfo("Error closing file descriptor %i '%s': %s\n", fd, address, SysErrorString(errno));
}
throw std::system_error(connect_error, std::system_category());
}
@ -145,7 +145,7 @@ int ProcessImpl::bind(const fs::path& data_dir, const std::string& exe_name, std
}
int bind_error = errno;
if (::close(fd) != 0) {
LogPrintf("Error closing file descriptor %i: %s\n", fd, SysErrorString(errno));
LogInfo("Error closing file descriptor %i: %s\n", fd, SysErrorString(errno));
}
throw std::system_error(bind_error, std::system_category());
}

View file

@ -447,7 +447,7 @@ public:
0,
0,
};
LogPrintf("Signet with challenge %s\n", HexStr(bin));
LogInfo("Signet with challenge %s\n", HexStr(bin));
}
if (options.seeds) {

View file

@ -28,7 +28,7 @@ BCLog::Logger& LogInstance()
* cleaned up by the OS/libc. Defining a logger as a global object doesn't work
* since the order of destruction of static/global objects is undefined.
* Consider if the logger gets destroyed, and then some later destructor calls
* LogPrintf, maybe indirectly, and you get a core dump at shutdown trying to
* LogInfo, maybe indirectly, and you get a core dump at shutdown trying to
* access the logger. When the shutdown sequence is fully audited and tested,
* explicit destruction of these objects can be implemented by changing this
* from a raw pointer to a std::unique_ptr.
@ -474,7 +474,7 @@ void BCLog::Logger::ShrinkDebugFile()
// Restart the file with some of the end
std::vector<char> vch(RECENT_DEBUG_HISTORY_SIZE, 0);
if (fseek(file, -((long)vch.size()), SEEK_END)) {
LogPrintf("Failed to shrink debug log file: fseek(...) failed\n");
LogInfo("Failed to shrink debug log file: fseek(...) failed\n");
fclose(file);
return;
}

View file

@ -262,9 +262,6 @@ inline void LogPrintFormatInternal(std::string_view logging_function, std::strin
#define LogWarning(...) LogPrintLevel_(BCLog::LogFlags::ALL, BCLog::Level::Warning, __VA_ARGS__)
#define LogError(...) LogPrintLevel_(BCLog::LogFlags::ALL, BCLog::Level::Error, __VA_ARGS__)
// Deprecated unconditional logging.
#define LogPrintf(...) LogInfo(__VA_ARGS__)
// Use a macro instead of a function for conditional logging to prevent
// evaluating arguments when logging for the category is not enabled.

View file

@ -53,7 +53,7 @@ public:
const std::string full_msg = this->LogMsg(msg);
if (m_log_category == BCLog::LogFlags::ALL) {
LogPrintf("%s\n", full_msg);
LogInfo("%s\n", full_msg);
} else {
LogDebug(m_log_category, "%s\n", full_msg);
}

View file

@ -287,7 +287,7 @@ bool AddLocal(const CService& addr_, int nScore)
if (!g_reachable_nets.Contains(addr))
return false;
LogPrintf("AddLocal(%s,%i)\n", addr.ToStringAddrPort(), nScore);
LogInfo("AddLocal(%s,%i)\n", addr.ToStringAddrPort(), nScore);
{
LOCK(g_maplocalhost_mutex);
@ -310,7 +310,7 @@ bool AddLocal(const CNetAddr &addr, int nScore)
void RemoveLocal(const CService& addr)
{
LOCK(g_maplocalhost_mutex);
LogPrintf("RemoveLocal(%s)\n", addr.ToStringAddrPort());
LogInfo("RemoveLocal(%s)\n", addr.ToStringAddrPort());
mapLocalHost.erase(addr);
}
@ -407,7 +407,7 @@ CNode* CConnman::ConnectNode(CAddress addrConnect, const char *pszDest, bool fCo
CNode* pnode = FindNode(static_cast<CService>(addrConnect));
if (pnode)
{
LogPrintf("Failed to open new connection, already connected\n");
LogInfo("Failed to open new connection, already connected\n");
return nullptr;
}
}
@ -440,7 +440,7 @@ CNode* CConnman::ConnectNode(CAddress addrConnect, const char *pszDest, bool fCo
LOCK(m_nodes_mutex);
CNode* pnode = FindNode(static_cast<CService>(addrConnect));
if (pnode) {
LogPrintf("Not opening a connection to %s, already connected to %s\n", pszDest, addrConnect.ToStringAddrPort());
LogInfo("Not opening a connection to %s, already connected to %s\n", pszDest, addrConnect.ToStringAddrPort());
return nullptr;
}
// Add the address to the resolved addresses vector so we can try to connect to it later on
@ -1740,7 +1740,7 @@ void CConnman::AcceptConnection(const ListenSocket& hListenSocket) {
if (!sock) {
const int nErr = WSAGetLastError();
if (nErr != WSAEWOULDBLOCK) {
LogPrintf("socket error accept failed: %s\n", NetworkErrorString(nErr));
LogInfo("socket error accept failed: %s\n", NetworkErrorString(nErr));
}
return;
}
@ -1782,7 +1782,7 @@ void CConnman::CreateNodeFromAcceptedSocket(std::unique_ptr<Sock>&& sock,
}
if (!sock->IsSelectable()) {
LogPrintf("connection from %s dropped: non-selectable socket\n", addr.ToStringAddrPort());
LogInfo("connection from %s dropped: non-selectable socket\n", addr.ToStringAddrPort());
return;
}
@ -2249,7 +2249,7 @@ void CConnman::ThreadDNSAddressSeed()
if (!gArgs.GetArgs("-seednode").empty()) {
auto start = NodeClock::now();
constexpr std::chrono::seconds SEEDNODE_TIMEOUT = 30s;
LogPrintf("-seednode enabled. Trying the provided seeds for %d seconds before defaulting to the dnsseeds.\n", SEEDNODE_TIMEOUT.count());
LogInfo("-seednode enabled. Trying the provided seeds for %d seconds before defaulting to the dnsseeds.\n", SEEDNODE_TIMEOUT.count());
while (!interruptNet) {
if (!interruptNet.sleep_for(std::chrono::milliseconds(500)))
return;
@ -2257,13 +2257,13 @@ void CConnman::ThreadDNSAddressSeed()
// Abort if we have spent enough time without reaching our target.
// Giving seed nodes 30 seconds so this does not become a race against fixedseeds (which triggers after 1 min)
if (NodeClock::now() > start + SEEDNODE_TIMEOUT) {
LogPrintf("Couldn't connect to enough peers via seed nodes. Handing fetch logic to the DNS seeds.\n");
LogInfo("Couldn't connect to enough peers via seed nodes. Handing fetch logic to the DNS seeds.\n");
break;
}
outbound_connection_count = GetFullOutboundConnCount();
if (outbound_connection_count >= SEED_OUTBOUND_CONNECTION_THRESHOLD) {
LogPrintf("P2P peers available. Finished fetching data from seed nodes.\n");
LogInfo("P2P peers available. Finished fetching data from seed nodes.\n");
break;
}
}
@ -2306,7 +2306,7 @@ void CConnman::ThreadDNSAddressSeed()
seeds_right_now += DNSSEEDS_TO_QUERY_AT_ONCE;
if (addrman.Size() > 0) {
LogPrintf("Waiting %d seconds before querying DNS seeds.\n", seeds_wait_time.count());
LogInfo("Waiting %d seconds before querying DNS seeds.\n", seeds_wait_time.count());
std::chrono::seconds to_wait = seeds_wait_time;
while (to_wait.count() > 0) {
// if sleeping for the MANY_PEERS interval, wake up
@ -2318,10 +2318,10 @@ void CConnman::ThreadDNSAddressSeed()
if (GetFullOutboundConnCount() >= SEED_OUTBOUND_CONNECTION_THRESHOLD) {
if (found > 0) {
LogPrintf("%d addresses found from DNS seeds\n", found);
LogPrintf("P2P peers available. Finished DNS seeding.\n");
LogInfo("%d addresses found from DNS seeds\n", found);
LogInfo("P2P peers available. Finished DNS seeding.\n");
} else {
LogPrintf("P2P peers available. Skipped DNS seeding.\n");
LogInfo("P2P peers available. Skipped DNS seeding.\n");
}
return;
}
@ -2333,13 +2333,13 @@ void CConnman::ThreadDNSAddressSeed()
// hold off on querying seeds if P2P network deactivated
if (!fNetworkActive) {
LogPrintf("Waiting for network to be reactivated before querying DNS seeds.\n");
LogInfo("Waiting for network to be reactivated before querying DNS seeds.\n");
do {
if (!interruptNet.sleep_for(std::chrono::seconds{1})) return;
} while (!fNetworkActive);
}
LogPrintf("Loading addresses from DNS seed %s\n", seed);
LogInfo("Loading addresses from DNS seed %s\n", seed);
// If -proxy is in use, we make an ADDR_FETCH connection to the DNS resolved peer address
// for the base dns seed domain in chainparams
if (HaveNameProxy()) {
@ -2375,9 +2375,9 @@ void CConnman::ThreadDNSAddressSeed()
}
--seeds_right_now;
}
LogPrintf("%d addresses found from DNS seeds\n", found);
LogInfo("%d addresses found from DNS seeds\n", found);
} else {
LogPrintf("Skipping DNS seeds. Enough peers have been found\n");
LogInfo("Skipping DNS seeds. Enough peers have been found\n");
}
}
@ -2556,7 +2556,7 @@ void CConnman::ThreadOpenConnections(const std::vector<std::string> connect, Spa
constexpr std::chrono::seconds ADD_NEXT_SEEDNODE = 10s;
if (!add_fixed_seeds) {
LogPrintf("Fixed seeds are disabled\n");
LogInfo("Fixed seeds are disabled\n");
}
while (!interruptNet)
@ -2594,7 +2594,7 @@ void CConnman::ThreadOpenConnections(const std::vector<std::string> connect, Spa
// It is cheapest to check if enough time has passed first.
if (GetTime<std::chrono::seconds>() > start + std::chrono::minutes{1}) {
add_fixed_seeds_now = true;
LogPrintf("Adding fixed seeds as 60 seconds have passed and addrman is empty for at least one reachable network\n");
LogInfo("Adding fixed seeds as 60 seconds have passed and addrman is empty for at least one reachable network\n");
}
// Perform cheap checks before locking a mutex.
@ -2602,7 +2602,7 @@ void CConnman::ThreadOpenConnections(const std::vector<std::string> connect, Spa
LOCK(m_added_nodes_mutex);
if (m_added_node_params.empty()) {
add_fixed_seeds_now = true;
LogPrintf("Adding fixed seeds as -dnsseed=0 (or IPv4/IPv6 connections are disabled via -onlynet) and neither -addnode nor -seednode are provided\n");
LogInfo("Adding fixed seeds as -dnsseed=0 (or IPv4/IPv6 connections are disabled via -onlynet) and neither -addnode nor -seednode are provided\n");
}
}
@ -2621,7 +2621,7 @@ void CConnman::ThreadOpenConnections(const std::vector<std::string> connect, Spa
local.SetInternal("fixedseeds");
addrman.Add(seed_addrs, local);
add_fixed_seeds = false;
LogPrintf("Added %d fixed seeds from reachable networks.\n", seed_addrs.size());
LogInfo("Added %d fixed seeds from reachable networks.\n", seed_addrs.size());
}
}
@ -3136,7 +3136,7 @@ bool CConnman::BindListenPort(const CService& addrBind, bilingual_str& strError,
// the program was closed and restarted.
if (sock->SetSockOpt(SOL_SOCKET, SO_REUSEADDR, (sockopt_arg_type)&nOne, sizeof(int)) == SOCKET_ERROR) {
strError = Untranslated(strprintf("Error setting SO_REUSEADDR on socket: %s, continuing anyway", NetworkErrorString(WSAGetLastError())));
LogPrintf("%s\n", strError.original);
LogInfo("%s\n", strError.original);
}
// some systems don't have IPV6_V6ONLY but are always v6only; others do have the option
@ -3145,14 +3145,14 @@ bool CConnman::BindListenPort(const CService& addrBind, bilingual_str& strError,
#ifdef IPV6_V6ONLY
if (sock->SetSockOpt(IPPROTO_IPV6, IPV6_V6ONLY, (sockopt_arg_type)&nOne, sizeof(int)) == SOCKET_ERROR) {
strError = Untranslated(strprintf("Error setting IPV6_V6ONLY on socket: %s, continuing anyway", NetworkErrorString(WSAGetLastError())));
LogPrintf("%s\n", strError.original);
LogInfo("%s\n", strError.original);
}
#endif
#ifdef WIN32
int nProtLevel = PROTECTION_LEVEL_UNRESTRICTED;
if (sock->SetSockOpt(IPPROTO_IPV6, IPV6_PROTECTION_LEVEL, (const char*)&nProtLevel, sizeof(int)) == SOCKET_ERROR) {
strError = Untranslated(strprintf("Error setting IPV6_PROTECTION_LEVEL on socket: %s, continuing anyway", NetworkErrorString(WSAGetLastError())));
LogPrintf("%s\n", strError.original);
LogInfo("%s\n", strError.original);
}
#endif
}
@ -3166,7 +3166,7 @@ bool CConnman::BindListenPort(const CService& addrBind, bilingual_str& strError,
LogPrintLevel(BCLog::NET, BCLog::Level::Error, "%s\n", strError.original);
return false;
}
LogPrintf("Bound to %s\n", addrBind.ToStringAddrPort());
LogInfo("Bound to %s\n", addrBind.ToStringAddrPort());
// Listen for incoming connections
if (sock->Listen(SOMAXCONN) == SOCKET_ERROR)
@ -3187,13 +3187,13 @@ void Discover()
for (const CNetAddr &addr: GetLocalAddresses()) {
if (AddLocal(addr, LOCAL_IF))
LogPrintf("%s: %s\n", __func__, addr.ToStringAddr());
LogInfo("%s: %s\n", __func__, addr.ToStringAddr());
}
}
void CConnman::SetNetworkActive(bool active)
{
LogPrintf("%s: %s\n", __func__, active);
LogInfo("%s: %s\n", __func__, active);
if (fNetworkActive == active) {
return;
@ -3322,7 +3322,7 @@ bool CConnman::Start(CScheduler& scheduler, const Options& connOptions)
if (m_anchors.size() > MAX_BLOCK_RELAY_ONLY_ANCHORS) {
m_anchors.resize(MAX_BLOCK_RELAY_ONLY_ANCHORS);
}
LogPrintf("%i block-relay-only anchors will be tried for connections.\n", m_anchors.size());
LogInfo("%i block-relay-only anchors will be tried for connections.\n", m_anchors.size());
}
if (m_client_interface) {
@ -3356,7 +3356,7 @@ bool CConnman::Start(CScheduler& scheduler, const Options& connOptions)
threadSocketHandler = std::thread(&util::TraceThread, "net", [this] { ThreadSocketHandler(); });
if (!gArgs.GetBoolArg("-dnsseed", DEFAULT_DNSSEED))
LogPrintf("DNS seeding disabled\n");
LogInfo("DNS seeding disabled\n");
else
threadDNSAddressSeed = std::thread(&util::TraceThread, "dnsseed", [this] { ThreadDNSAddressSeed(); });

View file

@ -3448,7 +3448,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
// Disconnect if we connected to ourself
if (pfrom.IsInboundConn() && !m_connman.CheckIncomingNonce(nNonce))
{
LogPrintf("connected to self at %s, disconnecting\n", pfrom.addr.ToStringAddrPort());
LogInfo("connected to self at %s, disconnecting\n", pfrom.addr.ToStringAddrPort());
pfrom.fDisconnect = true;
return;
}
@ -3617,7 +3617,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
// can be triggered by an attacker at high rate.
if (!pfrom.IsInboundConn() || LogAcceptCategory(BCLog::NET, BCLog::Level::Debug)) {
const auto mapped_as{m_connman.GetMappedAS(pfrom.addr)};
LogPrintf("New %s %s peer connected: version: %d, blocks=%d, peer=%d%s%s\n",
LogInfo("New %s %s peer connected: version: %d, blocks=%d, peer=%d%s%s\n",
pfrom.ConnectionTypeAsString(),
TransportTypeAsString(pfrom.m_transport->GetInfo().transport_type),
pfrom.nVersion.load(), peer->m_starting_height,
@ -4239,10 +4239,10 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
// permission, even if they were already in the mempool, allowing
// the node to function as a gateway for nodes hidden behind it.
if (!m_mempool.exists(GenTxid::Txid(tx.GetHash()))) {
LogPrintf("Not relaying non-mempool transaction %s (wtxid=%s) from forcerelay peer=%d\n",
LogInfo("Not relaying non-mempool transaction %s (wtxid=%s) from forcerelay peer=%d\n",
tx.GetHash().ToString(), tx.GetWitnessHash().ToString(), pfrom.GetId());
} else {
LogPrintf("Force relaying tx %s (wtxid=%s) from peer=%d\n",
LogInfo("Force relaying tx %s (wtxid=%s) from peer=%d\n",
tx.GetHash().ToString(), tx.GetWitnessHash().ToString(), pfrom.GetId());
RelayTransaction(tx.GetHash(), tx.GetWitnessHash());
}
@ -4902,13 +4902,13 @@ bool PeerManagerImpl::MaybeDiscourageAndDisconnect(CNode& pnode, Peer& peer)
if (pnode.HasPermission(NetPermissionFlags::NoBan)) {
// We never disconnect or discourage peers for bad behavior if they have NetPermissionFlags::NoBan permission
LogPrintf("Warning: not punishing noban peer %d!\n", peer.m_id);
LogInfo("Warning: not punishing noban peer %d!\n", peer.m_id);
return false;
}
if (pnode.IsManualConn()) {
// We never disconnect or discourage manual peers for bad behavior
LogPrintf("Warning: not punishing manually connected peer %d!\n", peer.m_id);
LogInfo("Warning: not punishing manually connected peer %d!\n", peer.m_id);
return false;
}
@ -5189,7 +5189,7 @@ void PeerManagerImpl::CheckForStaleTipAndEvictPeers()
// Check whether our tip is stale, and if so, allow using an extra
// outbound peer
if (!m_chainman.m_blockman.LoadingBlocks() && m_connman.GetNetworkActive() && m_connman.GetUseAddrmanOutgoing() && TipMayBeStale()) {
LogPrintf("Potential stale tip detected, will try using extra outbound peer (last tip update: %d seconds ago)\n",
LogInfo("Potential stale tip detected, will try using extra outbound peer (last tip update: %d seconds ago)\n",
count_seconds(now - m_last_tip_update.load()));
m_connman.SetTryNewOutboundPeer(true);
} else if (m_connman.GetTryNewOutboundPeer()) {

View file

@ -60,13 +60,13 @@ void BanMapFromJson(const UniValue& bans_json, banmap_t& bans)
for (const auto& ban_entry_json : bans_json.getValues()) {
const int version{ban_entry_json[BANMAN_JSON_VERSION_KEY].getInt<int>()};
if (version != CBanEntry::CURRENT_VERSION) {
LogPrintf("Dropping entry with unknown version (%s) from ban list\n", version);
LogInfo("Dropping entry with unknown version (%s) from ban list\n", version);
continue;
}
const auto& subnet_str = ban_entry_json[BANMAN_JSON_ADDR_KEY].get_str();
const CSubNet subnet{LookupSubNet(subnet_str)};
if (!subnet.IsValid()) {
LogPrintf("Dropping entry with unparseable address or subnet (%s) from ban list\n", subnet_str);
LogInfo("Dropping entry with unparseable address or subnet (%s) from ban list\n", subnet_str);
continue;
}
bans.insert_or_assign(subnet, CBanEntry{ban_entry_json});

View file

@ -103,7 +103,7 @@ enum Network ParseNetwork(const std::string& net_in) {
if (net == "ipv6") return NET_IPV6;
if (net == "onion") return NET_ONION;
if (net == "tor") {
LogPrintf("Warning: net name 'tor' is deprecated and will be removed in the future. You should use 'onion' instead.\n");
LogInfo("Warning: net name 'tor' is deprecated and will be removed in the future. You should use 'onion' instead.\n");
return NET_ONION;
}
if (net == "i2p") {
@ -392,7 +392,7 @@ bool Socks5(const std::string& strDest, uint16_t port, const ProxyCredentials* a
sock.SendComplete(vSocks5Init, g_socks5_recv_timeout, g_socks5_interrupt);
uint8_t pchRet1[2];
if (InterruptibleRecv(pchRet1, 2, g_socks5_recv_timeout, sock) != IntrRecvError::OK) {
LogPrintf("Socks5() connect to %s:%d failed: InterruptibleRecv() timeout or other failure\n", strDest, port);
LogInfo("Socks5() connect to %s:%d failed: InterruptibleRecv() timeout or other failure\n", strDest, port);
return false;
}
if (pchRet1[0] != SOCKSVersion::SOCKS5) {
@ -519,7 +519,7 @@ std::unique_ptr<Sock> CreateSockOS(int domain, int type, int protocol)
// Ensure that waiting for I/O on this socket won't result in undefined
// behavior.
if (!sock->IsSelectable()) {
LogPrintf("Cannot create connection: non-selectable socket created (fd >= FD_SETSIZE ?)\n");
LogInfo("Cannot create connection: non-selectable socket created (fd >= FD_SETSIZE ?)\n");
return nullptr;
}
@ -528,14 +528,14 @@ std::unique_ptr<Sock> CreateSockOS(int domain, int type, int protocol)
// Set the no-sigpipe option on the socket for BSD systems, other UNIXes
// should use the MSG_NOSIGNAL flag for every send.
if (sock->SetSockOpt(SOL_SOCKET, SO_NOSIGPIPE, (void*)&set, sizeof(int)) == SOCKET_ERROR) {
LogPrintf("Error setting SO_NOSIGPIPE on socket: %s, continuing anyway\n",
LogInfo("Error setting SO_NOSIGPIPE on socket: %s, continuing anyway\n",
NetworkErrorString(WSAGetLastError()));
}
#endif
// Set the non-blocking option on the socket.
if (!sock->SetNonBlocking()) {
LogPrintf("Error setting socket to non-blocking: %s\n", NetworkErrorString(WSAGetLastError()));
LogInfo("Error setting socket to non-blocking: %s\n", NetworkErrorString(WSAGetLastError()));
return nullptr;
}
@ -561,7 +561,7 @@ static void LogConnectFailure(bool manual_connection, util::ConstevalFormatStrin
{
std::string error_message = tfm::format(fmt, args...);
if (manual_connection) {
LogPrintf("%s\n", error_message);
LogInfo("%s\n", error_message);
} else {
LogDebug(BCLog::NET, "%s\n", error_message);
}
@ -581,7 +581,7 @@ static bool ConnectToSocket(const Sock& sock, struct sockaddr* sockaddr, socklen
const Sock::Event requested = Sock::RECV | Sock::SEND;
Sock::Event occurred;
if (!sock.Wait(std::chrono::milliseconds{nConnectTimeout}, requested, &occurred)) {
LogPrintf("wait for connect to %s failed: %s\n",
LogInfo("wait for connect to %s failed: %s\n",
dest_str,
NetworkErrorString(WSAGetLastError()));
return false;
@ -598,7 +598,7 @@ static bool ConnectToSocket(const Sock& sock, struct sockaddr* sockaddr, socklen
socklen_t sockerr_len = sizeof(sockerr);
if (sock.GetSockOpt(SOL_SOCKET, SO_ERROR, (sockopt_arg_type)&sockerr, &sockerr_len) ==
SOCKET_ERROR) {
LogPrintf("getsockopt() for %s failed: %s\n", dest_str, NetworkErrorString(WSAGetLastError()));
LogInfo("getsockopt() for %s failed: %s\n", dest_str, NetworkErrorString(WSAGetLastError()));
return false;
}
if (sockerr != 0) {
@ -634,7 +634,7 @@ std::unique_ptr<Sock> ConnectDirectly(const CService& dest, bool manual_connecti
struct sockaddr_storage sockaddr;
socklen_t len = sizeof(sockaddr);
if (!dest.GetSockAddr((struct sockaddr*)&sockaddr, &len)) {
LogPrintf("Cannot get sockaddr for %s: unsupported network\n", dest.ToStringAddrPort());
LogInfo("Cannot get sockaddr for %s: unsupported network\n", dest.ToStringAddrPort());
return {};
}

View file

@ -124,7 +124,7 @@ void NetGroupManager::ASMapHealthCheck(const std::vector<CNetAddr>& clearnet_add
clearnet_asns.insert(asn);
}
LogPrintf("ASMap Health Check: %i clearnet peers are mapped to %i ASNs with %i peers being unmapped\n", clearnet_addrs.size(), clearnet_asns.size(), unmapped_count);
LogInfo("ASMap Health Check: %i clearnet peers are mapped to %i ASNs with %i peers being unmapped\n", clearnet_addrs.size(), clearnet_asns.size(), unmapped_count);
}
bool NetGroupManager::UsingASMap() const {

View file

@ -296,7 +296,7 @@ void BlockManager::FindFilesToPruneManual(
setFilesToPrune.insert(fileNumber);
count++;
}
LogPrintf("[%s] Prune (Manual): prune_height=%d removed %d blk/rev pairs\n",
LogInfo("[%s] Prune (Manual): prune_height=%d removed %d blk/rev pairs\n",
chain.GetRole(), last_block_can_prune, count);
}
@ -416,7 +416,7 @@ bool BlockManager::LoadBlockIndex(const std::optional<uint256>& snapshot_blockha
// to disk, we must bootstrap the value for assumedvalid chainstates
// from the hardcoded assumeutxo chainparams.
base->m_chain_tx_count = au_data.m_chain_tx_count;
LogPrintf("[snapshot] set m_chain_tx_count=%d for %s\n", au_data.m_chain_tx_count, snapshot_blockhash->ToString());
LogInfo("[snapshot] set m_chain_tx_count=%d for %s\n", au_data.m_chain_tx_count, snapshot_blockhash->ToString());
} else {
// If this isn't called with a snapshot blockhash, make sure the cached snapshot height
// is null. This is relevant during snapshot completion, when the blockman may be loaded
@ -506,11 +506,11 @@ bool BlockManager::LoadBlockIndexDB(const std::optional<uint256>& snapshot_block
// Load block file info
m_block_tree_db->ReadLastBlockFile(max_blockfile_num);
m_blockfile_info.resize(max_blockfile_num + 1);
LogPrintf("%s: last block file = %i\n", __func__, max_blockfile_num);
LogInfo("%s: last block file = %i\n", __func__, max_blockfile_num);
for (int nFile = 0; nFile <= max_blockfile_num; nFile++) {
m_block_tree_db->ReadBlockFileInfo(nFile, m_blockfile_info[nFile]);
}
LogPrintf("%s: last block file info: %s\n", __func__, m_blockfile_info[max_blockfile_num].ToString());
LogInfo("%s: last block file info: %s\n", __func__, m_blockfile_info[max_blockfile_num].ToString());
for (int nFile = max_blockfile_num + 1; true; nFile++) {
CBlockFileInfo info;
if (m_block_tree_db->ReadBlockFileInfo(nFile, info)) {
@ -521,7 +521,7 @@ bool BlockManager::LoadBlockIndexDB(const std::optional<uint256>& snapshot_block
}
// Check presence of blk files
LogPrintf("Checking all blk files are present...\n");
LogInfo("Checking all blk files are present...\n");
std::set<int> setBlkDataFiles;
for (const auto& [_, block_index] : m_block_index) {
if (block_index.nStatus & BLOCK_HAVE_DATA) {
@ -547,7 +547,7 @@ bool BlockManager::LoadBlockIndexDB(const std::optional<uint256>& snapshot_block
// Check whether we have ever pruned block & undo files
m_block_tree_db->ReadFlag("prunedblockfiles", m_have_pruned);
if (m_have_pruned) {
LogPrintf("LoadBlockIndexDB(): Block files have previously been pruned\n");
LogInfo("LoadBlockIndexDB(): Block files have previously been pruned\n");
}
// Check whether we need to continue reindexing
@ -634,7 +634,7 @@ void BlockManager::CleanupBlockRevFiles() const
// Glob all blk?????.dat and rev?????.dat files from the blocks directory.
// Remove the rev files immediately and insert the blk file paths into an
// ordered map keyed by block file index.
LogPrintf("Removing unusable blk?????.dat and rev?????.dat files for -reindex with -prune\n");
LogInfo("Removing unusable blk?????.dat and rev?????.dat files for -reindex with -prune\n");
for (fs::directory_iterator it(m_opts.blocks_dir); it != fs::directory_iterator(); it++) {
const std::string path = fs::PathToString(it->path().filename());
if (fs::is_regular_file(*it) &&
@ -1220,17 +1220,17 @@ void ImportBlocks(ChainstateManager& chainman, std::span<const fs::path> import_
if (file.IsNull()) {
break; // This error is logged in OpenBlockFile
}
LogPrintf("Reindexing block file blk%05u.dat...\n", (unsigned int)nFile);
LogInfo("Reindexing block file blk%05u.dat...\n", (unsigned int)nFile);
chainman.LoadExternalBlockFile(file, &pos, &blocks_with_unknown_parent);
if (chainman.m_interrupt) {
LogPrintf("Interrupt requested. Exit %s\n", __func__);
LogInfo("Interrupt requested. Exit %s\n", __func__);
return;
}
nFile++;
}
WITH_LOCK(::cs_main, chainman.m_blockman.m_block_tree_db->WriteReindexing(false));
chainman.m_blockman.m_blockfiles_indexed = true;
LogPrintf("Reindexing finished\n");
LogInfo("Reindexing finished\n");
// To avoid ending up in a situation without genesis block, re-try initializing (no-op if reindexing worked):
chainman.ActiveChainstate().LoadGenesisBlock();
}
@ -1239,14 +1239,14 @@ void ImportBlocks(ChainstateManager& chainman, std::span<const fs::path> import_
for (const fs::path& path : import_paths) {
AutoFile file{fsbridge::fopen(path, "rb")};
if (!file.IsNull()) {
LogPrintf("Importing blocks file %s...\n", fs::PathToString(path));
LogInfo("Importing blocks file %s...\n", fs::PathToString(path));
chainman.LoadExternalBlockFile(file);
if (chainman.m_interrupt) {
LogPrintf("Interrupt requested. Exit %s\n", __func__);
LogInfo("Interrupt requested. Exit %s\n", __func__);
return;
}
} else {
LogPrintf("Warning: Could not open blocks file %s\n", fs::PathToString(path));
LogInfo("Warning: Could not open blocks file %s\n", fs::PathToString(path));
}
}

View file

@ -84,7 +84,7 @@ static ChainstateLoadResult CompleteChainstateInitialization(
// block tree into BlockIndex()!
for (Chainstate* chainstate : chainman.GetAll()) {
LogPrintf("Initializing chainstate %s\n", chainstate->ToString());
LogInfo("Initializing chainstate %s\n", chainstate->ToString());
try {
chainstate->InitCoinsDB(
@ -145,18 +145,18 @@ ChainstateLoadResult LoadChainstate(ChainstateManager& chainman, const CacheSize
const ChainstateLoadOptions& options)
{
if (!chainman.AssumedValidBlock().IsNull()) {
LogPrintf("Assuming ancestors of block %s have valid signatures.\n", chainman.AssumedValidBlock().GetHex());
LogInfo("Assuming ancestors of block %s have valid signatures.\n", chainman.AssumedValidBlock().GetHex());
} else {
LogPrintf("Validating signatures for all blocks.\n");
LogInfo("Validating signatures for all blocks.\n");
}
LogPrintf("Setting nMinimumChainWork=%s\n", chainman.MinimumChainWork().GetHex());
LogInfo("Setting nMinimumChainWork=%s\n", chainman.MinimumChainWork().GetHex());
if (chainman.MinimumChainWork() < UintToArith256(chainman.GetConsensus().nMinimumChainWork)) {
LogPrintf("Warning: nMinimumChainWork set below default value of %s\n", chainman.GetConsensus().nMinimumChainWork.GetHex());
LogInfo("Warning: nMinimumChainWork set below default value of %s\n", chainman.GetConsensus().nMinimumChainWork.GetHex());
}
if (chainman.m_blockman.GetPruneTarget() == BlockManager::PRUNE_TARGET_MANUAL) {
LogPrintf("Block pruning enabled. Use RPC call pruneblockchain(height) to manually prune block and undo files.\n");
LogInfo("Block pruning enabled. Use RPC call pruneblockchain(height) to manually prune block and undo files.\n");
} else if (chainman.m_blockman.GetPruneTarget()) {
LogPrintf("Prune configured to target %u MiB on disk for block and undo files.\n", chainman.m_blockman.GetPruneTarget() / 1024 / 1024);
LogInfo("Prune configured to target %u MiB on disk for block and undo files.\n", chainman.m_blockman.GetPruneTarget() / 1024 / 1024);
}
LOCK(cs_main);
@ -171,7 +171,7 @@ ChainstateLoadResult LoadChainstate(ChainstateManager& chainman, const CacheSize
bool has_snapshot = chainman.DetectSnapshotChainstate();
if (has_snapshot && options.wipe_chainstate_db) {
LogPrintf("[snapshot] deleting snapshot chainstate due to reindexing\n");
LogInfo("[snapshot] deleting snapshot chainstate due to reindexing\n");
if (!chainman.DeleteSnapshotChainstate()) {
return {ChainstateLoadStatus::FAILURE_FATAL, Untranslated("Couldn't remove snapshot chainstate.")};
}
@ -195,7 +195,7 @@ ChainstateLoadResult LoadChainstate(ChainstateManager& chainman, const CacheSize
if (snapshot_completion == SnapshotCompletionResult::SKIPPED) {
// do nothing; expected case
} else if (snapshot_completion == SnapshotCompletionResult::SUCCESS) {
LogPrintf("[snapshot] cleaning up unneeded background chainstate, then reinitializing\n");
LogInfo("[snapshot] cleaning up unneeded background chainstate, then reinitializing\n");
if (!chainman.ValidatedSnapshotCleanup()) {
return {ChainstateLoadStatus::FAILURE_FATAL, Untranslated("Background chainstate cleanup failed unexpectedly.")};
}

View file

@ -66,7 +66,7 @@ util::Result<void> ApplyArgsManOptions(const ArgsManager& argsman, const CChainP
} else if (mempool_opts.incremental_relay_feerate > mempool_opts.min_relay_feerate) {
// Allow only setting incremental fee to control both
mempool_opts.min_relay_feerate = mempool_opts.incremental_relay_feerate;
LogPrintf("Increasing minrelaytxfee to %s to match incrementalrelayfee\n", mempool_opts.min_relay_feerate.ToString());
LogInfo("Increasing minrelaytxfee to %s to match incrementalrelayfee\n", mempool_opts.min_relay_feerate.ToString());
}
// Feerate used to define dust. Shouldn't be changed lightly as old

View file

@ -167,7 +167,7 @@ std::unique_ptr<CBlockTemplate> BlockAssembler::CreateNewBlock()
pblocktemplate->vchCoinbaseCommitment = m_chainstate.m_chainman.GenerateCoinbaseCommitment(*pblock, pindexPrev);
pblocktemplate->vTxFees[0] = -nFees;
LogPrintf("CreateNewBlock(): block weight: %u txs: %u fees: %ld sigops %d\n", GetBlockWeight(*pblock), nBlockTx, nFees, nBlockSigOpsCost);
LogInfo("CreateNewBlock(): block weight: %u txs: %u fees: %ld sigops %d\n", GetBlockWeight(*pblock), nBlockTx, nFees, nBlockSigOpsCost);
// Fill in header
pblock->hashPrevBlock = pindexPrev->GetBlockHash();
@ -239,7 +239,7 @@ void BlockAssembler::AddToBlock(CTxMemPool::txiter iter)
inBlock.insert(iter->GetSharedTx()->GetHash());
if (m_options.print_modified_fee) {
LogPrintf("fee rate %s txid %s\n",
LogInfo("fee rate %s txid %s\n",
CFeeRate(iter->GetModifiedFee(), iter->GetTxSize()).ToString(),
iter->GetTx().GetHash().ToString());
}

View file

@ -53,7 +53,7 @@ uint32_t FindBestImplementation()
}
}
assert(best.has_value());
LogPrintf("Using Minisketch implementation number %i\n", best->second);
LogInfo("Using Minisketch implementation number %i\n", best->second);
return best->second;
}

View file

@ -32,14 +32,14 @@ bool WriteSnapshotBaseBlockhash(Chainstate& snapshot_chainstate)
FILE* file{fsbridge::fopen(write_to, "wb")};
AutoFile afile{file};
if (afile.IsNull()) {
LogPrintf("[snapshot] failed to open base blockhash file for writing: %s\n",
LogInfo("[snapshot] failed to open base blockhash file for writing: %s\n",
fs::PathToString(write_to));
return false;
}
afile << *snapshot_chainstate.m_from_snapshot_blockhash;
if (afile.fclose() != 0) {
LogPrintf("[snapshot] failed to close base blockhash file %s after writing\n",
LogInfo("[snapshot] failed to close base blockhash file %s after writing\n",
fs::PathToString(write_to));
return false;
}
@ -49,7 +49,7 @@ bool WriteSnapshotBaseBlockhash(Chainstate& snapshot_chainstate)
std::optional<uint256> ReadSnapshotBaseBlockhash(fs::path chaindir)
{
if (!fs::exists(chaindir)) {
LogPrintf("[snapshot] cannot read base blockhash: no chainstate dir "
LogInfo("[snapshot] cannot read base blockhash: no chainstate dir "
"exists at path %s\n", fs::PathToString(chaindir));
return std::nullopt;
}
@ -57,7 +57,7 @@ std::optional<uint256> 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 "
LogInfo("[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;
@ -67,7 +67,7 @@ std::optional<uint256> ReadSnapshotBaseBlockhash(fs::path chaindir)
FILE* file{fsbridge::fopen(read_from, "rb")};
AutoFile afile{file};
if (afile.IsNull()) {
LogPrintf("[snapshot] failed to open base blockhash file for reading: %s\n",
LogInfo("[snapshot] failed to open base blockhash file for reading: %s\n",
read_from_str);
return std::nullopt;
}
@ -76,7 +76,7 @@ std::optional<uint256> ReadSnapshotBaseBlockhash(fs::path chaindir)
int64_t position = afile.tell();
afile.seek(0, SEEK_END);
if (position != afile.tell()) {
LogPrintf("[snapshot] warning: unexpected trailing data in %s\n", read_from_str);
LogInfo("[snapshot] warning: unexpected trailing data in %s\n", read_from_str);
}
return base_blockhash;
}

View file

@ -54,7 +54,7 @@ bool noui_ThreadSafeQuestion(const bilingual_str& /* ignored interactive message
void noui_InitMessage(const std::string& message)
{
LogPrintf("init message: %s\n", message);
LogInfo("init message: %s\n", message);
}
void noui_connect()
@ -66,19 +66,19 @@ void noui_connect()
bool noui_ThreadSafeMessageBoxRedirect(const bilingual_str& message, const std::string& caption, unsigned int style)
{
LogPrintf("%s: %s\n", caption, message.original);
LogInfo("%s: %s\n", caption, message.original);
return false;
}
bool noui_ThreadSafeQuestionRedirect(const bilingual_str& /* ignored interactive message */, const std::string& message, const std::string& caption, unsigned int style)
{
LogPrintf("%s: %s\n", caption, message);
LogInfo("%s: %s\n", caption, message);
return false;
}
void noui_InitMessageRedirect(const std::string& message)
{
LogPrintf("init message: %s\n", message);
LogInfo("init message: %s\n", message);
}
void noui_test_redirect()

View file

@ -19,7 +19,7 @@ void noui_InitMessage(const std::string& message);
/** Connect all bitcoind signal handlers */
void noui_connect();
/** Redirect all bitcoind signal handlers to LogPrintf. Used to check or suppress output during test runs that produce expected errors */
/** Redirect all bitcoind signal handlers to LogInfo. Used to check or suppress output during test runs that produce expected errors */
void noui_test_redirect();
/** Reconnects the regular Non-GUI handlers after having used noui_test_redirect */

View file

@ -560,18 +560,18 @@ CBlockPolicyEstimator::CBlockPolicyEstimator(const fs::path& estimation_filepath
AutoFile est_file{fsbridge::fopen(m_estimation_filepath, "rb")};
if (est_file.IsNull()) {
LogPrintf("%s is not found. Continue anyway.\n", fs::PathToString(m_estimation_filepath));
LogInfo("%s is not found. Continue anyway.\n", fs::PathToString(m_estimation_filepath));
return;
}
std::chrono::hours file_age = GetFeeEstimatorFileAge();
if (file_age > MAX_FILE_AGE && !read_stale_estimates) {
LogPrintf("Fee estimation file %s too old (age=%lld > %lld hours) and will not be used to avoid serving stale estimates.\n", fs::PathToString(m_estimation_filepath), Ticks<std::chrono::hours>(file_age), Ticks<std::chrono::hours>(MAX_FILE_AGE));
LogInfo("Fee estimation file %s too old (age=%lld > %lld hours) and will not be used to avoid serving stale estimates.\n", fs::PathToString(m_estimation_filepath), Ticks<std::chrono::hours>(file_age), Ticks<std::chrono::hours>(MAX_FILE_AGE));
return;
}
if (!Read(est_file)) {
LogPrintf("Failed to read fee estimates from %s. Continue anyway.\n", fs::PathToString(m_estimation_filepath));
LogInfo("Failed to read fee estimates from %s. Continue anyway.\n", fs::PathToString(m_estimation_filepath));
}
}
@ -954,9 +954,9 @@ void CBlockPolicyEstimator::FlushFeeEstimates()
{
AutoFile est_file{fsbridge::fopen(m_estimation_filepath, "wb")};
if (est_file.IsNull() || !Write(est_file)) {
LogPrintf("Failed to write fee estimates to %s. Continue anyway.\n", fs::PathToString(m_estimation_filepath));
LogInfo("Failed to write fee estimates to %s. Continue anyway.\n", fs::PathToString(m_estimation_filepath));
} else {
LogPrintf("Flushed fee estimates to %s.\n", fs::PathToString(m_estimation_filepath.filename()));
LogInfo("Flushed fee estimates to %s.\n", fs::PathToString(m_estimation_filepath.filename()));
}
}

View file

@ -199,7 +199,7 @@ void DebugMessageHandler(QtMsgType type, const QMessageLogContext& context, cons
if (type == QtDebugMsg) {
LogDebug(BCLog::QT, "GUI: %s\n", msg.toStdString());
} else {
LogPrintf("GUI: %s\n", msg.toStdString());
LogInfo("GUI: %s\n", msg.toStdString());
}
}

View file

@ -111,10 +111,10 @@ void ReportHardwareRand()
// This must be done in a separate function, as InitHardwareRand() may be indirectly called
// from global constructors, before logging is initialized.
if (g_rdseed_supported) {
LogPrintf("Using RdSeed as an additional entropy source\n");
LogInfo("Using RdSeed as an additional entropy source\n");
}
if (g_rdrand_supported) {
LogPrintf("Using RdRand as an additional entropy source\n");
LogInfo("Using RdRand as an additional entropy source\n");
}
}
@ -205,7 +205,7 @@ void ReportHardwareRand()
// This must be done in a separate function, as InitHardwareRand() may be indirectly called
// from global constructors, before logging is initialized.
if (g_rndr_supported) {
LogPrintf("Using RNDR and RNDRRS as additional entropy sources\n");
LogInfo("Using RNDR and RNDRRS as additional entropy sources\n");
}
}

View file

@ -170,7 +170,7 @@ void DeleteAuthCookie()
fs::remove(GetAuthCookieFile());
}
} catch (const fs::filesystem_error& e) {
LogPrintf("%s: Unable to remove random auth cookie file: %s\n", __func__, fsbridge::get_filesystem_error_message(e));
LogInfo("%s: Unable to remove random auth cookie file: %s\n", __func__, fsbridge::get_filesystem_error_message(e));
}
}

View file

@ -32,7 +32,7 @@ SignatureCache::SignatureCache(const size_t max_size_bytes)
m_salted_hasher_schnorr.Write(PADDING_SCHNORR, 32);
const auto [num_elems, approx_size_bytes] = setValid.setup_bytes(max_size_bytes);
LogPrintf("Using %zu MiB out of %zu MiB requested for signature cache, able to store %zu elements\n",
LogInfo("Using %zu MiB out of %zu MiB requested for signature cache, able to store %zu elements\n",
approx_size_bytes >> 20, max_size_bytes >> 20, num_elems);
}

View file

@ -90,8 +90,8 @@ LockData& GetLockData() {
static void potential_deadlock_detected(const LockPair& mismatch, const LockStack& s1, const LockStack& s2)
{
LogPrintf("POTENTIAL DEADLOCK DETECTED\n");
LogPrintf("Previous lock order was:\n");
LogInfo("POTENTIAL DEADLOCK DETECTED\n");
LogInfo("Previous lock order was:\n");
for (const LockStackItem& i : s1) {
std::string prefix{};
if (i.first == mismatch.first) {
@ -100,11 +100,11 @@ static void potential_deadlock_detected(const LockPair& mismatch, const LockStac
if (i.first == mismatch.second) {
prefix = " (2)";
}
LogPrintf("%s %s\n", prefix, i.second.ToString());
LogInfo("%s %s\n", prefix, i.second.ToString());
}
std::string mutex_a, mutex_b;
LogPrintf("Current lock order is:\n");
LogInfo("Current lock order is:\n");
for (const LockStackItem& i : s2) {
std::string prefix{};
if (i.first == mismatch.first) {
@ -115,7 +115,7 @@ static void potential_deadlock_detected(const LockPair& mismatch, const LockStac
prefix = " (2)";
mutex_b = i.second.Name();
}
LogPrintf("%s %s\n", prefix, i.second.ToString());
LogInfo("%s %s\n", prefix, i.second.ToString());
}
if (g_debug_lockorder_abort) {
tfm::format(std::cerr, "Assertion failed: detected inconsistent lock order for %s, details in debug log.\n", s2.back().second.ToString());
@ -126,14 +126,14 @@ static void potential_deadlock_detected(const LockPair& mismatch, const LockStac
static void double_lock_detected(const void* mutex, const LockStack& lock_stack)
{
LogPrintf("DOUBLE LOCK DETECTED\n");
LogPrintf("Lock order:\n");
LogInfo("DOUBLE LOCK DETECTED\n");
LogInfo("Lock order:\n");
for (const LockStackItem& i : lock_stack) {
std::string prefix{};
if (i.first == mutex) {
prefix = " (*)";
}
LogPrintf("%s %s\n", prefix, i.second.ToString());
LogInfo("%s %s\n", prefix, i.second.ToString());
}
if (g_debug_lockorder_abort) {
tfm::format(std::cerr,
@ -225,10 +225,10 @@ void CheckLastCritical(void* cs, std::string& lockname, const char* guardname, c
}
}
LogPrintf("INCONSISTENT LOCK ORDER DETECTED\n");
LogPrintf("Current lock order (least recent first) is:\n");
LogInfo("INCONSISTENT LOCK ORDER DETECTED\n");
LogInfo("Current lock order (least recent first) is:\n");
for (const LockStackItem& i : lock_stack) {
LogPrintf(" %s\n", i.second.ToString());
LogInfo(" %s\n", i.second.ToString());
}
if (g_debug_lockorder_abort) {
tfm::format(std::cerr, "%s:%s %s was not most recent critical section locked, details in debug log.\n", file, line, guardname);

View file

@ -57,7 +57,7 @@ void IpcPipeTest()
std::promise<std::unique_ptr<mp::ProxyClient<gen::FooInterface>>> foo_promise;
std::function<void()> disconnect_client;
std::thread thread([&]() {
mp::EventLoop loop("IpcPipeTest", [](bool raise, const std::string& log) { LogPrintf("LOG%i: %s\n", raise, log); });
mp::EventLoop loop("IpcPipeTest", [](bool raise, const std::string& log) { LogInfo("LOG%i: %s\n", raise, log); });
auto pipe = loop.m_io_context.provider->newTwoWayPipe();
auto connection_client = std::make_unique<mp::Connection>(loop, kj::mv(pipe.ends[0]));

View file

@ -65,7 +65,7 @@ struct LogSetup : public BasicTestingSetup {
~LogSetup()
{
LogInstance().m_file_path = prev_log_path;
LogPrintf("Sentinel log to reopen log file\n");
LogInfo("Sentinel log to reopen log file\n");
LogInstance().m_print_to_file = prev_print_to_file;
LogInstance().m_reopen_file = prev_reopen_file;
LogInstance().m_log_timestamps = prev_log_timestamps;
@ -110,7 +110,6 @@ BOOST_FIXTURE_TEST_CASE(logging_LogPrintStr, LogSetup)
BOOST_FIXTURE_TEST_CASE(logging_LogPrintMacrosDeprecated, LogSetup)
{
LogPrintf("foo5: %s\n", "bar5");
LogPrintLevel(BCLog::NET, BCLog::Level::Trace, "foo4: %s\n", "bar4"); // not logged
LogPrintLevel(BCLog::NET, BCLog::Level::Debug, "foo7: %s\n", "bar7");
LogPrintLevel(BCLog::NET, BCLog::Level::Info, "foo8: %s\n", "bar8");
@ -122,7 +121,6 @@ BOOST_FIXTURE_TEST_CASE(logging_LogPrintMacrosDeprecated, LogSetup)
log_lines.push_back(log);
}
std::vector<std::string> expected = {
"foo5: bar5",
"[net] foo7: bar7",
"[net:info] foo8: bar8",
"[net:warning] foo9: bar9",

View file

@ -49,7 +49,7 @@ CreateAndActivateUTXOSnapshot(
UniValue result = CreateUTXOSnapshot(
node, node.chainman->ActiveChainstate(), auto_outfile, snapshot_path, snapshot_path);
LogPrintf(
LogInfo(
"Wrote UTXO snapshot to %s: %s\n", fs::PathToString(snapshot_path.make_preferred()), result.write());
// Read the written snapshot in and then activate it.

View file

@ -120,7 +120,7 @@ void TorControlConnection::readcb(struct bufferevent *bev, void *ctx)
// Do this after evbuffer_readln to make sure all full lines have been
// removed from the buffer. Everything left is an incomplete line.
if (evbuffer_get_length(input) > MAX_LINE_LENGTH) {
LogPrintf("tor: Disconnecting because MAX_LINE_LENGTH exceeded\n");
LogInfo("tor: Disconnecting because MAX_LINE_LENGTH exceeded\n");
self->Disconnect();
}
}
@ -150,14 +150,14 @@ bool TorControlConnection::Connect(const std::string& tor_control_center, const
const std::optional<CService> control_service{Lookup(tor_control_center, DEFAULT_TOR_CONTROL_PORT, fNameLookup)};
if (!control_service.has_value()) {
LogPrintf("tor: Failed to look up control center %s\n", tor_control_center);
LogInfo("tor: Failed to look up control center %s\n", tor_control_center);
return false;
}
struct sockaddr_storage control_address;
socklen_t control_address_len = sizeof(control_address);
if (!control_service.value().GetSockAddr(reinterpret_cast<struct sockaddr*>(&control_address), &control_address_len)) {
LogPrintf("tor: Error parsing socket address %s\n", tor_control_center);
LogInfo("tor: Error parsing socket address %s\n", tor_control_center);
return false;
}
@ -173,7 +173,7 @@ bool TorControlConnection::Connect(const std::string& tor_control_center, const
// Finally, connect to tor_control_center
if (bufferevent_socket_connect(b_conn, reinterpret_cast<struct sockaddr*>(&control_address), control_address_len) < 0) {
LogPrintf("tor: Error connecting to address %s\n", tor_control_center);
LogInfo("tor: Error connecting to address %s\n", tor_control_center);
return false;
}
return true;
@ -325,11 +325,11 @@ TorController::TorController(struct event_base* _base, const std::string& tor_co
{
reconnect_ev = event_new(base, -1, 0, reconnect_cb, this);
if (!reconnect_ev)
LogPrintf("tor: Failed to create event for reconnection: out of memory?\n");
LogInfo("tor: Failed to create event for reconnection: out of memory?\n");
// Start connection attempts immediately
if (!conn.Connect(m_tor_control_center, std::bind(&TorController::connected_cb, this, std::placeholders::_1),
std::bind(&TorController::disconnected_cb, this, std::placeholders::_1) )) {
LogPrintf("tor: Initiating connection to Tor control port %s failed\n", m_tor_control_center);
LogInfo("tor: Initiating connection to Tor control port %s failed\n", m_tor_control_center);
}
// Read service private key if cached
std::pair<bool,std::string> pkf = ReadBinaryFile(GetPrivateKeyFile());
@ -377,12 +377,12 @@ void TorController::get_socks_cb(TorControlConnection& _conn, const TorControlRe
if (!socks_location.empty()) {
LogDebug(BCLog::TOR, "Get SOCKS port command yielded %s\n", socks_location);
} else {
LogPrintf("tor: Get SOCKS port command returned nothing\n");
LogInfo("tor: Get SOCKS port command returned nothing\n");
}
} else if (reply.code == 510) { // 510 Unrecognized command
LogPrintf("tor: Get SOCKS port command failed with unrecognized command (You probably should upgrade Tor)\n");
LogInfo("tor: Get SOCKS port command failed with unrecognized command (You probably should upgrade Tor)\n");
} else {
LogPrintf("tor: Get SOCKS port command failed; error code %d\n", reply.code);
LogInfo("tor: Get SOCKS port command failed; error code %d\n", reply.code);
}
CService resolved;
@ -430,9 +430,9 @@ void TorController::add_onion_cb(TorControlConnection& _conn, const TorControlRe
private_key = i->second;
}
if (service_id.empty()) {
LogPrintf("tor: Error parsing ADD_ONION parameters:\n");
LogInfo("tor: Error parsing ADD_ONION parameters:\n");
for (const std::string &s : reply.lines) {
LogPrintf(" %s\n", SanitizeString(s));
LogInfo(" %s\n", SanitizeString(s));
}
return;
}
@ -441,14 +441,14 @@ void TorController::add_onion_cb(TorControlConnection& _conn, const TorControlRe
if (WriteBinaryFile(GetPrivateKeyFile(), private_key)) {
LogDebug(BCLog::TOR, "Cached service private key to %s\n", fs::PathToString(GetPrivateKeyFile()));
} else {
LogPrintf("tor: Error writing service private key to %s\n", fs::PathToString(GetPrivateKeyFile()));
LogInfo("tor: Error writing service private key to %s\n", fs::PathToString(GetPrivateKeyFile()));
}
AddLocal(service, LOCAL_MANUAL);
// ... onion requested - keep connection open
} else if (reply.code == 510) { // 510 Unrecognized command
LogPrintf("tor: Add onion failed with unrecognized command (You probably need to upgrade Tor)\n");
LogInfo("tor: Add onion failed with unrecognized command (You probably need to upgrade Tor)\n");
} else {
LogPrintf("tor: Add onion failed; error code %d\n", reply.code);
LogInfo("tor: Add onion failed; error code %d\n", reply.code);
}
}
@ -472,7 +472,7 @@ void TorController::auth_cb(TorControlConnection& _conn, const TorControlReply&
_conn.Command(strprintf("ADD_ONION %s Port=%i,%s", private_key, Params().GetDefaultPort(), m_target.ToStringAddrPort()),
std::bind(&TorController::add_onion_cb, this, std::placeholders::_1, std::placeholders::_2));
} else {
LogPrintf("tor: Authentication failed\n");
LogInfo("tor: Authentication failed\n");
}
}
@ -511,30 +511,30 @@ void TorController::authchallenge_cb(TorControlConnection& _conn, const TorContr
if (l.first == "AUTHCHALLENGE") {
std::map<std::string,std::string> m = ParseTorReplyMapping(l.second);
if (m.empty()) {
LogPrintf("tor: Error parsing AUTHCHALLENGE parameters: %s\n", SanitizeString(l.second));
LogInfo("tor: Error parsing AUTHCHALLENGE parameters: %s\n", SanitizeString(l.second));
return;
}
std::vector<uint8_t> serverHash = ParseHex(m["SERVERHASH"]);
std::vector<uint8_t> serverNonce = ParseHex(m["SERVERNONCE"]);
LogDebug(BCLog::TOR, "AUTHCHALLENGE ServerHash %s ServerNonce %s\n", HexStr(serverHash), HexStr(serverNonce));
if (serverNonce.size() != 32) {
LogPrintf("tor: ServerNonce is not 32 bytes, as required by spec\n");
LogInfo("tor: ServerNonce is not 32 bytes, as required by spec\n");
return;
}
std::vector<uint8_t> computedServerHash = ComputeResponse(TOR_SAFE_SERVERKEY, cookie, clientNonce, serverNonce);
if (computedServerHash != serverHash) {
LogPrintf("tor: ServerHash %s does not match expected ServerHash %s\n", HexStr(serverHash), HexStr(computedServerHash));
LogInfo("tor: ServerHash %s does not match expected ServerHash %s\n", HexStr(serverHash), HexStr(computedServerHash));
return;
}
std::vector<uint8_t> computedClientHash = ComputeResponse(TOR_SAFE_CLIENTKEY, cookie, clientNonce, serverNonce);
_conn.Command("AUTHENTICATE " + HexStr(computedClientHash), std::bind(&TorController::auth_cb, this, std::placeholders::_1, std::placeholders::_2));
} else {
LogPrintf("tor: Invalid reply to AUTHCHALLENGE\n");
LogInfo("tor: Invalid reply to AUTHCHALLENGE\n");
}
} else {
LogPrintf("tor: SAFECOOKIE authentication challenge failed\n");
LogInfo("tor: SAFECOOKIE authentication challenge failed\n");
}
}
@ -582,7 +582,7 @@ void TorController::protocolinfo_cb(TorControlConnection& _conn, const TorContro
ReplaceAll(torpassword, "\"", "\\\"");
_conn.Command("AUTHENTICATE \"" + torpassword + "\"", std::bind(&TorController::auth_cb, this, std::placeholders::_1, std::placeholders::_2));
} else {
LogPrintf("tor: Password provided with -torpassword, but HASHEDPASSWORD authentication is not available\n");
LogInfo("tor: Password provided with -torpassword, but HASHEDPASSWORD authentication is not available\n");
}
} else if (methods.count("NULL")) {
LogDebug(BCLog::TOR, "Using NULL authentication\n");
@ -599,18 +599,18 @@ void TorController::protocolinfo_cb(TorControlConnection& _conn, const TorContro
_conn.Command("AUTHCHALLENGE SAFECOOKIE " + HexStr(clientNonce), std::bind(&TorController::authchallenge_cb, this, std::placeholders::_1, std::placeholders::_2));
} else {
if (status_cookie.first) {
LogPrintf("tor: Authentication cookie %s is not exactly %i bytes, as is required by the spec\n", cookiefile, TOR_COOKIE_SIZE);
LogInfo("tor: Authentication cookie %s is not exactly %i bytes, as is required by the spec\n", cookiefile, TOR_COOKIE_SIZE);
} else {
LogPrintf("tor: Authentication cookie %s could not be opened (check permissions)\n", cookiefile);
LogInfo("tor: Authentication cookie %s could not be opened (check permissions)\n", cookiefile);
}
}
} else if (methods.count("HASHEDPASSWORD")) {
LogPrintf("tor: The only supported authentication mechanism left is password, but no password provided with -torpassword\n");
LogInfo("tor: The only supported authentication mechanism left is password, but no password provided with -torpassword\n");
} else {
LogPrintf("tor: No supported authentication method\n");
LogInfo("tor: No supported authentication method\n");
}
} else {
LogPrintf("tor: Requesting protocol info failed\n");
LogInfo("tor: Requesting protocol info failed\n");
}
}
@ -619,7 +619,7 @@ void TorController::connected_cb(TorControlConnection& _conn)
reconnect_timeout = RECONNECT_TIMEOUT_START;
// First send a PROTOCOLINFO command to figure out what authentication is expected
if (!_conn.Command("PROTOCOLINFO 1", std::bind(&TorController::protocolinfo_cb, this, std::placeholders::_1, std::placeholders::_2)))
LogPrintf("tor: Error sending initial protocolinfo command\n");
LogInfo("tor: Error sending initial protocolinfo command\n");
}
void TorController::disconnected_cb(TorControlConnection& _conn)
@ -647,7 +647,7 @@ void TorController::Reconnect()
*/
if (!conn.Connect(m_tor_control_center, std::bind(&TorController::connected_cb, this, std::placeholders::_1),
std::bind(&TorController::disconnected_cb, this, std::placeholders::_1) )) {
LogPrintf("tor: Re-initiating connection to Tor control port %s failed\n", m_tor_control_center);
LogInfo("tor: Re-initiating connection to Tor control port %s failed\n", m_tor_control_center);
}
}
@ -683,7 +683,7 @@ void StartTorControl(CService onion_service_target)
#endif
gBase = event_base_new();
if (!gBase) {
LogPrintf("tor: Unable to create event_base\n");
LogInfo("tor: Unable to create event_base\n");
return;
}
@ -695,7 +695,7 @@ void StartTorControl(CService onion_service_target)
void InterruptTorControl()
{
if (gBase) {
LogPrintf("tor: Thread interrupt\n");
LogInfo("tor: Thread interrupt\n");
event_base_once(gBase, -1, EV_TIMEOUT, [](evutil_socket_t, short, void*) {
event_base_loopbreak(gBase);
}, nullptr, nullptr);

View file

@ -134,7 +134,7 @@ bool CCoinsViewDB::BatchWrite(CoinsViewCacheCursor& cursor, const uint256 &hashB
if (m_options.simulate_crash_ratio) {
static FastRandomContext rng;
if (rng.randrange(m_options.simulate_crash_ratio) == 0) {
LogPrintf("Simulating a crash. Goodbye.\n");
LogInfo("Simulating a crash. Goodbye.\n");
_Exit(0);
}
}

View file

@ -935,9 +935,9 @@ void CTxMemPool::PrioritiseTransaction(const uint256& hash, const CAmount& nFeeD
}
if (delta == 0) {
mapDeltas.erase(hash);
LogPrintf("PrioritiseTransaction: %s (%sin mempool) delta cleared\n", hash.ToString(), it == mapTx.end() ? "not " : "");
LogInfo("PrioritiseTransaction: %s (%sin mempool) delta cleared\n", hash.ToString(), it == mapTx.end() ? "not " : "");
} else {
LogPrintf("PrioritiseTransaction: %s (%sin mempool) fee += %s, new delta=%s\n",
LogInfo("PrioritiseTransaction: %s (%sin mempool) fee += %s, new delta=%s\n",
hash.ToString(),
it == mapTx.end() ? "not " : "",
FormatMoney(nFeeDelta),

View file

@ -200,12 +200,12 @@ std::vector<bool> DecodeAsmap(fs::path path)
FILE *filestr = fsbridge::fopen(path, "rb");
AutoFile file{filestr};
if (file.IsNull()) {
LogPrintf("Failed to open asmap file from disk\n");
LogInfo("Failed to open asmap file from disk\n");
return bits;
}
file.seek(0, SEEK_END);
int length = file.tell();
LogPrintf("Opened asmap file %s (%d bytes) from disk\n", fs::quoted(fs::PathToString(path)), length);
LogInfo("Opened asmap file %s (%d bytes) from disk\n", fs::quoted(fs::PathToString(path)), length);
file.seek(0, SEEK_SET);
uint8_t cur_byte;
for (int i = 0; i < length; ++i) {
@ -215,7 +215,7 @@ std::vector<bool> DecodeAsmap(fs::path path)
}
}
if (!SanityCheckASMap(bits, 128)) {
LogPrintf("Sanity check of asmap file %s failed\n", fs::quoted(fs::PathToString(path)));
LogInfo("Sanity check of asmap file %s failed\n", fs::quoted(fs::PathToString(path)));
return {};
}
return bits;

View file

@ -20,7 +20,7 @@ void ScheduleBatchPriority()
const static sched_param param{};
const int rc = pthread_setschedparam(pthread_self(), SCHED_BATCH, &param);
if (rc != 0) {
LogPrintf("Failed to pthread_setschedparam: %s\n", SysErrorString(rc));
LogInfo("Failed to pthread_setschedparam: %s\n", SysErrorString(rc));
}
#endif
}

View file

@ -36,6 +36,6 @@ static std::string FormatException(const std::exception* pex, std::string_view t
void PrintExceptionContinue(const std::exception* pex, std::string_view thread_name)
{
std::string message = FormatException(pex, thread_name);
LogPrintf("\n\n************************\n%s\n", message);
LogInfo("\n\n************************\n%s\n", message);
tfm::format(std::cerr, "\n\n************************\n%s\n", message);
}

View file

@ -108,28 +108,28 @@ std::streampos GetFileSize(const char* path, std::streamsize max)
bool FileCommit(FILE* file)
{
if (fflush(file) != 0) { // harmless if redundantly called
LogPrintf("fflush failed: %s\n", SysErrorString(errno));
LogInfo("fflush failed: %s\n", SysErrorString(errno));
return false;
}
#ifdef WIN32
HANDLE hFile = (HANDLE)_get_osfhandle(_fileno(file));
if (FlushFileBuffers(hFile) == 0) {
LogPrintf("FlushFileBuffers failed: %s\n", Win32ErrorString(GetLastError()));
LogInfo("FlushFileBuffers failed: %s\n", Win32ErrorString(GetLastError()));
return false;
}
#elif defined(__APPLE__) && defined(F_FULLFSYNC)
if (fcntl(fileno(file), F_FULLFSYNC, 0) == -1) { // Manpage says "value other than -1" is returned on success
LogPrintf("fcntl F_FULLFSYNC failed: %s\n", SysErrorString(errno));
LogInfo("fcntl F_FULLFSYNC failed: %s\n", SysErrorString(errno));
return false;
}
#elif HAVE_FDATASYNC
if (fdatasync(fileno(file)) != 0 && errno != EINVAL) { // Ignore EINVAL for filesystems that don't support sync
LogPrintf("fdatasync failed: %s\n", SysErrorString(errno));
LogInfo("fdatasync failed: %s\n", SysErrorString(errno));
return false;
}
#else
if (fsync(fileno(file)) != 0 && errno != EINVAL) {
LogPrintf("fsync failed: %s\n", SysErrorString(errno));
LogInfo("fsync failed: %s\n", SysErrorString(errno));
return false;
}
#endif
@ -241,7 +241,7 @@ fs::path GetSpecialFolderPath(int nFolder, bool fCreate)
return fs::path(pszPath);
}
LogPrintf("SHGetSpecialFolderPathW() failed, could not obtain requested path.\n");
LogInfo("SHGetSpecialFolderPathW() failed, could not obtain requested path.\n");
return fs::path("");
}
#endif

View file

@ -409,7 +409,7 @@ void Sock::Close()
int ret = close(m_socket);
#endif
if (ret) {
LogPrintf("Error closing socket %d: %s\n", m_socket, NetworkErrorString(WSAGetLastError()));
LogInfo("Error closing socket %d: %s\n", m_socket, NetworkErrorString(WSAGetLastError()));
}
m_socket = INVALID_SOCKET;
}

View file

@ -17,9 +17,9 @@ void util::TraceThread(std::string_view thread_name, std::function<void()> threa
{
util::ThreadRename(std::string{thread_name});
try {
LogPrintf("%s thread start\n", thread_name);
LogInfo("%s thread start\n", thread_name);
thread_func();
LogPrintf("%s thread exit\n", thread_name);
LogInfo("%s thread exit\n", thread_name);
} catch (const std::exception& e) {
PrintExceptionContinue(&e, thread_name);
throw;

View file

@ -189,7 +189,7 @@ std::optional<std::vector<int>> CalculatePrevHeights(
? tip.nHeight + 1 // Assume all mempool transaction confirm in the next block.
: coin->nHeight;
} else {
LogPrintf("ERROR: %s: Missing input %d in transaction \'%s\'\n", __func__, i, tx.GetHash().GetHex());
LogInfo("ERROR: %s: Missing input %d in transaction \'%s\'\n", __func__, i, tx.GetHash().GetHex());
return std::nullopt;
}
}
@ -1278,7 +1278,7 @@ bool MemPoolAccept::ConsensusScriptChecks(const ATMPArgs& args, Workspace& ws)
unsigned int currentBlockScriptVerifyFlags{GetBlockScriptFlags(*m_active_chainstate.m_chain.Tip(), m_active_chainstate.m_chainman)};
if (!CheckInputsFromMempoolAndCache(tx, state, m_view, m_pool, currentBlockScriptVerifyFlags,
ws.m_precomputed_txdata, m_active_chainstate.CoinsTip(), GetValidationCache())) {
LogPrintf("BUG! PLEASE REPORT THIS! CheckInputScripts failed against latest-block but not STANDARD flags %s, %s\n", hash.ToString(), state.ToString());
LogInfo("BUG! PLEASE REPORT THIS! CheckInputScripts failed against latest-block but not STANDARD flags %s, %s\n", hash.ToString(), state.ToString());
return Assume(false);
}
@ -2035,7 +2035,7 @@ bool ChainstateManager::IsInitialBlockDownload() const
if (chain.Tip()->Time() < Now<NodeSeconds>() - m_options.max_tip_age) {
return true;
}
LogPrintf("Leaving InitialBlockDownload (latching to false)\n");
LogInfo("Leaving InitialBlockDownload (latching to false)\n");
m_cached_finished_ibd.store(true, std::memory_order_relaxed);
return false;
}
@ -2052,7 +2052,7 @@ void Chainstate::CheckForkWarningConditions()
}
if (m_chainman.m_best_invalid && m_chainman.m_best_invalid->nChainWork > m_chain.Tip()->nChainWork + (GetBlockProof(*m_chain.Tip()) * 6)) {
LogPrintf("%s: Warning: Found invalid chain at least ~6 blocks longer than our best chain.\nChain state database corruption likely.\n", __func__);
LogInfo("%s: Warning: Found invalid chain at least ~6 blocks longer than our best chain.\nChain state database corruption likely.\n", __func__);
m_chainman.GetNotifications().warningSet(
kernel::Warning::LARGE_WORK_INVALID_CHAIN,
_("Warning: We do not appear to fully agree with our peers! You may need to upgrade, or other nodes may need to upgrade."));
@ -2073,12 +2073,12 @@ void Chainstate::InvalidChainFound(CBlockIndex* pindexNew)
m_chainman.RecalculateBestHeader();
}
LogPrintf("%s: invalid block=%s height=%d log2_work=%f date=%s\n", __func__,
LogInfo("%s: invalid block=%s height=%d log2_work=%f date=%s\n", __func__,
pindexNew->GetBlockHash().ToString(), pindexNew->nHeight,
log(pindexNew->nChainWork.getdouble())/log(2.0), FormatISO8601DateTime(pindexNew->GetBlockTime()));
CBlockIndex *tip = m_chain.Tip();
assert (tip);
LogPrintf("%s: current best=%s height=%d log2_work=%f date=%s\n", __func__,
LogInfo("%s: current best=%s height=%d log2_work=%f date=%s\n", __func__,
tip->GetBlockHash().ToString(), m_chain.Height(), log(tip->nChainWork.getdouble())/log(2.0),
FormatISO8601DateTime(tip->GetBlockTime()));
CheckForkWarningConditions();
@ -2137,7 +2137,7 @@ ValidationCache::ValidationCache(const size_t script_execution_cache_bytes, cons
m_script_execution_cache_hasher.Write(nonce.begin(), 32);
const auto [num_elems, approx_size_bytes] = m_script_execution_cache.setup_bytes(script_execution_cache_bytes);
LogPrintf("Using %zu MiB out of %zu MiB requested for script execution cache, able to store %zu elements\n",
LogInfo("Using %zu MiB out of %zu MiB requested for script execution cache, able to store %zu elements\n",
approx_size_bytes >> 20, script_execution_cache_bytes >> 20, num_elems);
}
@ -2809,7 +2809,7 @@ CoinsCacheSizeState Chainstate::GetCoinsCacheSizeState(
std::max((9 * nTotalSpace) / 10, nTotalSpace - MAX_BLOCK_COINSDB_USAGE_BYTES);
if (cacheSize > nTotalSpace) {
LogPrintf("Cache size (%s) exceeds total space (%s)\n", cacheSize, nTotalSpace);
LogInfo("Cache size (%s) exceeds total space (%s)\n", cacheSize, nTotalSpace);
return CoinsCacheSizeState::CRITICAL;
} else if (cacheSize > large_threshold) {
return CoinsCacheSizeState::LARGE;
@ -2972,7 +2972,7 @@ void Chainstate::ForceFlushStateToDisk()
{
BlockValidationState state;
if (!this->FlushStateToDisk(state, FlushStateMode::ALWAYS)) {
LogPrintf("%s: failed to flush state (%s)\n", __func__, state.ToString());
LogInfo("%s: failed to flush state (%s)\n", __func__, state.ToString());
}
}
@ -2981,7 +2981,7 @@ void Chainstate::PruneAndFlush()
BlockValidationState state;
m_blockman.m_check_for_pruning = true;
if (!this->FlushStateToDisk(state, FlushStateMode::NONE)) {
LogPrintf("%s: failed to flush state (%s)\n", __func__, state.ToString());
LogInfo("%s: failed to flush state (%s)\n", __func__, state.ToString());
}
}
@ -2995,7 +2995,7 @@ static void UpdateTipLog(
{
AssertLockHeld(::cs_main);
LogPrintf("%s%s: new best=%s height=%d version=0x%08x log2_work=%f tx=%lu date='%s' progress=%f cache=%.1fMiB(%utxo)%s\n",
LogInfo("%s%s: new best=%s height=%d version=0x%08x log2_work=%f tx=%lu date='%s' progress=%f cache=%.1fMiB(%utxo)%s\n",
prefix, func_name,
tip->GetBlockHash().ToString(), tip->nHeight, tip->nVersion,
log(tip->nChainWork.getdouble()) / log(2.0), tip->m_chain_tx_count,
@ -3488,7 +3488,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. "
LogInfo("m_disabled is set - this chainstate should not be in operation. "
"Please report this as a bug. %s\n", CLIENT_BUGREPORT);
return false;
}
@ -4221,7 +4221,7 @@ static bool ContextualCheckBlockHeader(const CBlockHeader& block, BlockValidatio
// BlockIndex().
const CBlockIndex* pcheckpoint = blockman.GetLastCheckpoint(chainman.GetParams().Checkpoints());
if (pcheckpoint && nHeight < pcheckpoint->nHeight) {
LogPrintf("ERROR: %s: forked chain older than last checkpoint (height %d)\n", __func__, nHeight);
LogInfo("ERROR: %s: forked chain older than last checkpoint (height %d)\n", __func__, nHeight);
return state.Invalid(BlockValidationResult::BLOCK_CHECKPOINT, "bad-fork-prior-to-checkpoint");
}
}
@ -4425,7 +4425,7 @@ bool ChainstateManager::AcceptBlockHeader(const CBlockHeader& block, BlockValida
if (IsInitialBlockDownload()) {
LogPrintLevel(BCLog::VALIDATION, BCLog::Level::Debug, "%s\n", msg);
} else {
LogPrintf("%s\n", msg);
LogInfo("%s\n", msg);
}
return true;
@ -4697,7 +4697,7 @@ void PruneBlockFilesManual(Chainstate& active_chainstate, int nManualPruneHeight
BlockValidationState state;
if (!active_chainstate.FlushStateToDisk(
state, FlushStateMode::NONE, nManualPruneHeight)) {
LogPrintf("%s: failed to flush state (%s)\n", __func__, state.ToString());
LogInfo("%s: failed to flush state (%s)\n", __func__, state.ToString());
}
}
@ -4721,7 +4721,7 @@ bool Chainstate::LoadChainTip()
PruneBlockIndexCandidates();
tip = m_chain.Tip();
LogPrintf("Loaded best chain: hashBestChain=%s height=%d date=%s progress=%f\n",
LogInfo("Loaded best chain: hashBestChain=%s height=%d date=%s progress=%f\n",
tip->GetBlockHash().ToString(),
m_chain.Height(),
FormatISO8601DateTime(tip->GetBlockTime()),
@ -4764,7 +4764,7 @@ VerifyDBResult CVerifyDB::VerifyDB(
nCheckDepth = chainstate.m_chain.Height();
}
nCheckLevel = std::max(0, std::min(4, nCheckLevel));
LogPrintf("Verifying last %i blocks at level %i\n", nCheckDepth, nCheckLevel);
LogInfo("Verifying last %i blocks at level %i\n", nCheckDepth, nCheckLevel);
CCoinsViewCache coins(&coinsview);
CBlockIndex* pindex;
CBlockIndex* pindexFailure = nullptr;
@ -4773,7 +4773,7 @@ VerifyDBResult CVerifyDB::VerifyDB(
int reportDone = 0;
bool skipped_no_block_data{false};
bool skipped_l3_checks{false};
LogPrintf("Verification progress: 0%%\n");
LogInfo("Verification progress: 0%%\n");
const bool is_snapshot_cs{chainstate.m_from_snapshot_blockhash};
@ -4781,7 +4781,7 @@ VerifyDBResult CVerifyDB::VerifyDB(
const int percentageDone = std::max(1, std::min(99, (int)(((double)(chainstate.m_chain.Height() - pindex->nHeight)) / (double)nCheckDepth * (nCheckLevel >= 4 ? 50 : 100))));
if (reportDone < percentageDone / 10) {
// report every 10% step
LogPrintf("Verification progress: %d%%\n", percentageDone);
LogInfo("Verification progress: %d%%\n", percentageDone);
reportDone = percentageDone / 10;
}
m_notifications.progress(_("Verifying blocks…"), percentageDone, false);
@ -4791,19 +4791,19 @@ VerifyDBResult CVerifyDB::VerifyDB(
if ((chainstate.m_blockman.IsPruneMode() || is_snapshot_cs) && !(pindex->nStatus & BLOCK_HAVE_DATA)) {
// If pruning or running under an assumeutxo snapshot, only go
// back as far as we have data.
LogPrintf("VerifyDB(): block verification stopping at height %d (no data). This could be due to pruning or use of an assumeutxo snapshot.\n", pindex->nHeight);
LogInfo("VerifyDB(): block verification stopping at height %d (no data). This could be due to pruning or use of an assumeutxo snapshot.\n", pindex->nHeight);
skipped_no_block_data = true;
break;
}
CBlock block;
// check level 0: read from disk
if (!chainstate.m_blockman.ReadBlock(block, *pindex)) {
LogPrintf("Verification error: ReadBlock failed at %d, hash=%s\n", pindex->nHeight, pindex->GetBlockHash().ToString());
LogInfo("Verification error: ReadBlock failed at %d, hash=%s\n", pindex->nHeight, pindex->GetBlockHash().ToString());
return VerifyDBResult::CORRUPTED_BLOCK_DB;
}
// check level 1: verify block validity
if (nCheckLevel >= 1 && !CheckBlock(block, state, consensus_params)) {
LogPrintf("Verification error: found bad block at %d, hash=%s (%s)\n",
LogInfo("Verification error: found bad block at %d, hash=%s (%s)\n",
pindex->nHeight, pindex->GetBlockHash().ToString(), state.ToString());
return VerifyDBResult::CORRUPTED_BLOCK_DB;
}
@ -4812,7 +4812,7 @@ VerifyDBResult CVerifyDB::VerifyDB(
CBlockUndo undo;
if (!pindex->GetUndoPos().IsNull()) {
if (!chainstate.m_blockman.ReadBlockUndo(undo, *pindex)) {
LogPrintf("Verification error: found bad undo data at %d, hash=%s\n", pindex->nHeight, pindex->GetBlockHash().ToString());
LogInfo("Verification error: found bad undo data at %d, hash=%s\n", pindex->nHeight, pindex->GetBlockHash().ToString());
return VerifyDBResult::CORRUPTED_BLOCK_DB;
}
}
@ -4825,7 +4825,7 @@ VerifyDBResult CVerifyDB::VerifyDB(
assert(coins.GetBestBlock() == pindex->GetBlockHash());
DisconnectResult res = chainstate.DisconnectBlock(block, pindex, coins);
if (res == DISCONNECT_FAILED) {
LogPrintf("Verification error: irrecoverable inconsistency in block data at %d, hash=%s\n", pindex->nHeight, pindex->GetBlockHash().ToString());
LogInfo("Verification error: irrecoverable inconsistency in block data at %d, hash=%s\n", pindex->nHeight, pindex->GetBlockHash().ToString());
return VerifyDBResult::CORRUPTED_BLOCK_DB;
}
if (res == DISCONNECT_UNCLEAN) {
@ -4841,11 +4841,11 @@ VerifyDBResult CVerifyDB::VerifyDB(
if (chainstate.m_chainman.m_interrupt) return VerifyDBResult::INTERRUPTED;
}
if (pindexFailure) {
LogPrintf("Verification error: coin database inconsistencies found (last %i blocks, %i good transactions before that)\n", chainstate.m_chain.Height() - pindexFailure->nHeight + 1, nGoodTransactions);
LogInfo("Verification error: coin database inconsistencies found (last %i blocks, %i good transactions before that)\n", chainstate.m_chain.Height() - pindexFailure->nHeight + 1, nGoodTransactions);
return VerifyDBResult::CORRUPTED_BLOCK_DB;
}
if (skipped_l3_checks) {
LogPrintf("Skipped verification of level >=3 (insufficient database cache size). Consider increasing -dbcache.\n");
LogInfo("Skipped verification of level >=3 (insufficient database cache size). Consider increasing -dbcache.\n");
}
// store block count as we move pindex at check level >= 4
@ -4857,25 +4857,25 @@ VerifyDBResult CVerifyDB::VerifyDB(
const int percentageDone = std::max(1, std::min(99, 100 - (int)(((double)(chainstate.m_chain.Height() - pindex->nHeight)) / (double)nCheckDepth * 50)));
if (reportDone < percentageDone / 10) {
// report every 10% step
LogPrintf("Verification progress: %d%%\n", percentageDone);
LogInfo("Verification progress: %d%%\n", percentageDone);
reportDone = percentageDone / 10;
}
m_notifications.progress(_("Verifying blocks…"), percentageDone, false);
pindex = chainstate.m_chain.Next(pindex);
CBlock block;
if (!chainstate.m_blockman.ReadBlock(block, *pindex)) {
LogPrintf("Verification error: ReadBlock failed at %d, hash=%s\n", pindex->nHeight, pindex->GetBlockHash().ToString());
LogInfo("Verification error: ReadBlock failed at %d, hash=%s\n", pindex->nHeight, pindex->GetBlockHash().ToString());
return VerifyDBResult::CORRUPTED_BLOCK_DB;
}
if (!chainstate.ConnectBlock(block, state, pindex, coins)) {
LogPrintf("Verification error: found unconnectable block at %d, hash=%s (%s)\n", pindex->nHeight, pindex->GetBlockHash().ToString(), state.ToString());
LogInfo("Verification error: found unconnectable block at %d, hash=%s (%s)\n", pindex->nHeight, pindex->GetBlockHash().ToString(), state.ToString());
return VerifyDBResult::CORRUPTED_BLOCK_DB;
}
if (chainstate.m_chainman.m_interrupt) return VerifyDBResult::INTERRUPTED;
}
}
LogPrintf("Verification: No coin database inconsistencies in last %i blocks (%i transactions)\n", block_count, nGoodTransactions);
LogInfo("Verification: No coin database inconsistencies in last %i blocks (%i transactions)\n", block_count, nGoodTransactions);
if (skipped_l3_checks) {
return VerifyDBResult::SKIPPED_L3_CHECKS;
@ -4924,7 +4924,7 @@ bool Chainstate::ReplayBlocks()
}
m_chainman.GetNotifications().progress(_("Replaying blocks…"), 0, false);
LogPrintf("Replaying blocks\n");
LogInfo("Replaying blocks\n");
const CBlockIndex* pindexOld = nullptr; // Old tip during the interrupted flush.
const CBlockIndex* pindexNew; // New tip during the interrupted flush.
@ -4954,7 +4954,7 @@ bool Chainstate::ReplayBlocks()
LogError("RollbackBlock(): ReadBlock() failed at %d, hash=%s\n", pindexOld->nHeight, pindexOld->GetBlockHash().ToString());
return false;
}
LogPrintf("Rolling back %s (%i)\n", pindexOld->GetBlockHash().ToString(), pindexOld->nHeight);
LogInfo("Rolling back %s (%i)\n", pindexOld->GetBlockHash().ToString(), pindexOld->nHeight);
DisconnectResult res = DisconnectBlock(block, pindexOld, cache);
if (res == DISCONNECT_FAILED) {
LogError("RollbackBlock(): DisconnectBlock failed at %d, hash=%s\n", pindexOld->nHeight, pindexOld->GetBlockHash().ToString());
@ -4973,7 +4973,7 @@ bool Chainstate::ReplayBlocks()
for (int nHeight = nForkHeight + 1; nHeight <= pindexNew->nHeight; ++nHeight) {
const CBlockIndex& pindex{*Assert(pindexNew->GetAncestor(nHeight))};
LogPrintf("Rolling forward %s (%i)\n", pindex.GetBlockHash().ToString(), nHeight);
LogInfo("Rolling forward %s (%i)\n", pindex.GetBlockHash().ToString(), nHeight);
m_chainman.GetNotifications().progress(_("Replaying blocks…"), (int)((nHeight - nForkHeight) * 100.0 / (pindexNew->nHeight - nForkHeight)), false);
if (!RollforwardBlock(&pindex, cache)) return false;
}
@ -5251,7 +5251,7 @@ void ChainstateManager::LoadExternalBlockFile(
} catch (const std::runtime_error& e) {
GetNotifications().fatalError(strprintf(_("System error while loading external block file: %s"), e.what()));
}
LogPrintf("Loaded %i blocks from external file in %dms\n", nLoaded, Ticks<std::chrono::milliseconds>(SteadyClock::now() - start));
LogInfo("Loaded %i blocks from external file in %dms\n", nLoaded, Ticks<std::chrono::milliseconds>(SteadyClock::now() - start));
}
bool ChainstateManager::ShouldCheckBlockIndex() const
@ -5595,9 +5595,9 @@ bool Chainstate::ResizeCoinsCaches(size_t coinstip_size, size_t coinsdb_size)
m_coinsdb_cache_size_bytes = coinsdb_size;
CoinsDB().ResizeCache(coinsdb_size);
LogPrintf("[%s] resized coinsdb cache to %.1f MiB\n",
LogInfo("[%s] resized coinsdb cache to %.1f MiB\n",
this->ToString(), coinsdb_size * (1.0 / 1024 / 1024));
LogPrintf("[%s] resized coinstip cache to %.1f MiB\n",
LogInfo("[%s] resized coinstip cache to %.1f MiB\n",
this->ToString(), coinstip_size * (1.0 / 1024 / 1024));
BlockValidationState state;
@ -5684,24 +5684,24 @@ Chainstate& ChainstateManager::InitializeChainstate(CTxMemPool* mempool)
try {
bool existed = fs::remove(base_blockhash_path);
if (!existed) {
LogPrintf("[snapshot] snapshot chainstate dir being removed lacks %s file\n",
LogInfo("[snapshot] snapshot chainstate dir being removed lacks %s file\n",
fs::PathToString(node::SNAPSHOT_BLOCKHASH_FILENAME));
}
} catch (const fs::filesystem_error& e) {
LogPrintf("[snapshot] failed to remove file %s: %s\n",
LogInfo("[snapshot] failed to remove file %s: %s\n",
fs::PathToString(base_blockhash_path), fsbridge::get_filesystem_error_message(e));
}
}
std::string path_str = fs::PathToString(db_path);
LogPrintf("Removing leveldb dir at %s\n", path_str);
LogInfo("Removing leveldb dir at %s\n", path_str);
// We have to destruct before this call leveldb::DB in order to release the db
// lock, otherwise `DestroyDB` will fail. See `leveldb::~DBImpl()`.
const bool destroyed = DestroyDB(path_str);
if (!destroyed) {
LogPrintf("error: leveldb DestroyDB call failed on %s\n", path_str);
LogInfo("error: leveldb DestroyDB call failed on %s\n", path_str);
}
// Datadir should be removed from filesystem; otherwise initialization may detect
@ -5857,8 +5857,8 @@ util::Result<CBlockIndex*> ChainstateManager::ActivateSnapshot(
m_active_chainstate = m_snapshot_chainstate.get();
m_blockman.m_snapshot_height = this->GetSnapshotBaseHeight();
LogPrintf("[snapshot] successfully activated snapshot %s\n", base_blockhash.ToString());
LogPrintf("[snapshot] (%.2f MB)\n",
LogInfo("[snapshot] successfully activated snapshot %s\n", base_blockhash.ToString());
LogInfo("[snapshot] (%.2f MB)\n",
m_snapshot_chainstate->CoinsTip().DynamicMemoryUsage() / (1000 * 1000));
this->MaybeRebalanceCaches();
@ -5929,7 +5929,7 @@ util::Result<void> ChainstateManager::PopulateAndValidateSnapshot(
const uint64_t coins_count = metadata.m_coins_count;
uint64_t coins_left = metadata.m_coins_count;
LogPrintf("[snapshot] loading %d coins from snapshot %s\n", coins_left, base_blockhash.ToString());
LogInfo("[snapshot] loading %d coins from snapshot %s\n", coins_left, base_blockhash.ToString());
int64_t coins_processed{0};
while (coins_left > 0) {
@ -5965,7 +5965,7 @@ util::Result<void> ChainstateManager::PopulateAndValidateSnapshot(
++coins_processed;
if (coins_processed % 1000000 == 0) {
LogPrintf("[snapshot] %d coins loaded (%.2f%%, %.2f MB)\n",
LogInfo("[snapshot] %d coins loaded (%.2f%%, %.2f MB)\n",
coins_processed,
static_cast<float>(coins_processed) * 100 / static_cast<float>(coins_count),
coins_cache.DynamicMemoryUsage() / (1000 * 1000));
@ -6020,7 +6020,7 @@ util::Result<void> ChainstateManager::PopulateAndValidateSnapshot(
coins_count))};
}
LogPrintf("[snapshot] loaded %d (%.2f MB) coins from snapshot %s\n",
LogInfo("[snapshot] loaded %d (%.2f MB) coins from snapshot %s\n",
coins_count,
coins_cache.DynamicMemoryUsage() / (1000 * 1000),
base_blockhash.ToString());
@ -6087,7 +6087,7 @@ util::Result<void> ChainstateManager::PopulateAndValidateSnapshot(
index->m_chain_tx_count = au_data.m_chain_tx_count;
snapshot_chainstate.setBlockIndexCandidates.insert(snapshot_start_block);
LogPrintf("[snapshot] validated snapshot (%.2f MB)\n",
LogInfo("[snapshot] validated snapshot (%.2f MB)\n",
coins_cache.DynamicMemoryUsage() / (1000 * 1000));
return {};
}
@ -6162,7 +6162,7 @@ SnapshotCompletionResult ChainstateManager::MaybeCompleteSnapshotValidation()
};
if (index_new.GetBlockHash() != snapshot_blockhash) {
LogPrintf("[snapshot] supposed base block %s does not match the "
LogInfo("[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();
@ -6183,7 +6183,7 @@ SnapshotCompletionResult ChainstateManager::MaybeCompleteSnapshotValidation()
const auto& maybe_au_data = m_options.chainparams.AssumeutxoForHeight(curr_height);
if (!maybe_au_data) {
LogPrintf("[snapshot] assumeutxo data not found for height "
LogInfo("[snapshot] assumeutxo data not found for height "
"(%d) - refusing to validate snapshot\n", curr_height);
handle_invalid_snapshot();
return SnapshotCompletionResult::MISSING_CHAINPARAMS;
@ -6191,7 +6191,7 @@ SnapshotCompletionResult ChainstateManager::MaybeCompleteSnapshotValidation()
const AssumeutxoData& au_data = *maybe_au_data;
std::optional<CCoinsStats> maybe_ibd_stats;
LogPrintf("[snapshot] computing UTXO stats for background chainstate to validate "
LogInfo("[snapshot] computing UTXO stats for background chainstate to validate "
"snapshot - this could take a few minutes\n");
try {
maybe_ibd_stats = ComputeUTXOStats(
@ -6205,7 +6205,7 @@ SnapshotCompletionResult ChainstateManager::MaybeCompleteSnapshotValidation()
// XXX note that this function is slow and will hold cs_main for potentially minutes.
if (!maybe_ibd_stats) {
LogPrintf("[snapshot] failed to generate stats for validation coins db\n");
LogInfo("[snapshot] failed to generate stats for validation coins db\n");
// While this isn't a problem with the snapshot per se, this condition
// prevents us from validating the snapshot, so we should shut down and let the
// user handle the issue manually.
@ -6221,14 +6221,14 @@ SnapshotCompletionResult ChainstateManager::MaybeCompleteSnapshotValidation()
// hash for the snapshot when it's loaded in its chainstate's leveldb. We could then
// reference that here for an additional check.
if (AssumeutxoHash{ibd_stats.hashSerialized} != au_data.hash_serialized) {
LogPrintf("[snapshot] hash mismatch: actual=%s, expected=%s\n",
LogInfo("[snapshot] hash mismatch: actual=%s, expected=%s\n",
ibd_stats.hashSerialized.ToString(),
au_data.hash_serialized.ToString());
handle_invalid_snapshot();
return SnapshotCompletionResult::HASH_MISMATCH;
}
LogPrintf("[snapshot] snapshot beginning at %s has been fully validated\n",
LogInfo("[snapshot] snapshot beginning at %s has been fully validated\n",
snapshot_blockhash.ToString());
m_ibd_chainstate->m_disabled = true;
@ -6264,7 +6264,7 @@ void ChainstateManager::MaybeRebalanceCaches()
}
else if (snapshot_usable && !ibd_usable) {
// If background validation has completed and snapshot is our active chain...
LogPrintf("[snapshot] allocating all cache to the snapshot chainstate\n");
LogInfo("[snapshot] allocating all cache to the snapshot chainstate\n");
// Allocate everything to the snapshot chainstate.
m_snapshot_chainstate->ResizeCoinsCaches(m_total_coinstip_cache, m_total_coinsdb_cache);
}
@ -6333,7 +6333,7 @@ bool ChainstateManager::DetectSnapshotChainstate()
if (!base_blockhash) {
return false;
}
LogPrintf("[snapshot] detected active snapshot chainstate (%s) - loading\n",
LogInfo("[snapshot] detected active snapshot chainstate (%s) - loading\n",
fs::PathToString(*path));
this->ActivateExistingSnapshot(*base_blockhash);
@ -6345,7 +6345,7 @@ Chainstate& ChainstateManager::ActivateExistingSnapshot(uint256 base_blockhash)
assert(!m_snapshot_chainstate);
m_snapshot_chainstate =
std::make_unique<Chainstate>(nullptr, m_blockman, *this, base_blockhash);
LogPrintf("[snapshot] switching active chainstate to %s\n", m_snapshot_chainstate->ToString());
LogInfo("[snapshot] switching active chainstate to %s\n", m_snapshot_chainstate->ToString());
// Mempool is empty at this point because we're still in IBD.
Assert(m_active_chainstate->m_mempool->size() == 0);
@ -6389,7 +6389,7 @@ util::Result<void> Chainstate::InvalidateCoinsDBOnDisk()
auto invalid_path = snapshot_datadir + "_INVALID";
std::string dbpath = fs::PathToString(snapshot_datadir);
std::string target = fs::PathToString(invalid_path);
LogPrintf("[snapshot] renaming snapshot datadir %s to %s\n", dbpath, target);
LogInfo("[snapshot] renaming snapshot datadir %s to %s\n", dbpath, target);
// The invalid snapshot datadir is simply moved and not deleted because we may
// want to do forensics later during issue investigation. The user is instructed
@ -6400,7 +6400,7 @@ util::Result<void> Chainstate::InvalidateCoinsDBOnDisk()
auto src_str = fs::PathToString(snapshot_datadir);
auto dest_str = fs::PathToString(invalid_path);
LogPrintf("%s: error renaming file '%s' -> '%s': %s\n",
LogInfo("%s: error renaming file '%s' -> '%s': %s\n",
__func__, src_str, dest_str, e.what());
return util::Error{strprintf(_(
"Rename of '%s' -> '%s' failed. "
@ -6420,7 +6420,7 @@ bool ChainstateManager::DeleteSnapshotChainstate()
fs::path snapshot_datadir = Assert(node::FindSnapshotChainstateDir(m_options.datadir)).value();
if (!DeleteCoinsDBFromDisk(snapshot_datadir, /*is_snapshot=*/ true)) {
LogPrintf("Deletion of %s failed. Please remove it manually to continue reindexing.\n",
LogInfo("Deletion of %s failed. Please remove it manually to continue reindexing.\n",
fs::PathToString(snapshot_datadir));
return false;
}
@ -6482,7 +6482,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 "
LogInfo("[snapshot] snapshot chainstate cleanup cannot happen with "
"in-memory chainstates. You are testing, right?\n");
return false;
}
@ -6501,7 +6501,7 @@ bool ChainstateManager::ValidatedSnapshotCleanup()
// No chainstates should be considered usable.
assert(this->GetAll().size() == 0);
LogPrintf("[snapshot] deleting background chainstate directory (now unnecessary) (%s)\n",
LogInfo("[snapshot] deleting background chainstate directory (now unnecessary) (%s)\n",
fs::PathToString(ibd_chainstate_path));
fs::path tmp_old{ibd_chainstate_path + "_todelete"};
@ -6525,7 +6525,7 @@ bool ChainstateManager::ValidatedSnapshotCleanup()
throw;
}
LogPrintf("[snapshot] moving snapshot chainstate (%s) to "
LogInfo("[snapshot] moving snapshot chainstate (%s) to "
"default chainstate directory (%s)\n",
fs::PathToString(snapshot_chainstate_path), fs::PathToString(ibd_chainstate_path));
@ -6539,11 +6539,11 @@ bool ChainstateManager::ValidatedSnapshotCleanup()
if (!DeleteCoinsDBFromDisk(tmp_old, /*is_snapshot=*/false)) {
// No need to FatalError 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 "
LogInfo("Deletion of %s failed. Please remove it manually, as the "
"directory is now unnecessary.\n",
fs::PathToString(tmp_old));
} else {
LogPrintf("[snapshot] deleted background chainstate directory (%s)\n",
LogInfo("[snapshot] deleted background chainstate directory (%s)\n",
fs::PathToString(ibd_chainstate_path));
}
return true;

View file

@ -115,7 +115,7 @@ void BerkeleyEnvironment::Close()
int ret = dbenv->close(0);
if (ret != 0)
LogPrintf("BerkeleyEnvironment::Close: Error %d closing database environment: %s\n", ret, DbEnv::strerror(ret));
LogInfo("BerkeleyEnvironment::Close: Error %d closing database environment: %s\n", ret, DbEnv::strerror(ret));
if (!fMockDb)
DbEnv(uint32_t{0}).remove(strPath.c_str(), 0);
@ -152,7 +152,7 @@ bool BerkeleyEnvironment::Open(bilingual_str& err)
fs::path pathIn = fs::PathFromString(strPath);
TryCreateDirectories(pathIn);
if (util::LockDirectory(pathIn, ".walletlock") != util::LockResult::Success) {
LogPrintf("Cannot obtain a lock on wallet directory %s. Another instance may be using it.\n", strPath);
LogInfo("Cannot obtain a lock on wallet directory %s. Another instance may be using it.\n", strPath);
err = strprintf(_("Error initializing wallet database environment %s!"), fs::quoted(fs::PathToString(Directory())));
return false;
}
@ -160,7 +160,7 @@ bool BerkeleyEnvironment::Open(bilingual_str& err)
fs::path pathLogDir = pathIn / "database";
TryCreateDirectories(pathLogDir);
fs::path pathErrorFile = pathIn / "db.log";
LogPrintf("BerkeleyEnvironment::Open: LogDir=%s ErrorFile=%s\n", fs::PathToString(pathLogDir), fs::PathToString(pathErrorFile));
LogInfo("BerkeleyEnvironment::Open: LogDir=%s ErrorFile=%s\n", fs::PathToString(pathLogDir), fs::PathToString(pathErrorFile));
unsigned int nEnvFlags = 0;
if (!m_use_shared_memory) {
@ -188,10 +188,10 @@ bool BerkeleyEnvironment::Open(bilingual_str& err)
nEnvFlags,
S_IRUSR | S_IWUSR);
if (ret != 0) {
LogPrintf("BerkeleyEnvironment::Open: Error %d opening database environment: %s\n", ret, DbEnv::strerror(ret));
LogInfo("BerkeleyEnvironment::Open: Error %d opening database environment: %s\n", ret, DbEnv::strerror(ret));
int ret2 = dbenv->close(0);
if (ret2 != 0) {
LogPrintf("BerkeleyEnvironment::Open: Error %d closing failed database environment: %s\n", ret2, DbEnv::strerror(ret2));
LogInfo("BerkeleyEnvironment::Open: Error %d closing failed database environment: %s\n", ret2, DbEnv::strerror(ret2));
}
Reset();
err = strprintf(_("Error initializing wallet database environment %s!"), fs::quoted(fs::PathToString(Directory())));
@ -317,8 +317,8 @@ bool BerkeleyDatabase::Verify(bilingual_str& errorStr)
fs::path walletDir = env->Directory();
fs::path file_path = walletDir / m_filename;
LogPrintf("Using BerkeleyDB version %s\n", BerkeleyDatabaseVersion());
LogPrintf("Using wallet %s\n", fs::PathToString(file_path));
LogInfo("Using BerkeleyDB version %s\n", BerkeleyDatabaseVersion());
LogInfo("Using wallet %s\n", fs::PathToString(file_path));
if (!env->Open(errorStr)) {
return false;
@ -525,7 +525,7 @@ bool BerkeleyDatabase::Rewrite(const char* pszSkip)
m_refcount = -1;
bool fSuccess = true;
LogPrintf("BerkeleyBatch::Rewrite: Rewriting %s...\n", strFile);
LogInfo("BerkeleyBatch::Rewrite: Rewriting %s...\n", strFile);
std::string strFileRes = strFile + ".rewrite";
{ // surround usage of db with extra {}
BerkeleyBatch db(*this, true);
@ -542,7 +542,7 @@ bool BerkeleyDatabase::Rewrite(const char* pszSkip)
DB_CREATE, // Flags
0);
if (ret > 0) {
LogPrintf("BerkeleyBatch::Rewrite: Can't create database file %s\n", strFileRes);
LogInfo("BerkeleyBatch::Rewrite: Can't create database file %s\n", strFileRes);
fSuccess = false;
}
@ -592,7 +592,7 @@ bool BerkeleyDatabase::Rewrite(const char* pszSkip)
fSuccess = false;
}
if (!fSuccess)
LogPrintf("BerkeleyBatch::Rewrite: Failed to rewrite database file %s\n", strFileRes);
LogInfo("BerkeleyBatch::Rewrite: Failed to rewrite database file %s\n", strFileRes);
return fSuccess;
}
}
@ -694,15 +694,15 @@ bool BerkeleyDatabase::Backup(const std::string& strDest) const
try {
if (fs::exists(pathDest) && fs::equivalent(pathSrc, pathDest)) {
LogPrintf("cannot backup to wallet source file %s\n", fs::PathToString(pathDest));
LogInfo("cannot backup to wallet source file %s\n", fs::PathToString(pathDest));
return false;
}
fs::copy_file(pathSrc, pathDest, fs::copy_options::overwrite_existing);
LogPrintf("copied %s to %s\n", strFile, fs::PathToString(pathDest));
LogInfo("copied %s to %s\n", strFile, fs::PathToString(pathDest));
return true;
} catch (const fs::filesystem_error& e) {
LogPrintf("error copying %s to %s - %s\n", strFile, fs::PathToString(pathDest), fsbridge::get_filesystem_error_message(e));
LogInfo("error copying %s to %s - %s\n", strFile, fs::PathToString(pathDest), fsbridge::get_filesystem_error_message(e));
return false;
}
}
@ -830,7 +830,7 @@ bool BerkeleyDatabaseSanityCheck()
* than the header that was compiled against, flag an error.
*/
if (major != DB_VERSION_MAJOR || minor < DB_VERSION_MINOR) {
LogPrintf("BerkeleyDB database version conflict: header version is %d.%d, library version is %d.%d\n",
LogInfo("BerkeleyDB database version conflict: header version is %d.%d, library version is %d.%d\n",
DB_VERSION_MAJOR, DB_VERSION_MINOR, major, minor);
return false;
}

View file

@ -29,9 +29,9 @@ std::vector<std::pair<fs::path, std::string>> ListDatabases(const fs::path& wall
if (ec) {
if (fs::is_directory(*it)) {
it.disable_recursion_pending();
LogPrintf("%s: %s %s -- skipping.\n", __func__, ec.message(), fs::PathToString(it->path()));
LogInfo("%s: %s %s -- skipping.\n", __func__, ec.message(), fs::PathToString(it->path()));
} else {
LogPrintf("%s: %s %s\n", __func__, ec.message(), fs::PathToString(it->path()));
LogInfo("%s: %s %s\n", __func__, ec.message(), fs::PathToString(it->path()));
}
continue;
}
@ -65,7 +65,7 @@ std::vector<std::pair<fs::path, std::string>> ListDatabases(const fs::path& wall
}
}
} catch (const std::exception& e) {
LogPrintf("%s: Error scanning %s: %s\n", __func__, fs::PathToString(it->path()), e.what());
LogInfo("%s: Error scanning %s: %s\n", __func__, fs::PathToString(it->path()), e.what());
it.disable_recursion_pending();
}
}
@ -100,7 +100,7 @@ bool IsBDBFile(const fs::path& path)
// This check also prevents opening lock files.
std::error_code ec;
auto size = fs::file_size(path, ec);
if (ec) LogPrintf("%s: %s %s\n", __func__, ec.message(), fs::PathToString(path));
if (ec) LogInfo("%s: %s %s\n", __func__, ec.message(), fs::PathToString(path));
if (size < 4096) return false;
std::ifstream file{path, std::ios::binary};
@ -124,7 +124,7 @@ bool IsSQLiteFile(const fs::path& path)
// A SQLite Database file is at least 512 bytes.
std::error_code ec;
auto size = fs::file_size(path, ec);
if (ec) LogPrintf("%s: %s %s\n", __func__, ec.message(), fs::PathToString(path));
if (ec) LogInfo("%s: %s %s\n", __func__, ec.message(), fs::PathToString(path));
if (size < 512) return false;
std::ifstream file{path, std::ios::binary};

View file

@ -109,14 +109,14 @@ bool WalletInit::ParameterInteraction() const
#endif
if (gArgs.GetBoolArg("-disablewallet", DEFAULT_DISABLE_WALLET)) {
for (const std::string& wallet : gArgs.GetArgs("-wallet")) {
LogPrintf("%s: parameter interaction: -disablewallet -> ignoring -wallet=%s\n", __func__, wallet);
LogInfo("%s: parameter interaction: -disablewallet -> ignoring -wallet=%s\n", __func__, wallet);
}
return true;
}
if (gArgs.GetBoolArg("-blocksonly", DEFAULT_BLOCKSONLY) && gArgs.SoftSetBoolArg("-walletbroadcast", false)) {
LogPrintf("%s: parameter interaction: -blocksonly=1 -> setting -walletbroadcast=0\n", __func__);
LogInfo("%s: parameter interaction: -blocksonly=1 -> setting -walletbroadcast=0\n", __func__);
}
return true;
@ -126,7 +126,7 @@ void WalletInit::Construct(NodeContext& node) const
{
ArgsManager& args = *Assert(node.args);
if (args.GetBoolArg("-disablewallet", DEFAULT_DISABLE_WALLET)) {
LogPrintf("Wallet disabled!\n");
LogInfo("Wallet disabled!\n");
return;
}
auto wallet_loader = node.init->makeWalletLoader(*node.chain);

View file

@ -50,7 +50,7 @@ bool VerifyWallets(WalletContext& context)
args.ForceSetArg("-walletdir", fs::PathToString(canonical_wallet_dir));
}
LogPrintf("Using wallet directory %s\n", fs::PathToString(GetWalletDir()));
LogInfo("Using wallet directory %s\n", fs::PathToString(GetWalletDir()));
chain.initMessage(_("Verifying wallet(s)…"));

View file

@ -714,15 +714,15 @@ bool BerkeleyRODatabase::Backup(const std::string& dest) const
}
try {
if (fs::exists(dst) && fs::equivalent(src, dst)) {
LogPrintf("cannot backup to wallet source file %s\n", fs::PathToString(dst));
LogInfo("cannot backup to wallet source file %s\n", fs::PathToString(dst));
return false;
}
fs::copy_file(src, dst, fs::copy_options::overwrite_existing);
LogPrintf("copied %s to %s\n", fs::PathToString(m_filepath), fs::PathToString(dst));
LogInfo("copied %s to %s\n", fs::PathToString(m_filepath), fs::PathToString(dst));
return true;
} catch (const fs::filesystem_error& e) {
LogPrintf("error copying %s to %s - %s\n", fs::PathToString(m_filepath), fs::PathToString(dst), fsbridge::get_filesystem_error_message(e));
LogInfo("error copying %s to %s - %s\n", fs::PathToString(m_filepath), fs::PathToString(dst), fsbridge::get_filesystem_error_message(e));
return false;
}
}

View file

@ -262,7 +262,7 @@ bool LegacyDataSPKM::CheckDecryptionKey(const CKeyingMaterial& master_key)
}
if (keyPass && keyFail)
{
LogPrintf("The wallet is probably corrupted: Some keys decrypt but not all.\n");
LogInfo("The wallet is probably corrupted: Some keys decrypt but not all.\n");
throw std::runtime_error("Error unlocking wallet: some keys decrypt but not all. Your wallet file may be corrupt.");
}
if (keyFail || !keyPass)
@ -1818,7 +1818,7 @@ std::optional<MigrationData> LegacyDataSPKM::MigrateToDescriptor()
WalletBatch batch(m_storage.GetDatabase());
if (!batch.TxnBegin()) {
LogPrintf("Error generating descriptors for migration, cannot initialize db transaction\n");
LogInfo("Error generating descriptors for migration, cannot initialize db transaction\n");
return std::nullopt;
}
@ -2000,7 +2000,7 @@ std::optional<MigrationData> LegacyDataSPKM::MigrateToDescriptor()
// Make sure that we have accounted for all scriptPubKeys
if (!Assume(spks.empty())) {
LogPrintf("%s\n", STR_INTERNAL_BUG("Error: Some output scripts were not migrated.\n"));
LogInfo("%s\n", STR_INTERNAL_BUG("Error: Some output scripts were not migrated.\n"));
return std::nullopt;
}
@ -2054,7 +2054,7 @@ std::optional<MigrationData> LegacyDataSPKM::MigrateToDescriptor()
// Finalize transaction
if (!batch.TxnCommit()) {
LogPrintf("Error generating descriptors for migration, cannot commit db transaction\n");
LogInfo("Error generating descriptors for migration, cannot commit db transaction\n");
return std::nullopt;
}
@ -2144,7 +2144,7 @@ bool DescriptorScriptPubKeyMan::CheckDecryptionKey(const CKeyingMaterial& master
break;
}
if (keyPass && keyFail) {
LogPrintf("The wallet is probably corrupted: Some keys decrypt but not all.\n");
LogInfo("The wallet is probably corrupted: Some keys decrypt but not all.\n");
throw std::runtime_error("Error unlocking wallet: some keys decrypt but not all. Your wallet file may be corrupt.");
}
if (keyFail || !keyPass) {

View file

@ -40,7 +40,7 @@ static void ErrorLogCallback(void* arg, int code, const char* msg)
// invoked."
// Assert that this is the case:
assert(arg == nullptr);
LogPrintf("SQLite Error. Code: %d. Message: %s\n", code, msg);
LogInfo("SQLite Error. Code: %d. Message: %s\n", code, msg);
}
static int TraceSqlCallback(unsigned code, void* context, void* param1, void* param2)
@ -69,7 +69,7 @@ static bool BindBlobToStatement(sqlite3_stmt* stmt,
// instead of the empty blob value X'', which would mess up SQL comparisons.
int res = sqlite3_bind_blob(stmt, index, blob.data() ? static_cast<const void*>(blob.data()) : "", blob.size(), SQLITE_STATIC);
if (res != SQLITE_OK) {
LogPrintf("Unable to bind %s to statement: %s\n", description, sqlite3_errstr(res));
LogInfo("Unable to bind %s to statement: %s\n", description, sqlite3_errstr(res));
sqlite3_clear_bindings(stmt);
sqlite3_reset(stmt);
return false;
@ -116,8 +116,8 @@ SQLiteDatabase::SQLiteDatabase(const fs::path& dir_path, const fs::path& file_pa
{
{
LOCK(g_sqlite_mutex);
LogPrintf("Using SQLite Version %s\n", SQLiteDatabaseVersion());
LogPrintf("Using wallet %s\n", m_dir_path);
LogInfo("Using SQLite Version %s\n", SQLiteDatabaseVersion());
LogInfo("Using wallet %s\n", m_dir_path);
if (++g_sqlite_count == 1) {
// Setup logging
@ -182,7 +182,7 @@ void SQLiteDatabase::Cleanup() noexcept
if (--g_sqlite_count == 0) {
int ret = sqlite3_shutdown();
if (ret != SQLITE_OK) {
LogPrintf("SQLiteDatabase: Failed to shutdown SQLite: %s\n", sqlite3_errstr(ret));
LogInfo("SQLiteDatabase: Failed to shutdown SQLite: %s\n", sqlite3_errstr(ret));
}
}
}
@ -267,7 +267,7 @@ void SQLiteDatabase::Open()
if (LogAcceptCategory(BCLog::WALLETDB, BCLog::Level::Trace)) {
ret = sqlite3_trace_v2(m_db, SQLITE_TRACE_STMT, TraceSqlCallback, this);
if (ret != SQLITE_OK) {
LogPrintf("Failed to enable SQL tracing for %s\n", Filename());
LogInfo("Failed to enable SQL tracing for %s\n", Filename());
}
}
}
@ -294,7 +294,7 @@ void SQLiteDatabase::Open()
if (m_use_unsafe_sync) {
// Use normal synchronous mode for the journal
LogPrintf("WARNING SQLite is configured to not wait for data to be flushed to disk. Data loss and corruption may occur.\n");
LogInfo("WARNING SQLite is configured to not wait for data to be flushed to disk. Data loss and corruption may occur.\n");
SetPragma(m_db, "synchronous", "OFF", "Failed to set synchronous mode to OFF");
}
@ -353,14 +353,14 @@ bool SQLiteDatabase::Backup(const std::string& dest) const
}
sqlite3_backup* backup = sqlite3_backup_init(db_copy, "main", m_db, "main");
if (!backup) {
LogPrintf("%s: Unable to begin backup: %s\n", __func__, sqlite3_errmsg(m_db));
LogInfo("%s: Unable to begin backup: %s\n", __func__, sqlite3_errmsg(m_db));
sqlite3_close(db_copy);
return false;
}
// Specifying -1 will copy all of the pages
res = sqlite3_backup_step(backup, -1);
if (res != SQLITE_DONE) {
LogPrintf("%s: Unable to backup: %s\n", __func__, sqlite3_errstr(res));
LogInfo("%s: Unable to backup: %s\n", __func__, sqlite3_errstr(res));
sqlite3_backup_finish(backup);
sqlite3_close(db_copy);
return false;
@ -412,13 +412,13 @@ void SQLiteBatch::Close()
// If we began a transaction, and it wasn't committed, abort the transaction in progress
if (m_txn) {
if (TxnAbort()) {
LogPrintf("SQLiteBatch: Batch closed unexpectedly without the transaction being explicitly committed or aborted\n");
LogInfo("SQLiteBatch: Batch closed unexpectedly without the transaction being explicitly committed or aborted\n");
} else {
// If transaction cannot be aborted, it means there is a bug or there has been data corruption. Try to recover in this case
// by closing and reopening the database. Closing the database should also ensure that any changes made since the transaction
// was opened will be rolled back and future transactions can succeed without committing old data.
force_conn_refresh = true;
LogPrintf("SQLiteBatch: Batch closed and failed to abort transaction, resetting db connection..\n");
LogInfo("SQLiteBatch: Batch closed and failed to abort transaction, resetting db connection..\n");
}
}
@ -434,7 +434,7 @@ void SQLiteBatch::Close()
for (const auto& [stmt_prepared, stmt_description] : statements) {
int res = sqlite3_finalize(*stmt_prepared);
if (res != SQLITE_OK) {
LogPrintf("SQLiteBatch: Batch closed but could not finalize %s statement: %s\n",
LogInfo("SQLiteBatch: Batch closed but could not finalize %s statement: %s\n",
stmt_description, sqlite3_errstr(res));
}
*stmt_prepared = nullptr;
@ -465,7 +465,7 @@ bool SQLiteBatch::ReadKey(DataStream&& key, DataStream& value)
if (res != SQLITE_ROW) {
if (res != SQLITE_DONE) {
// SQLITE_DONE means "not found", don't log an error in that case.
LogPrintf("%s: Unable to execute statement: %s\n", __func__, sqlite3_errstr(res));
LogInfo("%s: Unable to execute statement: %s\n", __func__, sqlite3_errstr(res));
}
sqlite3_clear_bindings(m_read_stmt);
sqlite3_reset(m_read_stmt);
@ -505,7 +505,7 @@ bool SQLiteBatch::WriteKey(DataStream&& key, DataStream&& value, bool overwrite)
sqlite3_clear_bindings(stmt);
sqlite3_reset(stmt);
if (res != SQLITE_DONE) {
LogPrintf("%s: Unable to execute statement: %s\n", __func__, sqlite3_errstr(res));
LogInfo("%s: Unable to execute statement: %s\n", __func__, sqlite3_errstr(res));
}
if (!m_txn) m_database.m_write_semaphore.post();
@ -529,7 +529,7 @@ bool SQLiteBatch::ExecStatement(sqlite3_stmt* stmt, Span<const std::byte> blob)
sqlite3_clear_bindings(stmt);
sqlite3_reset(stmt);
if (res != SQLITE_DONE) {
LogPrintf("%s: Unable to execute statement: %s\n", __func__, sqlite3_errstr(res));
LogInfo("%s: Unable to execute statement: %s\n", __func__, sqlite3_errstr(res));
}
if (!m_txn) m_database.m_write_semaphore.post();
@ -567,7 +567,7 @@ DatabaseCursor::Status SQLiteCursor::Next(DataStream& key, DataStream& value)
return Status::DONE;
}
if (res != SQLITE_ROW) {
LogPrintf("%s: Unable to execute cursor step: %s\n", __func__, sqlite3_errstr(res));
LogInfo("%s: Unable to execute cursor step: %s\n", __func__, sqlite3_errstr(res));
return Status::FAIL;
}
@ -586,7 +586,7 @@ SQLiteCursor::~SQLiteCursor()
sqlite3_reset(m_cursor_stmt);
int res = sqlite3_finalize(m_cursor_stmt);
if (res != SQLITE_OK) {
LogPrintf("%s: cursor closed but could not finalize cursor statement: %s\n",
LogInfo("%s: cursor closed but could not finalize cursor statement: %s\n",
__func__, sqlite3_errstr(res));
}
}
@ -655,7 +655,7 @@ bool SQLiteBatch::TxnBegin()
Assert(!m_database.HasActiveTxn());
int res = Assert(m_exec_handler)->Exec(m_database, "BEGIN TRANSACTION");
if (res != SQLITE_OK) {
LogPrintf("SQLiteBatch: Failed to begin the transaction\n");
LogInfo("SQLiteBatch: Failed to begin the transaction\n");
m_database.m_write_semaphore.post();
} else {
m_txn = true;
@ -669,7 +669,7 @@ bool SQLiteBatch::TxnCommit()
Assert(m_database.HasActiveTxn());
int res = Assert(m_exec_handler)->Exec(m_database, "COMMIT TRANSACTION");
if (res != SQLITE_OK) {
LogPrintf("SQLiteBatch: Failed to commit the transaction\n");
LogInfo("SQLiteBatch: Failed to commit the transaction\n");
} else {
m_txn = false;
m_database.m_write_semaphore.post();
@ -683,7 +683,7 @@ bool SQLiteBatch::TxnAbort()
Assert(m_database.HasActiveTxn());
int res = Assert(m_exec_handler)->Exec(m_database, "ROLLBACK TRANSACTION");
if (res != SQLITE_OK) {
LogPrintf("SQLiteBatch: Failed to abort the transaction\n");
LogInfo("SQLiteBatch: Failed to abort the transaction\n");
} else {
m_txn = false;
m_database.m_write_semaphore.post();