{
 "number": 36719,
 "repo": "bitcoin/bitcoin",
 "url": "https://github.com/bitcoin/bitcoin/pull/36719",
 "title": "doc: clarify RPC addnode 'add' vs 'onetry' connection limits",
 "author": "Snan0M",
 "author_association": "FIRST_TIME_CONTRIBUTOR",
 "created_at": "2026-10-31T14:36:00Z",
 "updated_at": "2026-11-01T21:44:00Z",
 "description_hash": "3630533f761b11db",
 "age_days": 1,
 "draft": false,
 "labels": [
  "Scripts and tools"
 ],
 "milestone": null,
 "base": "master",
 "head_sha": "4c4970a69646231a1b443caa3c0c57aa012e4d89",
 "head_ref": "netinfo-peer-count-width",
 "head_repo": "Snan0M/bitcoin",
 "head_history": [
  {
   "t": "2026-11-01T20:06:47Z",
   "sha": "241d99a0cac90733b6ada9837029a26844ae6025"
  },
  {
   "t": "2026-11-01T21:22:53Z",
   "sha": "4c4970a69646231a1b443caa3c0c57aa012e4d89"
  }
 ],
 "additions": 5,
 "deletions": 4,
 "changed_files": 2,
 "commit_count": 2,
 "size_bucket": "S",
 "mergeable_state": "unstable",
 "bot": {
  "drahtbot": {
   "present": true,
   "reviews": {
    "ack": [
     {
      "login": "jonatack",
      "url": "https://github.com/bitcoin/bitcoin/pull/36719#issuecomment-6564229611"
     }
    ]
   },
   "conflicts": []
  }
 },
 "acks_parsed": {
  "jonatack": {
   "kind": "ack",
   "hash": "4c4970a69646231a1b443caa3c0c57aa012e4d89",
   "t": "2026-11-01T21:36:27Z",
   "stale": false
  }
 },
 "acks_tally": {
  "ack": 1,
  "stale_ack": 0,
  "concept_ack": 0,
  "approach_ack": 0,
  "nack": 0,
  "concept_nack": 0,
  "approach_nack": 0
 },
 "reviews": {
  "approved": 0,
  "changes_requested": 0,
  "distinct_reviewers": [
   "jonatack",
   "pinheadmz"
  ]
 },
 "signals": {
  "needs_rebase": false,
  "ci_failed": false,
  "mergeable_state": "unstable",
  "last_author_activity": "2026-11-01T21:44:00Z",
  "last_reviewer_activity": "2026-11-01T21:36:27Z",
  "last_reviewer": "jonatack",
  "author_silent_days": 0,
  "waiting_on_author_days": 0,
  "days_since_update": 0
 },
 "refs": {
  "mentioned": [],
  "depends_on": [],
  "fixes": [],
  "linked_issues": [],
  "references": [],
  "conflicts": []
 },
 "stack": {
  "shares_commits_with": [],
  "based_on": [],
  "base_for": []
 },
 "review_paths": [
  "src/bitcoin-cli.cpp"
 ],
 "body": "Clarifies the `addnode` RPC help on the separate limits for `add` and `onetry`: `add` entries are capped by `MAX_ADDNODE_CONNECTIONS`, `onetry` connections are not.\n\nAlso fixes `-netinfo`: the manual peer count is `uint8_t` while the other counts are `uint16_t`, so it wraps at 256. This is reachable via `addnode onetry`, which is not subject to the `MAX_ADDNODE_CONNECTIONS` cap.",
 "commits": [
  {
   "sha": "e46bcd40bb6d8120a269676dcb29f64b9ded2c6d",
   "date": "2026-11-01T21:19:21Z",
   "message": "cli: use uint16_t for -netinfo manual peer count\n\nThe other -netinfo peer counts are uint16_t, but the manual peer count\nwas uint8_t and wraps at 256. Manual peers aren't limited to the 8\n-addnode slots (addnode onetry connections also count as manual and are\nnot subject to MAX_ADDNODE_CONNECTIONS), so the count can reach that and\nthe \"manual\" column then disappears or shows a wrapped value."
  },
  {
   "sha": "4c4970a69646231a1b443caa3c0c57aa012e4d89",
   "date": "2026-11-01T21:19:26Z",
   "message": "rpc: clarify addnode 'add' vs 'onetry' connection limits\n\nPersistent addnode connections added with the 'add' command are capped at\nMAX_ADDNODE_CONNECTIONS, while 'onetry' connections are not subject to\nthat limit. Say so in the addnode RPC help."
  }
 ],
 "timeline": [
  {
   "t": "2026-10-31T14:36:44Z",
   "kind": "comment",
   "who": "pinheadmz",
   "assoc": "MEMBER",
   "text": "You just opened 3 PRs really fast. Lets stop there ok? Give us time to digest them",
   "id": "c:6544797257",
   "url": "https://github.com/bitcoin/bitcoin/pull/36719#issuecomment-6544797257",
   "hash": "fe7b4cf83d746b24",
   "edited": null
  },
  {
   "t": "2026-11-01T16:23:40Z",
   "kind": "review_comment",
   "who": "jonatack",
   "assoc": "MEMBER",
   "path": "src/bitcoin-cli.cpp",
   "commit": "4c4970a69646231a1b443caa3c0c57aa012e4d89",
   "in_reply_to": null,
   "text": "For block relay peers, the steady state should be limited to around 2, with only brief extras that are actively evicted.\n\nFor addnode peers, persistent connections are capped at 8.\n\nRPC addnode onetry can bypass this limit, but exceeding 255 seems unrealistic under ordinary operation, limited by:\n\n- file descriptors\n- system resources (memory and CPU for the extra CNode objects and peer processing)\n- distinct reachable peers that accept the connection\n\nExceeding 255 onetry connections might perhaps be an intentional stress/abuse scenario more than normal node behavior.\n\nSo, tentative ACK on this change for the manual peers counter and NACK on the block relay one.\n\nThe RPC addnode help could perhaps be clarified about the separate limits for add and onetry; for instance:\n\n```diff\n--- a/src/rpc/net.cpp\n+++ b/src/rpc/net.cpp\n@@ -347,12 +347,14 @@ static RPCMethod addnode()\n         \"addnode\",\n         \"Attempts to add or remove a node from the addnode list.\\n\"\n                 \"Or try a connection to a node once.\\n\"\n                 \"Nodes added using addnode (or -connect) are protected from DoS disconnection and IBD block stalling\\n\"\n                 \"disconnection, and are not required to be full nodes or support SegWit as other outbound peers are (though\\n\"\n                 \"such peers will not be synced from).\\n\" +\n-                strprintf(\"Addnode connections are limited to %u at a time\", MAX_ADDNODE_CONNECTIONS) +\n-                \" and are counted separately from the -maxconnections limit.\\n\",\n+                strprintf(\"Persistent addnode connections (command 'add') are limited to %u at a time\", MAX_ADDNODE_CONNECTIONS) +\n+                \" and are counted separately from the -maxconnections limit.\\n\"\n+                \"The 'onetry' command attempts a connection once and does not count against this limit.\\n\",\n                 {\n                     {\"node\", RPCArg::Type::STR, RPCArg::Optional::NO, \"The IP address/hostname optionally followed by :port of the peer to connect to\"},\n-                    {\"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\"},\n+                    {\"command\", RPCArg::Type::STR, RPCArg::Optional::NO, \"'add' to add a node to the persistent list (limited to \" + std::to_string(MAX_ADDNODE_CONNECTIONS) + \"), 'remove' to remove a node from the list, 'onetry' to try a connection to the node once (does not count against the limit)\"},\n                     {\"v2transport\", RPCArg::Type::BOOL, RPCArg::DefaultHint{\"set by -v2transport\"}, \"Attempt to connect using BIP324 v2 transport protocol (ignored for 'remove' command)\"},\n                 },\n```",
   "id": "rc:4436418095",
   "url": "https://github.com/bitcoin/bitcoin/pull/36719#discussion_r4436418095",
   "hash": "8f43cc4cbd3a95bb",
   "edited": null
  },
  {
   "t": "2026-11-01T16:29:38Z",
   "kind": "comment",
   "who": "jonatack",
   "assoc": "MEMBER",
   "text": "(If this moves forward, the PR description should state why the manual peer counter might exceed 255 to justify the change.)",
   "id": "c:6560691655",
   "url": "https://github.com/bitcoin/bitcoin/pull/36719#issuecomment-6560691655",
   "hash": "f034cfcd1147d048",
   "edited": null
  },
  {
   "t": "2026-11-01T20:06:47Z",
   "kind": "force_push",
   "who": "Snan0M",
   "commit": "241d99a0cac90733b6ada9837029a26844ae6025",
   "id": "push:241d99a0cac90733b6ada9837029a26844ae6025"
  },
  {
   "t": "2026-11-01T20:12:19Z",
   "kind": "review_comment",
   "who": "Snan0M",
   "assoc": "NONE",
   "path": "src/bitcoin-cli.cpp",
   "commit": "4c4970a69646231a1b443caa3c0c57aa012e4d89",
   "in_reply_to": 4436418095,
   "text": "Thanks @jonatack. Reverted the block-relay counter to `uint8_t` and kept `uint16_t` for the manual peer count only. I also took your suggested `addnode` RPC help clarification (`add` vs `onetry`) as a separate commit.",
   "id": "rc:4437163040",
   "url": "https://github.com/bitcoin/bitcoin/pull/36719#discussion_r4437163040",
   "hash": "488033c921726784",
   "edited": null
  },
  {
   "t": "2026-11-01T20:54:23Z",
   "kind": "comment",
   "who": "jonatack",
   "assoc": "MEMBER",
   "text": "@Snan0M Can you please [squash](https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#squashing-commits) the first and last commits (and verify the commit title and message body)?",
   "id": "c:6563747559",
   "url": "https://github.com/bitcoin/bitcoin/pull/36719#issuecomment-6563747559",
   "hash": "68706f17eb5f4a91",
   "edited": null
  },
  {
   "t": "2026-11-01T21:22:53Z",
   "kind": "force_push",
   "who": "Snan0M",
   "commit": "4c4970a69646231a1b443caa3c0c57aa012e4d89",
   "id": "push:4c4970a69646231a1b443caa3c0c57aa012e4d89"
  },
  {
   "t": "2026-11-01T21:23:28Z",
   "kind": "comment",
   "who": "Snan0M",
   "assoc": "NONE",
   "text": "[quoted text omitted]\n\nDone, squashed",
   "id": "c:6564082392",
   "url": "https://github.com/bitcoin/bitcoin/pull/36719#issuecomment-6564082392",
   "hash": "1e8d1a64f7606b0a",
   "edited": null
  },
  {
   "t": "2026-11-01T21:36:27Z",
   "kind": "comment",
   "who": "jonatack",
   "assoc": "MEMBER",
   "text": "ACK 4c4970a69646231a1b443caa3c0c57aa012e4d89\n\nPerhaps update the PR title to `doc: clarify RPC addnode 'add' vs 'onetry' connection limits` (and mention the -netinfo change in the PR description body instead), as ISTM the doc change is the more interesting one.",
   "id": "c:6564229611",
   "url": "https://github.com/bitcoin/bitcoin/pull/36719#issuecomment-6564229611",
   "hash": "7198a66c23b45330",
   "edited": null
  },
  {
   "t": "2026-11-01T21:44:00Z",
   "kind": "comment",
   "who": "Snan0M",
   "assoc": "NONE",
   "text": "Thanks, updated the title and moved the `-netinfo` change into the description.",
   "id": "c:6564313648",
   "url": "https://github.com/bitcoin/bitcoin/pull/36719#issuecomment-6564313648",
   "hash": "eeaab783d784f7fb",
   "edited": null
  }
 ],
 "labels_log": [
  {
   "t": "2026-10-31T14:36:04Z",
   "action": "labeled",
   "label": "Scripts and tools",
   "who": "DrahtBot"
  }
 ],
 "state_log": [
  {
   "t": "2026-11-01T20:12:26Z",
   "kind": "renamed",
   "who": "Snan0M",
   "from": "cli: use uint16_t for -netinfo block-relay and manual peer counts",
   "to": "cli: use uint16_t for -netinfo manual peer count"
  },
  {
   "t": "2026-11-01T21:42:37Z",
   "kind": "renamed",
   "who": "Snan0M",
   "from": "cli: use uint16_t for -netinfo manual peer count",
   "to": "doc: clarify RPC addnode 'add' vs 'onetry' connection limits"
  }
 ],
 "text_chars": 4817,
 "text_tokens_estimate": 1204,
 "changed_paths": [
  "src/bitcoin-cli.cpp",
  "src/rpc/net.cpp"
 ],
 "files": [
  {
   "path": "src/bitcoin-cli.cpp",
   "add": 1,
   "del": 1
  },
  {
   "path": "src/rpc/net.cpp",
   "add": 4,
   "del": 3
  }
 ],
 "test_lines": 0,
 "git": {
  "head": "4c4970a69646231a1b443caa3c0c57aa012e4d89",
  "head_matches_backup": false,
  "base": "ab7e668cc6af5d716ad40166d1f88235a2f6d25d",
  "patch_id": "76e6f48bffa71240",
  "commits": [
   {
    "sha": "e46bcd40bb",
    "subject": "cli: use uint16_t for -netinfo manual peer count",
    "files": 1,
    "add": 1,
    "del": 1
   },
   {
    "sha": "4c4970a696",
    "subject": "rpc: clarify addnode 'add' vs 'onetry' connection limits",
    "files": 1,
    "add": 4,
    "del": 3
   }
  ],
  "patch_truncated": false
 },
 "patch_id": "76e6f48bffa71240",
 "input_hash": "636354badacba88a",
 "extracted_at": "2026-11-02T01:09:49+00:00"
}