Review report

bitcoin/bitcoin: PR #36746

3 suggestions

Optional improvements

Link

[suggestion] · getnodeaddresses help still describes a connection-based network

getnodeaddresses now reports an address's GetNetwork() classification, but its help still describes the connection-based classification retained by getpeerinfo.

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

Details and suggested fix

getnodeaddresses now labels an addrman entry using addr.GetNetwork(), while its result help still says "the node connected through". getpeerinfo retains ConnectedThroughNetwork()/GetNetClass() except for inbound onion connections, so an ordinary connection to a 6to4 or Teredo address reports ipv4 while a returned addrman entry for that address reports ipv6. The release note explains this intentional difference, but the built-in help does not. How often this affects connected peers is unconfirmed. Change the result description to "The network (...) of the address", matching getrawaddrman.


Link

[suggestion] · Release note conflates entry and source network labels

source_network belongs only to getrawaddrman and changes to ipv6 for a linked-IPv4 source, not merely because the stored entry has a linked-IPv4 address.

Location: doc/release-notes-36746.md:7 (head).

Details and suggested fix

The phrase "both RPCs report their network (and source_network) as ipv6" treats the entry and its source alike. AddrmanEntryToJSON() classifies info for network and info.source for source_network; normal address processing stores the announcing peer as the source. Thus a 6to4 entry announced by a plain IPv4 peer still has source_network: ipv4, and a plain IPv4 entry with a linked-IPv4 source has source_network: ipv6. getnodeaddresses emits no source_network field. State separately that both RPCs label linked-IPv4 entries as ipv6, while getrawaddrman also labels linked-IPv4 source addresses as ipv6.


Link

[suggestion] · Self-sourced RPC fixtures miss entry/source network swaps

The added RPC assertions catch the classifier change but would not detect an entry/source swap in source_network.

Location: test/functional/rpc_net.py:627 (head).

Details and suggested fix

addpeeraddress passes the entry itself as the source in addrman.Add(), and seed_addrman uses that helper too. Consequently, both the existing field checks and these new assertions would accept serialization using info.GetNetwork() instead of info.source.GetNetwork(). The new assertions do distinguish GetNetwork() from GetNetClass(). Add one mixed-network case in RPCTestingSetup: insert a routable IPv4 entry with a routable 6to4 source through m_node.addrman->Add(), call getrawaddrman, and assert network == "ipv4" and source_network == "ipv6". The fixture already supplies addrman, connman and the RPC context, so this covers both mistakes without another functional-test restart.


Coverage details