Review report

bitcoin/bitcoin: PR #36719

1 minor finding · 1 suggestion

Findings

Link

[minor] · Argument help incorrectly caps the persistent addnode list

The new argument help describes an eight-entry persistent list limit, but only simultaneous persistent addnode connections are capped.

Location: src/rpc/net.cpp:357 (head).

Details and suggested fix

The phrase 'add' to add a node to the persistent list (limited to 8) implies that adding a ninth distinct entry will fail. In fact, the RPC calls CConnman::AddNode, which rejects duplicates but otherwise appends without a size check. The eight-connection limit comes from semAddnode in ThreadOpenAddedConnections; unconnected entries remain listed for later attempts. Although the main help correctly says connections are limited “at a time,” the argument description contradicts it and could discourage users from adding fallback peers. Attach the limit to connections instead, for example: 'add' to add a node to the persistent list (at most 8 of these are connected at a time).


Optional improvements

Link

[suggestion] · No regression test for manual-peer counts above 255

The existing -netinfo functional test does not check manual-peer counts, so reverting the counter to eight bits would leave its assertions unchanged.

Location: src/bitcoin-cli.cpp:390 (head).

Details and suggested fix

test_netinfo runs against one node with no peers and checks only the client header and local-services formatting. With an eight-bit counter, 256 manual peers wrap the count to zero, suppressing the manual column without affecting those assertions. Add a focused boundary test using a stub JSON-RPC server, following the raw-socket server pattern already in test_empty_response_body. Point bitcoin-cli -netinfo at it with -rpcconnect/-rpcport and return a successful batch containing compatible getnetworkinfo data (version at least 209900 and the other dashboard fields) plus 256 outbound peers on a recognized network with connection_type set to manual. Assert that the manual header appears and its value in the out row is 256. This avoids opening 256 real connections while distinguishing the fix from a reversion.


Coverage details