refactor: rename remaining BIP14 subversion identifiers to user agent #34444

pull l0rinc wants to merge 2 commits into bitcoin:master from l0rinc:l0rinc/rename-user-agent changing 28 files +93 −93
  1. l0rinc commented at 1:24 PM on January 29, 2026: contributor

    Problem

    BIP14 defines the sub_version_num field in version messages as a user-agent string, but there are still internal and user-facing references to "subver/subversion" (as noted in #34389 (review)).

    Fix

    The first commit performs the bulk of the mechanical work via a scripted-diff that (with a leading preflight check to make sure the target names don't collide), renaming internal identifiers from *SubVersion*/subver* to *UserAgent*/user_agent. I have verified the mechanical renames via to produce the same binary (except for the test_FormatSubVersion unit test name).

    The second commit follows up with the remaining non-mechanical cleanup, adjusting user-facing descriptions, comments, and local variable names to use "user agent" and explicitly referencing BIP14 as justification.

    For compatibility, the RPC keys (subver, subversion) are intentionally left unchanged.

  2. scripted-diff: rename subversion identifiers to user agent
    BIP14 specifies that the `sub_version_num` field is a user agent string.
    A few values can safely be renamed automatically.
    
    -BEGIN VERIFY SCRIPT-
    git grep -qE 'FormatUserAgent|formatUserAgent|strUserAgent|MAX_USER_AGENT_LENGTH|cleanUserAgent|m_user_agent_mutex|USER_AGENT_COLUMN_WIDTH|P2P_USER_AGENT' -- src test/functional && echo "Error: Target identifiers already exist in src/ or test/functional" && exit 1
    
    git grep -lE 'FormatSubVersion|formatSubVersion|strSubVersion|MAX_SUBVERSION_LENGTH|cleanSubVer|m_subver_mutex|SUBVERSION_COLUMN_WIDTH|P2P_SUBVERSION|strSubVer|Subversion' -- src test/functional | \
      xargs sed --in-place \
        -e 's/FormatSubVersion/FormatUserAgent/g' \
        -e 's/formatSubVersion/formatUserAgent/g' \
        -e 's/strSubVersion/strUserAgent/g' \
        -e 's/MAX_SUBVERSION_LENGTH/MAX_USER_AGENT_LENGTH/g' \
        -e 's/cleanSubVer/cleanUserAgent/g' \
        -e 's/m_subver_mutex/m_user_agent_mutex/g' \
        -e 's/SUBVERSION_COLUMN_WIDTH/USER_AGENT_COLUMN_WIDTH/g' \
        -e 's/P2P_SUBVERSION/P2P_USER_AGENT/g' \
        -e 's/strSubVer/user_agent/g' \
        -e 's/Subversion/UserAgent/g'
    -END VERIFY SCRIPT-
    7d59e5379b
  3. doc,rpc,test: refer to BIP14 user agent
    BIP14 specifies that the `sub_version_num` field is a user agent string.
    Update user-facing text, comments, and local variable names accordingly, while keeping RPC keys ("subver", "subversion") unchanged for compatibility.
    5636c68453
  4. DrahtBot commented at 1:25 PM on January 29, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    Concept NACK ajtowns
    Concept ACK naiyoma

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

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #34389 (net/log: standardize peer+addr log formatting via LogPeer by l0rinc)
    • #34293 (Bugfix: net_processing: Restore missing comma between peer and peeraddr in "receive version message" and "New ___ peer connected" by luke-jr)
    • #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.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

    LLM Linter (✨ experimental)

    Possible places where named args for integral literals may be used (e.g. func(x, /*named_arg=*/0) in C++, and func(x, named_arg=0) in Python):

    • check_bytesrecv(peer, msg_type, min_bytes_recv) in test/functional/test_framework/test_framework.py

    <sup>2026-01-29 13:25:27</sup>

  5. l0rinc renamed this:
    refactor/BIP14: rename remaining subversion identifiers to user agent
    refactor: rename remaining BIP14 subversion identifiers to user agent
    on Jan 29, 2026
  6. DrahtBot added the label Refactoring on Jan 29, 2026
  7. naiyoma commented at 7:50 PM on February 6, 2026: contributor

    Concept ACK

    Changes align with proposal:-> https://github.com/bitcoin/bips/blob/master/bip-0014.mediawiki#proposal

    "The currently unused sub_version_num field in "version" packets will become the new user-agent string."

    I grepped twice to check on the remaining instance git grep -i "subver" -- src test/functional git grep -i "subver" -- ':!src' ':!test/functional

    Other than the RPC keys. These changes also do not touch the release notes and doc/bips.md, which should be left as-is.

  8. ajtowns commented at 9:19 PM on February 6, 2026: contributor

    Concept NACK. This touches 28 files for a purely cosmetic rename — the merge conflict cost (already 3 conflicting PRs) and git blame churn outweigh the naming consistency benefit IMO.

    The internal terminology has been "subversion" for 15 years and is well-understood by anyone working on this code. BIP 14 defined how we format the string, and introduced the separation between protocol and client version, but I don't think it obligates us to match its naming internally. (Personally, I think "subversion" is a nice string to have peppered through our codebase anyway)

    If the concern is that bips.md's description feels inaccurate, note that the entry already has a bug: it cites #669 (multisig/OP_EVAL) but the actual BIP 14 implementation was #707.

    (** Using AI to edit my NACKs to make them less mean)

  9. l0rinc commented at 9:28 PM on February 6, 2026: contributor

    Thanks for the feedback.

  10. l0rinc closed this on Feb 6, 2026

  11. l0rinc deleted the branch on Feb 27, 2026

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-22 09:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me