Skip to content

rpc: getnetworkinfo lists its networks - #1215

Merged
reardencode merged 2 commits into
reardencode:masterfrom
Naomi-Gift:rpc/getnetworkinfo-networks
Oct 25, 2026
Merged

reardencode merged 2 commits into
reardencode:masterfrom
Naomi-Gift:rpc/getnetworkinfo-networks

Conversation

@Naomi-Gift

Copy link
Copy Markdown
Contributor

getnetworkinfo always returned "networks": [] (net.rs:374). Core lists ipv4, ipv6, onion, i2p and cjdns, each with limited, reachable, proxy and proxy_randomize_credentials.

Now each row comes from what the node actually does:

  • reachable is AddrMan::reachable, which also decides what gets dialed. It follows --only-net, a SOCKS proxy for onion, --i2p-sam and --cjdns-reachable.
  • proxy is Dialer::proxy_for: --proxy for ipv4 and ipv6, and --onion (else --proxy) for onion. The onion dial paths use the same function.

One difference from Core: rbitcoin dials cjdns directly, not through --proxy, so its cjdns row shows no proxy.

Checked with the node binary against Core 29 using --proxy 127.0.0.1:9050 --only-net onion --only-net ipv4. Every row matches except the cjdns proxy above. Without flags, the rows match Core's defaults.

Test: getnetworkinfo_networks_report_reach_and_proxy. It fails on master with networks: [].

getnetworkinfo always returned an empty networks list. It now has a row
for ipv4, ipv6, onion, i2p, and cjdns, like Core. reachable comes from
AddrMan::reachable, which dialable now uses too. proxy comes from
Dialer::proxy_for, which the onion dial paths now use too.

@rearden-grok rearden-grok Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

REQUEST_CHANGES

1 bug, 1 missing test.

  • The I2P proxy is always "". Comment on crates/rbitcoin-net/src/socks.rs.
  • The new getnetworkinfo test cannot represent a SAM address or --proxy-randomize=0. Comment on crates/rbitcoin-rpc/tests/methods/mod.rs.

match net {
crate::OnlyNet::Ipv4 | crate::OnlyNet::Ipv6 => *proxy,
crate::OnlyNet::Onion => onion.or(*proxy),
crate::OnlyNet::I2p | crate::OnlyNet::Cjdns => None,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

proxy_for returns None for I2P, so getnetworkinfo.networks always has proxy: "" on that row. Core v31.1 GetNetworksInfo puts the -i2psam host:port there (feature_proxy.py expects 127.0.0.1:7656) and leaves proxy_randomize_credentials false, including when -onlynet has already made I2P unreachable. Reachability already follows the SAM flag; the socket lives only on ListenOpts.i2p_sam and never reaches this dialer. Report that address on the i2p row and fix the docs/rpc.md sentence that specifies an empty proxy. Cjdns stays empty: connect_net dials those addresses with TcpStream::connect.

"limited": !reachable,
"reachable": reachable,
"proxy": proxy,
"proxy_randomize_credentials": !proxy.is_empty(),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

proxy_randomize_credentials: !proxy.is_empty() rejects a correct i2p row (SAM address, randomize false) and a --proxy-randomize=0 row. The only dialer in the test is one SOCKS proxy with randomize: true, so a distinct --onion address is unpinned too. Assert those cases on the fields themselves.

The i2p row always had an empty proxy. Core puts the -i2psam address
there with proxy_randomize_credentials false, even when -onlynet leaves
i2p unreachable. NetProxies keeps the SAM address next to the dialer,
and its proxy_for gives each row's proxy and randomize flag.

@rearden-grok rearden-grok Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

APPROVE

Both earlier findings are fixed. The I2P row reports the --i2p-sam address with proxy_randomize_credentials false, including when --only-net clears reachability, and docs/rpc.md says so. The test asserts that row, --proxy-randomize=0, and a distinct --onion proxy on the fields themselves.

Cjdns still reports an empty proxy, matching the direct dial.

0 bugs.

@reardencode
reardencode merged commit 572e72c into reardencode:master Oct 25, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants