net_processing: move the debug log about receiving VERSION earlier
What changed, and why it matters
This commit simply moves a diagnostic log message that records receipt of a peer's VERSION message to an earlier point in the network processing code. It does not change any protocol behavior, validation logic, or security checks. The change only affects debug logging output, making it more likely the log line is printed even if the connection is interrupted shortly after receiving VERSION. There is no security issue here.
No security action needed. This is a benign logging-only refactor.
Security signals we found
No strong security signals were identified.
Evidence from the diff
In src/net_processing.cpp, the LogDebug() call for ‘receive version message’ is relocated from after several MakeAndPushMessage() calls and address-manager updates to immediately after VERSION message parsing. The log line and its arguments (cleanSubVer, nVersion, starting height, local address, relay flag, peer ID, optional IP and mapped AS) are unchanged. The move ensures the debug log is emitted before any outbound message pushes that might fail or before early returns interrupt processing. No functional logic is modified.
Changed components
src/net_processing.cppdebug logging for VERSION message handlingInspect captured patch +6 / −6
diff --git a/src/net_processing.cpp b/src/net_processing.cpp
index 14c2d5aa..20640096 100644
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -3567,6 +3567,12 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
if (fRelay) pfrom.m_relays_txs = true;
}
+ const auto mapped_as{m_connman.GetMappedAS(pfrom.addr)};
+ LogDebug(BCLog::NET, "receive version message: %s: version %d, blocks=%d, us=%s, txrelay=%d, peer=%d%s%s\n",
+ cleanSubVer, pfrom.nVersion,
+ peer->m_starting_height, addrMe.ToStringAddrPort(), fRelay, pfrom.GetId(),
+ pfrom.LogIP(fLogIPs), (mapped_as ? strprintf(", mapped_as=%d", mapped_as) : ""));
+
if (greatest_common_version >= WTXID_RELAY_VERSION) {
MakeAndPushMessage(pfrom, NetMsgType::WTXIDRELAY);
}
@@ -3645,12 +3651,6 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
m_addrman.Good(pfrom.addr);
}
- const auto mapped_as{m_connman.GetMappedAS(pfrom.addr)};
- LogDebug(BCLog::NET, "receive version message: %s: version %d, blocks=%d, us=%s, txrelay=%d, peer=%d%s%s\n",
- cleanSubVer, pfrom.nVersion,
- peer->m_starting_height, addrMe.ToStringAddrPort(), fRelay, pfrom.GetId(),
- pfrom.LogIP(fLogIPs), (mapped_as ? strprintf(", mapped_as=%d", mapped_as) : ""));
-
peer->m_time_offset = NodeSeconds{std::chrono::seconds{nTime}} - Now<NodeSeconds>();
if (!pfrom.IsInboundConn()) {
// Don't use timedata samples from inbound peers to make it
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.