doc: clarify peer address in getpeerinfo and addnode RPC help
What changed, and why it matters
This commit only updates the user-facing help text for two Bitcoin Core RPC commands, getpeerinfo and addnode. It clarifies that the displayed peer address can be a hostname (not just an IP address) and that the port number is optional. There is no code behavior change, no bug fix, and no security relevance.
No security action needed. This is a documentation-only change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff modifies two documentation strings in src/rpc/net.cpp. The getpeerinfo ‘addr’ result description is changed from ‘The IP address and port of the peer’ to ‘The IP address/hostname optionally followed by :port of the peer’. The addnode ‘node’ argument description is changed from ‘The address of the peer to connect to’ to ‘The IP address/hostname optionally followed by :port of the peer to connect to’. These are purely help-text clarifications reflecting existing CNode::m_addr_name behavior.
Changed components
src/rpc/net.cppRPC help text for getpeerinfoRPC help text for addnodeInspect captured patch +2 / −2
diff --git a/src/rpc/net.cpp b/src/rpc/net.cpp
index 3a0432d7..da01a60b 100644
--- a/src/rpc/net.cpp
+++ b/src/rpc/net.cpp
@@ -130,7 +130,7 @@ static RPCHelpMan getpeerinfo()
{
{
{RPCResult::Type::NUM, "id", "Peer index"},
- {RPCResult::Type::STR, "addr", "(host:port) The IP address and port of the peer"},
+ {RPCResult::Type::STR, "addr", "(host:port) The IP address/hostname optionally followed by :port of the peer"},
{RPCResult::Type::STR, "addrbind", /*optional=*/true, "(ip:port) Bind address of the connection to the peer"},
{RPCResult::Type::STR, "addrlocal", /*optional=*/true, "(ip:port) Local address as reported by the peer"},
{RPCResult::Type::STR, "network", "Network (" + Join(GetNetworkNames(/*append_unroutable=*/true), ", ") + ")"},
@@ -322,7 +322,7 @@ static RPCHelpMan addnode()
strprintf("Addnode connections are limited to %u at a time", MAX_ADDNODE_CONNECTIONS) +
" and are counted separately from the -maxconnections limit.\n",
{
- {"node", RPCArg::Type::STR, RPCArg::Optional::NO, "The address of the peer to connect to"},
+ {"node", RPCArg::Type::STR, RPCArg::Optional::NO, "The IP address/hostname optionally followed by :port of the peer to connect to"},
{"command", RPCArg::Type::STR, RPCArg::Optional::NO, "'add' to add a node to the list, 'remove' to remove a node from the list, 'onetry' to try a connection to the node once"},
{"v2transport", RPCArg::Type::BOOL, RPCArg::DefaultHint{"set by -v2transport"}, "Attempt to connect using BIP324 v2 transport protocol (ignored for 'remove' command)"},
},
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.