mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-21 07:39:08 +01:00
scripted-diff: LogPrintf -> LogInfo
This refactor does not change behavior. -BEGIN VERIFY SCRIPT- sed --in-place 's/\<LogPrintf\>/LogInfo/g' \ $( git grep -l '\<LogPrintf\>' -- ./contrib/ ./src/ ./test/ ':(exclude)src/logging.h' ) -END VERIFY SCRIPT-
This commit is contained in:
@@ -860,7 +860,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -873,7 +873,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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -30,7 +30,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.
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
56
src/net.cpp
56
src/net.cpp
@@ -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);
|
||||
}
|
||||
|
||||
@@ -421,7 +421,7 @@ CNode* CConnman::ConnectNode(CAddress addrConnect,
|
||||
// It is possible that we already have a connection to the IP/port pszDest resolved to.
|
||||
// In that case, drop the connection that was just created.
|
||||
if (AlreadyConnectedToAddressPort(addrConnect)) {
|
||||
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
|
||||
@@ -1739,7 +1739,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;
|
||||
}
|
||||
@@ -1785,7 +1785,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;
|
||||
}
|
||||
|
||||
@@ -2258,7 +2258,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 (!m_interrupt_net->interrupted()) {
|
||||
if (!m_interrupt_net->sleep_for(500ms)) {
|
||||
return;
|
||||
@@ -2267,13 +2267,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;
|
||||
}
|
||||
}
|
||||
@@ -2316,7 +2316,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
|
||||
@@ -2328,10 +2328,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;
|
||||
}
|
||||
@@ -2343,13 +2343,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 (!m_interrupt_net->sleep_for(1s)) 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()) {
|
||||
@@ -2385,9 +2385,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");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2568,7 +2568,7 @@ void CConnman::ThreadOpenConnections(const std::vector<std::string> connect, std
|
||||
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 (!m_interrupt_net->interrupted()) {
|
||||
@@ -2607,7 +2607,7 @@ void CConnman::ThreadOpenConnections(const std::vector<std::string> connect, std
|
||||
// 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.
|
||||
@@ -2615,7 +2615,7 @@ void CConnman::ThreadOpenConnections(const std::vector<std::string> connect, std
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2634,7 +2634,7 @@ void CConnman::ThreadOpenConnections(const std::vector<std::string> connect, std
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3158,7 +3158,7 @@ bool CConnman::BindListenPort(const CService& addrBind, bilingual_str& strError,
|
||||
// the program was closed and restarted.
|
||||
if (sock->SetSockOpt(SOL_SOCKET, SO_REUSEADDR, &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
|
||||
@@ -3167,14 +3167,14 @@ bool CConnman::BindListenPort(const CService& addrBind, bilingual_str& strError,
|
||||
#ifdef IPV6_V6ONLY
|
||||
if (sock->SetSockOpt(IPPROTO_IPV6, IPV6_V6ONLY, &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, &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
|
||||
}
|
||||
@@ -3188,7 +3188,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)
|
||||
@@ -3209,13 +3209,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;
|
||||
@@ -3350,7 +3350,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) {
|
||||
@@ -3384,7 +3384,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(); });
|
||||
|
||||
|
||||
@@ -3494,7 +3494,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;
|
||||
}
|
||||
@@ -3663,7 +3663,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,
|
||||
@@ -4285,10 +4285,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(txid)) {
|
||||
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",
|
||||
txid.ToString(), wtxid.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",
|
||||
txid.ToString(), wtxid.ToString(), pfrom.GetId());
|
||||
RelayTransaction(txid, wtxid);
|
||||
}
|
||||
@@ -5236,7 +5236,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()) {
|
||||
|
||||
@@ -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});
|
||||
|
||||
@@ -416,7 +416,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) {
|
||||
@@ -543,7 +543,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;
|
||||
}
|
||||
|
||||
@@ -552,14 +552,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, &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;
|
||||
}
|
||||
|
||||
@@ -585,7 +585,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);
|
||||
}
|
||||
@@ -605,7 +605,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;
|
||||
@@ -622,7 +622,7 @@ static bool ConnectToSocket(const Sock& sock, struct sockaddr* sockaddr, socklen
|
||||
socklen_t sockerr_len = sizeof(sockerr);
|
||||
if (sock.GetSockOpt(SOL_SOCKET, SO_ERROR, &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) {
|
||||
@@ -658,7 +658,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 {};
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -170,7 +170,7 @@ std::unique_ptr<CBlockTemplate> BlockAssembler::CreateNewBlock()
|
||||
pblock->vtx[0] = MakeTransactionRef(std::move(coinbaseTx));
|
||||
pblocktemplate->vchCoinbaseCommitment = m_chainstate.m_chainman.GenerateCoinbaseCommitment(*pblock, pindexPrev);
|
||||
|
||||
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();
|
||||
@@ -227,7 +227,7 @@ void BlockAssembler::AddToBlock(const CTxMemPoolEntry& entry)
|
||||
nFees += entry.GetFee();
|
||||
|
||||
if (m_options.print_modified_fee) {
|
||||
LogPrintf("fee rate %s txid %s\n",
|
||||
LogInfo("fee rate %s txid %s\n",
|
||||
CFeeRate(entry.GetModifiedFee(), entry.GetTxSize()).ToString(),
|
||||
entry.GetTx().GetHash().ToString());
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ BOOST_FIXTURE_TEST_CASE(logging_LogPrintStr, LogSetup)
|
||||
BOOST_FIXTURE_TEST_CASE(logging_LogPrintMacrosDeprecated, LogSetup)
|
||||
{
|
||||
LogInstance().EnableCategory(BCLog::NET);
|
||||
LogPrintf("foo5: %s\n", "bar5");
|
||||
LogInfo("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");
|
||||
|
||||
@@ -706,7 +706,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);
|
||||
|
||||
@@ -626,9 +626,9 @@ void CTxMemPool::PrioritiseTransaction(const Txid& hash, const CAmount& nFeeDelt
|
||||
}
|
||||
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),
|
||||
|
||||
@@ -191,7 +191,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;
|
||||
}
|
||||
}
|
||||
@@ -1987,12 +1987,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();
|
||||
@@ -2705,7 +2705,7 @@ CoinsCacheSizeState Chainstate::GetCoinsCacheSizeState(
|
||||
max_coins_cache_size_bytes + std::max<int64_t>(int64_t(max_mempool_size_bytes) - nMempoolUsage, 0);
|
||||
|
||||
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 > LargeCoinsCacheThreshold(nTotalSpace)) {
|
||||
return CoinsCacheSizeState::LARGE;
|
||||
|
||||
@@ -723,7 +723,7 @@ bool BerkeleyRODatabase::Backup(const std::string& dest) const
|
||||
}
|
||||
|
||||
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) {
|
||||
LogWarning("error copying %s to %s - %s\n", fs::PathToString(m_filepath), fs::PathToString(dst), e.code().message());
|
||||
|
||||
Reference in New Issue
Block a user