Skip to content

Bugfix: net_processing: Restore missing comma between peer and peeraddr in "receive version message" and "New ___ peer connected" - #34293

Closed
luke-jr wants to merge 1 commit into
bitcoin:masterfrom
luke-jr:fix_vermsg_missing_comma
Closed

luke-jr wants to merge 1 commit into
bitcoin:masterfrom
luke-jr:fix_vermsg_missing_comma

Conversation

@luke-jr

@luke-jr luke-jr commented Jan 14, 2026

Copy link
Copy Markdown
Contributor

Versions prior to 29.x all included a comma here, and the general format of the message still includes commas between all other fields

@DrahtBot

DrahtBot commented Jan 14, 2026 •

Copy link
Copy Markdown
Contributor

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Code Coverage & Benchmarks

For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/34293.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK l0rinc, vasild, 0xB10C

If your review is incorrectly listed, please copy-paste <!--meta-tag:bot-skip--> into the comment that the bot should ignore.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #34444 (refactor: rename remaining BIP14 subversion identifiers to user agent by l0rinc)
  • #34389 (net/log: standardize peer+addr log formatting via LogPeer by l0rinc)
  • #34181 (refactor: [p2p] Make ProcessMessage private again, Use references when non-null by maflcko)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@polespinasa

polespinasa commented Jan 14, 2026 •

Copy link
Copy Markdown
Member

Trying to test this but in my logs I don't see a peeraddr after peer. How can I test this?

@l0rinc l0rinc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code review ACK 9e689f5cb5271c668610cf9cd21ba04cc8a755b4

Comment thread src/net_processing.cpp Resolved
…dr in "receive version message" and "New ___ peer connected"

Versions prior to 29.x all included a comma here, and the general format of the message still includes commas between all other fields
@luke-jr
luke-jr force-pushed the fix_vermsg_missing_comma branch from 9e689f5 to ffd09f8 Compare January 23, 2026 03:31
@luke-jr

luke-jr commented Jan 23, 2026

Copy link
Copy Markdown
Contributor Author

Trying to test this but in my logs I don't see a peeraddr after peer. How can I test this?

-logips option

@luke-jr luke-jr changed the title Bugfix: net_processing: Restore missing comma between peer and peeraddr in "receive version message" Bugfix: net_processing: Restore missing comma between peer and peeraddr in "receive version message" and "New ___ peer connected" Jan 23, 2026
@l0rinc

l0rinc commented Jan 23, 2026

Copy link
Copy Markdown
Contributor

ACK ffd09f8

This does fix an existing issue introduced in https://github.com/bitcoin/bitcoin/pull/28521/changes#diff-6875de769e90cec84d2e8a9c1b962cdbcda44d870d42e4215827e599e11e90e3L3570.
I think we should fix all remaining LogPeer instances as well in a more systematic way, not just two of the instances, so I opened an alternative in #34389, added @luke-jr as a coauthor.

@vasild vasild left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK ffd09f8

Seems like this code would benefit from further improvements (in a followup?) to avoid repeated
"peer=%s%d%Sss%%!*&*", fLogIPs ? "," : "", pfrom.LogIP(fLogIPs)

Thanks!

@0xB10C

0xB10C commented Feb 5, 2026

Copy link
Copy Markdown
Contributor

ACK ffd09f8

I had noticed this while touching the New %s peer connected log in #34008 but it didn't bother me enough to fix it.

@l0rinc

l0rinc commented Feb 5, 2026

Copy link
Copy Markdown
Contributor

Note that this only fixes 2 occurrences, but there's an alternative where I've adjusted them in a more systematic way, see: #34389

@DrahtBot

DrahtBot commented Feb 7, 2026

Copy link
Copy Markdown
Contributor

🐙 This pull request conflicts with the target branch and needs rebase.

@fanquake

Copy link
Copy Markdown
Member

@luke-jr are you going to rebase this?

@l0rinc

l0rinc commented Feb 20, 2026

Copy link
Copy Markdown
Contributor

#34389 contains these changes already and applies it consistently to all other cases and is rebased. I have added @luke-jr as a coauthor to it.

sedited added a commit that referenced this pull request Mar 11, 2026
…eer`

2233547 net: format peer+addr logs with `LogPeer` (Lőrinc)
e55ea53 test: add pre-`LogPeer` net log assertion (Lőrinc)
736b17c log: fix minor formatting in debug logs (Lőrinc)
9cf82be log: show placeholders for missing peer fields (Lőrinc)

Pull request description:

  This is an alternative to #34293, but aims to address the remaining logging inconsistencies more broadly.
  It extends the example fixed there to every instance, restores the original separator behavior, applies it consistently via a single helper, and adds tests for `logips` (covering both current and new behavior).

  ### Problem
  After #28521 centralized peer address logging into `CNode::LogIP()`, the original comma separator before `peeraddr=` was lost, resulting in inconsistent formatting across net (and recent private broadcast) logs.
  Some lines also had double spaces, empty fields, or mismatched format specifiers.

  ### Fix
  Introduces `CNode::LogPeer(bool)` which always emits `peer=<id>` and, when `-logips=1`, appends `, peeraddr=<addr>`. This eliminates hand-rolled separators and makes peer identification predictable.
  Minor issues (double spaces, empty placeholders, format specifiers) are fixed along the way in separate commits.

  ### Reproducer
  Run with `-debug=net -logips=1` and observe peer log lines now show `peer=<id>, peeraddr=<addr>` (comma-separated). The new assertion in `feature_logging.py` automates this check.

ACKs for top commit:
  naiyoma:
    ACK 2233547
  vasild:
    ACK 2233547
  sedited:
    ACK 2233547

Tree-SHA512: 562262a58c3042f139099ff4c41e3fc6a97505fe9603c2bf700a97fd0aa052954b47c14da0e50c1fc311db1ae6c04e6a92156c9b85e25c777a637b7766c1dafe
@fanquake

Copy link
Copy Markdown
Member

This has been done as part of #34389.

@fanquake fanquake closed this Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants