scripted-diff: LogPrintLevel(*,BCLog::Level::*,*) -> LogError()/LogWarning()
What changed, and why it matters
This commit is a purely cosmetic logging refactor. It changes the way some error and warning messages are written in the source code so that the resulting log output drops the source module prefix (like '[net:error]') and instead shows just '[error]' or '[warning]'. There is no change to program behavior, no bug fix, and no security issue.
No security action needed. Treat as a normal code-cleanup/refactor commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
A scripted diff replaces calls of the form LogPrintLevel(BCLog::
Changed components
src/common/netif.cppsrc/common/pcp.cppsrc/i2p.cppsrc/mapport.cppsrc/net.cppsrc/netbase.cppsrc/node/blockstorage.cppsrc/txdb.cppsrc/validation.cppInspect captured patch +44 / −44
diff --git a/src/common/netif.cpp b/src/common/netif.cpp
index 378f0f57..ed891f12 100644
--- a/src/common/netif.cpp
+++ b/src/common/netif.cpp
@@ -73,7 +73,7 @@ std::optional<CNetAddr> QueryDefaultGatewayImpl(sa_family_t family)
// Create a netlink socket.
auto sock{CreateSock(AF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE)};
if (!sock) {
- LogPrintLevel(BCLog::NET, BCLog::Level::Error, "socket(AF_NETLINK): %s\n", NetworkErrorString(errno));
+ LogError("socket(AF_NETLINK): %s\n", NetworkErrorString(errno));
return std::nullopt;
}
@@ -110,7 +110,7 @@ std::optional<CNetAddr> QueryDefaultGatewayImpl(sa_family_t family)
request.dst_hdr.nla_len = sizeof(nlattr) + dst_data_len;
if (sock->Send(&request, request.hdr.nlmsg_len, 0) != static_cast<ssize_t>(request.hdr.nlmsg_len)) {
- LogPrintLevel(BCLog::NET, BCLog::Level::Error, "send() to netlink socket: %s\n", NetworkErrorString(errno));
+ LogError("send() to netlink socket: %s\n", NetworkErrorString(errno));
return std::nullopt;
}
@@ -124,13 +124,13 @@ std::optional<CNetAddr> QueryDefaultGatewayImpl(sa_family_t family)
recv_result = sock->Recv(response, sizeof(response), 0);
} while (recv_result < 0 && (errno == EINTR || errno == EAGAIN));
if (recv_result < 0) {
- LogPrintLevel(BCLog::NET, BCLog::Level::Error, "recv() from netlink socket: %s\n", NetworkErrorString(errno));
+ LogError("recv() from netlink socket: %s\n", NetworkErrorString(errno));
return std::nullopt;
}
total_bytes_read += recv_result;
if (total_bytes_read > NETLINK_MAX_RESPONSE_SIZE) {
- LogPrintLevel(BCLog::NET, BCLog::Level::Warning, "Netlink response exceeded size limit (%zu bytes, family=%d)\n", NETLINK_MAX_RESPONSE_SIZE, family);
+ LogWarning("Netlink response exceeded size limit (%zu bytes, family=%d)\n", NETLINK_MAX_RESPONSE_SIZE, family);
return std::nullopt;
}
@@ -200,7 +200,7 @@ std::optional<CNetAddr> QueryDefaultGatewayImpl(sa_family_t family)
destination_address.si_family = family;
status = GetBestInterfaceEx((sockaddr*)&destination_address, &best_if_idx);
if (status != NO_ERROR) {
- LogPrintLevel(BCLog::NET, BCLog::Level::Error, "Could not get best interface for default route: %s\n", NetworkErrorString(status));
+ LogError("Could not get best interface for default route: %s\n", NetworkErrorString(status));
return std::nullopt;
}
@@ -208,7 +208,7 @@ std::optional<CNetAddr> QueryDefaultGatewayImpl(sa_family_t family)
// Leave interface_luid at all-zeros to use interface index instead.
status = GetBestRoute2(&interface_luid, best_if_idx, nullptr, &destination_address, 0, &best_route, &best_source_address);
if (status != NO_ERROR) {
- LogPrintLevel(BCLog::NET, BCLog::Level::Error, "Could not get best route for default route for interface index %d: %s\n",
+ LogError("Could not get best route for default route for interface index %d: %s\n",
best_if_idx, NetworkErrorString(status));
return std::nullopt;
}
@@ -235,12 +235,12 @@ std::optional<CNetAddr> QueryDefaultGatewayImpl(sa_family_t family)
// The size of the available data is determined by calling sysctl() with oldp=nullptr. See sysctl(3).
size_t l = 0;
if (sysctl(/*name=*/mib, /*namelen=*/sizeof(mib) / sizeof(int), /*oldp=*/nullptr, /*oldlenp=*/&l, /*newp=*/nullptr, /*newlen=*/0) < 0) {
- LogPrintLevel(BCLog::NET, BCLog::Level::Error, "Could not get sysctl length of routing table: %s\n", SysErrorString(errno));
+ LogError("Could not get sysctl length of routing table: %s\n", SysErrorString(errno));
return std::nullopt;
}
std::vector<std::byte> buf(l);
if (sysctl(/*name=*/mib, /*namelen=*/sizeof(mib) / sizeof(int), /*oldp=*/buf.data(), /*oldlenp=*/&l, /*newp=*/nullptr, /*newlen=*/0) < 0) {
- LogPrintLevel(BCLog::NET, BCLog::Level::Error, "Could not get sysctl data of routing table: %s\n", SysErrorString(errno));
+ LogError("Could not get sysctl data of routing table: %s\n", SysErrorString(errno));
return std::nullopt;
}
// Iterate over messages (each message is a routing table entry).
@@ -340,7 +340,7 @@ std::vector<CNetAddr> GetLocalAddresses()
if (status != NO_ERROR) {
// This includes ERROR_NO_DATA if there are no addresses and thus there's not even one PIP_ADAPTER_ADDRESSES
// record in the returned structure.
- LogPrintLevel(BCLog::NET, BCLog::Level::Error, "Could not get local adapter addresses: %s\n", NetworkErrorString(status));
+ LogError("Could not get local adapter addresses: %s\n", NetworkErrorString(status));
return addresses;
}
diff --git a/src/common/pcp.cpp b/src/common/pcp.cpp
index b2e3ec7e..4864136b 100644
--- a/src/common/pcp.cpp
+++ b/src/common/pcp.cpp
@@ -243,7 +243,7 @@ std::optional<std::vector<uint8_t>> PCPSendRecv(Sock &sock, const std::string &p
if (interrupt) return std::nullopt;
Sock::Event occurred = 0;
if (!sock.Wait(deadline - cur_time, Sock::RECV, &occurred)) {
- LogPrintLevel(BCLog::NET, BCLog::Level::Warning, "%s: Could not wait on socket: %s\n", protocol, NetworkErrorString(WSAGetLastError()));
+ LogWarning("%s: Could not wait on socket: %s\n", protocol, NetworkErrorString(WSAGetLastError()));
return std::nullopt; // Network-level error, probably no use retrying.
}
if (!occurred) {
@@ -288,13 +288,13 @@ std::variant<MappingResult, MappingError> NATPMPRequestPortMap(const CNetAddr &g
// Create IPv4 UDP socket
auto sock{CreateSock(AF_INET, SOCK_DGRAM, IPPROTO_UDP)};
if (!sock) {
- LogPrintLevel(BCLog::NET, BCLog::Level::Warning, "natpmp: Could not create UDP socket: %s\n", NetworkErrorString(WSAGetLastError()));
+ LogWarning("natpmp: Could not create UDP socket: %s\n", NetworkErrorString(WSAGetLastError()));
return MappingError::NETWORK_ERROR;
}
// Associate UDP socket to gateway.
if (sock->Connect((struct sockaddr*)&dest_addr, dest_addrlen) != 0) {
- LogPrintLevel(BCLog::NET, BCLog::Level::Warning, "natpmp: Could not connect to gateway: %s\n", NetworkErrorString(WSAGetLastError()));
+ LogWarning("natpmp: Could not connect to gateway: %s\n", NetworkErrorString(WSAGetLastError()));
return MappingError::NETWORK_ERROR;
}
@@ -302,7 +302,7 @@ std::variant<MappingResult, MappingError> NATPMPRequestPortMap(const CNetAddr &g
struct sockaddr_in internal;
socklen_t internal_addrlen = sizeof(struct sockaddr_in);
if (sock->GetSockName((struct sockaddr*)&internal, &internal_addrlen) != 0) {
- LogPrintLevel(BCLog::NET, BCLog::Level::Warning, "natpmp: Could not get sock name: %s\n", NetworkErrorString(WSAGetLastError()));
+ LogWarning("natpmp: Could not get sock name: %s\n", NetworkErrorString(WSAGetLastError()));
return MappingError::NETWORK_ERROR;
}
@@ -314,11 +314,11 @@ std::variant<MappingResult, MappingError> NATPMPRequestPortMap(const CNetAddr &g
auto recv_res = PCPSendRecv(*sock, "natpmp", request, num_tries, timeout_per_try,
[&](const std::span<const uint8_t> response) -> bool {
if (response.size() < NATPMP_GETEXTERNAL_RESPONSE_SIZE) {
- LogPrintLevel(BCLog::NET, BCLog::Level::Warning, "natpmp: Response too small\n");
+ LogWarning("natpmp: Response too small\n");
return false; // Wasn't response to what we expected, try receiving next packet.
}
if (response[NATPMP_HDR_VERSION_OFS] != NATPMP_VERSION || response[NATPMP_HDR_OP_OFS] != (NATPMP_RESPONSE | NATPMP_OP_GETEXTERNAL)) {
- LogPrintLevel(BCLog::NET, BCLog::Level::Warning, "natpmp: Response to wrong command\n");
+ LogWarning("natpmp: Response to wrong command\n");
return false; // Wasn't response to what we expected, try receiving next packet.
}
return true;
@@ -332,7 +332,7 @@ std::variant<MappingResult, MappingError> NATPMPRequestPortMap(const CNetAddr &g
Assume(response.size() >= NATPMP_GETEXTERNAL_RESPONSE_SIZE);
uint16_t result_code = ReadBE16(response.data() + NATPMP_RESPONSE_HDR_RESULT_OFS);
if (result_code != NATPMP_RESULT_SUCCESS) {
- LogPrintLevel(BCLog::NET, BCLog::Level::Warning, "natpmp: Getting external address failed with result %s\n", NATPMPResultString(result_code));
+ LogWarning("natpmp: Getting external address failed with result %s\n", NATPMPResultString(result_code));
return MappingError::PROTOCOL_ERROR;
}
@@ -352,16 +352,16 @@ std::variant<MappingResult, MappingError> NATPMPRequestPortMap(const CNetAddr &g
recv_res = PCPSendRecv(*sock, "natpmp", request, num_tries, timeout_per_try,
[&](const std::span<const uint8_t> response) -> bool {
if (response.size() < NATPMP_MAP_RESPONSE_SIZE) {
- LogPrintLevel(BCLog::NET, BCLog::Level::Warning, "natpmp: Response too small\n");
+ LogWarning("natpmp: Response too small\n");
return false; // Wasn't response to what we expected, try receiving next packet.
}
if (response[0] != NATPMP_VERSION || response[1] != (NATPMP_RESPONSE | NATPMP_OP_MAP_TCP)) {
- LogPrintLevel(BCLog::NET, BCLog::Level::Warning, "natpmp: Response to wrong command\n");
+ LogWarning("natpmp: Response to wrong command\n");
return false; // Wasn't response to what we expected, try receiving next packet.
}
uint16_t internal_port = ReadBE16(response.data() + NATPMP_MAP_RESPONSE_INTERNAL_PORT_OFS);
if (internal_port != port) {
- LogPrintLevel(BCLog::NET, BCLog::Level::Warning, "natpmp: Response port doesn't match request\n");
+ LogWarning("natpmp: Response port doesn't match request\n");
return false; // Wasn't response to what we expected, try receiving next packet.
}
return true;
@@ -374,7 +374,7 @@ std::variant<MappingResult, MappingError> NATPMPRequestPortMap(const CNetAddr &g
Assume(response.size() >= NATPMP_MAP_RESPONSE_SIZE);
uint16_t result_code = ReadBE16(response.data() + NATPMP_RESPONSE_HDR_RESULT_OFS);
if (result_code != NATPMP_RESULT_SUCCESS) {
- LogPrintLevel(BCLog::NET, BCLog::Level::Warning, "natpmp: Port mapping failed with result %s\n", NATPMPResultString(result_code));
+ LogWarning("natpmp: Port mapping failed with result %s\n", NATPMPResultString(result_code));
if (result_code == NATPMP_RESULT_NO_RESOURCES) {
return MappingError::NO_RESOURCES;
}
@@ -404,20 +404,20 @@ std::variant<MappingResult, MappingError> PCPRequestPortMap(const PCPMappingNonc
// Create UDP socket (IPv4 or IPv6 based on provided gateway).
auto sock{CreateSock(dest_addr.ss_family, SOCK_DGRAM, IPPROTO_UDP)};
if (!sock) {
- LogPrintLevel(BCLog::NET, BCLog::Level::Warning, "pcp: Could not create UDP socket: %s\n", NetworkErrorString(WSAGetLastError()));
+ LogWarning("pcp: Could not create UDP socket: %s\n", NetworkErrorString(WSAGetLastError()));
return MappingError::NETWORK_ERROR;
}
// Make sure that we send from requested destination address, anything else will be
// rejected by a security-conscious router.
if (sock->Bind((struct sockaddr*)&bind_addr, bind_addrlen) != 0) {
- LogPrintLevel(BCLog::NET, BCLog::Level::Warning, "pcp: Could not bind to address: %s\n", NetworkErrorString(WSAGetLastError()));
+ LogWarning("pcp: Could not bind to address: %s\n", NetworkErrorString(WSAGetLastError()));
return MappingError::NETWORK_ERROR;
}
// Associate UDP socket to gateway.
if (sock->Connect((struct sockaddr*)&dest_addr, dest_addrlen) != 0) {
- LogPrintLevel(BCLog::NET, BCLog::Level::Warning, "pcp: Could not connect to gateway: %s\n", NetworkErrorString(WSAGetLastError()));
+ LogWarning("pcp: Could not connect to gateway: %s\n", NetworkErrorString(WSAGetLastError()));
return MappingError::NETWORK_ERROR;
}
@@ -427,7 +427,7 @@ std::variant<MappingResult, MappingError> PCPRequestPortMap(const PCPMappingNonc
struct sockaddr_storage internal_addr;
socklen_t internal_addrlen = sizeof(struct sockaddr_storage);
if (sock->GetSockName((struct sockaddr*)&internal_addr, &internal_addrlen) != 0) {
- LogPrintLevel(BCLog::NET, BCLog::Level::Warning, "pcp: Could not get sock name: %s\n", NetworkErrorString(WSAGetLastError()));
+ LogWarning("pcp: Could not get sock name: %s\n", NetworkErrorString(WSAGetLastError()));
return MappingError::NETWORK_ERROR;
}
CService internal;
@@ -469,23 +469,23 @@ std::variant<MappingResult, MappingError> PCPRequestPortMap(const PCPMappingNonc
return true; // Let it through to caller.
}
if (response.size() < (PCP_HDR_SIZE + PCP_MAP_SIZE)) {
- LogPrintLevel(BCLog::NET, BCLog::Level::Warning, "pcp: Response too small\n");
+ LogWarning("pcp: Response too small\n");
return false; // Wasn't response to what we expected, try receiving next packet.
}
if (response[PCP_HDR_VERSION_OFS] != PCP_VERSION || response[PCP_HDR_OP_OFS] != (PCP_RESPONSE | PCP_OP_MAP)) {
- LogPrintLevel(BCLog::NET, BCLog::Level::Warning, "pcp: Response to wrong command\n");
+ LogWarning("pcp: Response to wrong command\n");
return false; // Wasn't response to what we expected, try receiving next packet.
}
// Handle MAP opcode response. See RFC6887 Figure 10.
// Check that returned mapping nonce matches our request.
if (!std::ranges::equal(response.subspan(PCP_HDR_SIZE + PCP_MAP_NONCE_OFS, PCP_MAP_NONCE_SIZE), nonce)) {
- LogPrintLevel(BCLog::NET, BCLog::Level::Warning, "pcp: Mapping nonce mismatch\n");
+ LogWarning("pcp: Mapping nonce mismatch\n");
return false; // Wasn't response to what we expected, try receiving next packet.
}
uint8_t protocol = response[PCP_HDR_SIZE + 12];
uint16_t internal_port = ReadBE16(response.data() + PCP_HDR_SIZE + 16);
if (protocol != PCP_PROTOCOL_TCP || internal_port != port) {
- LogPrintLevel(BCLog::NET, BCLog::Level::Warning, "pcp: Response protocol or port doesn't match request\n");
+ LogWarning("pcp: Response protocol or port doesn't match request\n");
return false; // Wasn't response to what we expected, try receiving next packet.
}
return true;
@@ -508,7 +508,7 @@ std::variant<MappingResult, MappingError> PCPRequestPortMap(const PCPMappingNonc
uint16_t external_port = ReadBE16(response.data() + PCP_HDR_SIZE + PCP_MAP_EXTERNAL_PORT_OFS);
CNetAddr external_addr{PCPUnwrapAddress(response.subspan(PCP_HDR_SIZE + PCP_MAP_EXTERNAL_IP_OFS, ADDR_IPV6_SIZE))};
if (result_code != PCP_RESULT_SUCCESS) {
- LogPrintLevel(BCLog::NET, BCLog::Level::Warning, "pcp: Mapping failed with result %s\n", PCPResultString(result_code));
+ LogWarning("pcp: Mapping failed with result %s\n", PCPResultString(result_code));
if (result_code == PCP_RESULT_NO_RESOURCES) {
return MappingError::NO_RESOURCES;
}
diff --git a/src/i2p.cpp b/src/i2p.cpp
index ac7670ea..b4357470 100644
--- a/src/i2p.cpp
+++ b/src/i2p.cpp
@@ -149,7 +149,7 @@ bool Session::Listen(Connection& conn)
conn.sock = StreamAccept();
return true;
} catch (const std::runtime_error& e) {
- LogPrintLevel(BCLog::I2P, BCLog::Level::Error, "Couldn't listen: %s\n", e.what());
+ LogError("Couldn't listen: %s\n", e.what());
CheckControlSock();
}
return false;
diff --git a/src/mapport.cpp b/src/mapport.cpp
index f6df4fb5..e71bb1af 100644
--- a/src/mapport.cpp
+++ b/src/mapport.cpp
@@ -100,12 +100,12 @@ static void ProcessPCP()
// Log message if we got NO_RESOURCES.
if (no_resources) {
- LogPrintLevel(BCLog::NET, BCLog::Level::Warning, "portmap: At least one mapping failed because of a NO_RESOURCES error. This usually indicates that the port is already used on the router. If this is the only instance of bitcoin running on the network, this will resolve itself automatically. Otherwise, you might want to choose a different P2P port to prevent this conflict.\n");
+ LogWarning("portmap: At least one mapping failed because of a NO_RESOURCES error. This usually indicates that the port is already used on the router. If this is the only instance of bitcoin running on the network, this will resolve itself automatically. Otherwise, you might want to choose a different P2P port to prevent this conflict.\n");
}
// Sanity-check returned lifetime.
if (actual_lifetime < 30) {
- LogPrintLevel(BCLog::NET, BCLog::Level::Warning, "portmap: Got impossibly short mapping lifetime of %d seconds\n", actual_lifetime);
+ LogWarning("portmap: Got impossibly short mapping lifetime of %d seconds\n", actual_lifetime);
return;
}
// RFC6887 11.2.1 recommends that clients send their first renewal packet at a time chosen with uniform random
diff --git a/src/net.cpp b/src/net.cpp
index 771b1a36..4272c6e1 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -369,7 +369,7 @@ static CService GetBindAddress(const Sock& sock)
if (!sock.GetSockName((struct sockaddr*)&sockaddr_bind, &sockaddr_bind_len)) {
addr_bind.SetSockAddr((const struct sockaddr*)&sockaddr_bind, sockaddr_bind_len);
} else {
- LogPrintLevel(BCLog::NET, BCLog::Level::Warning, "getsockname failed\n");
+ LogWarning("getsockname failed\n");
}
return addr_bind;
}
@@ -1746,7 +1746,7 @@ void CConnman::AcceptConnection(const ListenSocket& hListenSocket) {
CService addr;
if (!addr.SetSockAddr((const struct sockaddr*)&sockaddr, len)) {
- LogPrintLevel(BCLog::NET, BCLog::Level::Warning, "Unknown socket family\n");
+ LogWarning("Unknown socket family\n");
} else {
addr = MaybeFlipIPv6toCJDNS(addr);
}
@@ -3143,14 +3143,14 @@ bool CConnman::BindListenPort(const CService& addrBind, bilingual_str& strError,
if (!addrBind.GetSockAddr((struct sockaddr*)&sockaddr, &len))
{
strError = Untranslated(strprintf("Bind address family for %s not supported", addrBind.ToStringAddrPort()));
- LogPrintLevel(BCLog::NET, BCLog::Level::Error, "%s\n", strError.original);
+ LogError("%s\n", strError.original);
return false;
}
std::unique_ptr<Sock> sock = CreateSock(addrBind.GetSAFamily(), SOCK_STREAM, IPPROTO_TCP);
if (!sock) {
strError = Untranslated(strprintf("Couldn't open socket for incoming connections (socket returned error %s)", NetworkErrorString(WSAGetLastError())));
- LogPrintLevel(BCLog::NET, BCLog::Level::Error, "%s\n", strError.original);
+ LogError("%s\n", strError.original);
return false;
}
@@ -3185,7 +3185,7 @@ bool CConnman::BindListenPort(const CService& addrBind, bilingual_str& strError,
strError = strprintf(_("Unable to bind to %s on this computer. %s is probably already running."), addrBind.ToStringAddrPort(), CLIENT_NAME);
else
strError = strprintf(_("Unable to bind to %s on this computer (bind returned error %s)"), addrBind.ToStringAddrPort(), NetworkErrorString(nErr));
- LogPrintLevel(BCLog::NET, BCLog::Level::Error, "%s\n", strError.original);
+ LogError("%s\n", strError.original);
return false;
}
LogInfo("Bound to %s\n", addrBind.ToStringAddrPort());
@@ -3194,7 +3194,7 @@ bool CConnman::BindListenPort(const CService& addrBind, bilingual_str& strError,
if (sock->Listen(SOMAXCONN) == SOCKET_ERROR)
{
strError = strprintf(_("Listening for incoming connections failed (listen returned error %s)"), NetworkErrorString(WSAGetLastError()));
- LogPrintLevel(BCLog::NET, BCLog::Level::Error, "%s\n", strError.original);
+ LogError("%s\n", strError.original);
return false;
}
diff --git a/src/netbase.cpp b/src/netbase.cpp
index 4d2512ee..7c170eef 100644
--- a/src/netbase.cpp
+++ b/src/netbase.cpp
@@ -650,7 +650,7 @@ std::unique_ptr<Sock> ConnectDirectly(const CService& dest, bool manual_connecti
{
auto sock = CreateSock(dest.GetSAFamily(), SOCK_STREAM, IPPROTO_TCP);
if (!sock) {
- LogPrintLevel(BCLog::NET, BCLog::Level::Error, "Cannot create a socket for connecting to %s\n", dest.ToStringAddrPort());
+ LogError("Cannot create a socket for connecting to %s\n", dest.ToStringAddrPort());
return {};
}
@@ -678,7 +678,7 @@ std::unique_ptr<Sock> Proxy::Connect() const
#ifdef HAVE_SOCKADDR_UN
auto sock = CreateSock(AF_UNIX, SOCK_STREAM, 0);
if (!sock) {
- LogPrintLevel(BCLog::NET, BCLog::Level::Error, "Cannot create a socket for connecting to %s\n", m_unix_socket_path);
+ LogError("Cannot create a socket for connecting to %s\n", m_unix_socket_path);
return {};
}
diff --git a/src/node/blockstorage.cpp b/src/node/blockstorage.cpp
index d2a4c620..a5984df6 100644
--- a/src/node/blockstorage.cpp
+++ b/src/node/blockstorage.cpp
@@ -863,7 +863,7 @@ FlatFilePos BlockManager::FindNextBlockPos(unsigned int nAddSize, unsigned int n
// a reindex. A flush error might also leave some of the data files
// untrimmed.
if (!FlushBlockFile(last_blockfile, /*fFinalize=*/true, finalize_undo)) {
- LogPrintLevel(BCLog::BLOCKSTORAGE, BCLog::Level::Warning,
+ LogWarning(
"Failed to flush previous block file %05i (finalize=1, finalize_undo=%i) before opening new block file %05i\n",
last_blockfile, finalize_undo, nFile);
}
@@ -987,7 +987,7 @@ bool BlockManager::WriteBlockUndo(const CBlockUndo& blockundo, BlockValidationSt
// fact it is. Note though, that a failed flush might leave the data
// file untrimmed.
if (!FlushUndoFile(pos.nFile, true)) {
- LogPrintLevel(BCLog::BLOCKSTORAGE, BCLog::Level::Warning, "Failed to flush undo file %05i\n", pos.nFile);
+ LogWarning("Failed to flush undo file %05i\n", pos.nFile);
}
} else if (pos.nFile == cursor.file_num && block.nHeight > cursor.undo_height) {
cursor.undo_height = block.nHeight;
diff --git a/src/txdb.cpp b/src/txdb.cpp
index 68cb6939..843cb9b1 100644
--- a/src/txdb.cpp
+++ b/src/txdb.cpp
@@ -102,7 +102,7 @@ bool CCoinsViewDB::BatchWrite(CoinsViewCacheCursor& cursor, const uint256 &hashB
std::vector<uint256> old_heads = GetHeadBlocks();
if (old_heads.size() == 2) {
if (old_heads[0] != hashBlock) {
- LogPrintLevel(BCLog::COINDB, BCLog::Level::Error, "The coins database detected an inconsistent state, likely due to a previous crash or shutdown. You will need to restart bitcoind with the -reindex-chainstate or -reindex configuration option.\n");
+ LogError("The coins database detected an inconsistent state, likely due to a previous crash or shutdown. You will need to restart bitcoind with the -reindex-chainstate or -reindex configuration option.\n");
}
assert(old_heads[0] == hashBlock);
old_tip = old_heads[1];
diff --git a/src/validation.cpp b/src/validation.cpp
index eafe19c7..289c38ec 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -2798,7 +2798,7 @@ bool Chainstate::FlushStateToDisk(
// TODO: Handle return error, or add detailed comment why it is
// safe to not return an error upon failure.
if (!m_blockman.FlushChainstateBlockFile(m_chain.Height())) {
- LogPrintLevel(BCLog::VALIDATION, BCLog::Level::Warning, "%s: Failed to flush block file.\n", __func__);
+ LogWarning("%s: Failed to flush block file.\n", __func__);
}
}
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.