cryptonote_protocol: fix peer overview logging
What changed, and why it matters
This commit fixes a minor logging bug in the Monero peer-to-peer protocol code. The previous code accidentally added a number to a character (using '+' instead of '<<'), which produced incorrect characters in a debug peer-overview string. The fix simply prints the number and character separately. There is no security impact.
No security action required. Treat as a normal code-quality/logging fix.
Security signals we found
No strong security signals were identified.
Evidence from the diff
In cryptonote_protocol_handler.inl, the peer overview logging loop previously used ss << stripe + state_char;, which performs integer addition between the pruning stripe (uint32_t) and the protocol state char, resulting in a numeric value being streamed rather than the intended concatenation. The patch changes this to ss << stripe << state_char;, correctly outputting both values. A second change removes an erroneous unary + before a string literal (ss << + " "; -> ss << " ";). Both are cosmetic/logging correctness fixes with no effect on protocol logic, state, or security.
Changed components
src/cryptonote_protocol/cryptonote_protocol_handler.inlpeer overview logging outputInspect captured patch +2 / −2
diff --git a/src/cryptonote_protocol/cryptonote_protocol_handler.inl b/src/cryptonote_protocol/cryptonote_protocol_handler.inl
index a115d50..78f1c53 100644
--- a/src/cryptonote_protocol/cryptonote_protocol_handler.inl
+++ b/src/cryptonote_protocol/cryptonote_protocol_handler.inl
@@ -2729,10 +2729,10 @@ skip:
m_p2p->for_each_connection([&](const connection_context &ctx, nodetool::peerid_type peer_id, uint32_t support_flags) {
const uint32_t stripe = tools::get_pruning_stripe(ctx.m_pruning_seed);
char state_char = cryptonote::get_protocol_state_char(ctx.m_state);
- ss << stripe + state_char;
+ ss << stripe << state_char;
if (ctx.m_last_request_time != boost::date_time::not_a_date_time)
ss << (((now - ctx.m_last_request_time).total_microseconds() > IDLE_PEER_KICK_TIME) ? "!" : "?");
- ss << + " ";
+ ss << " ";
return true;
});
return ss.str();
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.