Repository navigation
rpc: getnetworkinfo lists its networks - #1215
Conversation
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.
There was a problem hiding this comment.
REQUEST_CHANGES
1 bug, 1 missing test.
- The I2P
proxyis always"". Comment oncrates/rbitcoin-net/src/socks.rs. - The new
getnetworkinfotest cannot represent a SAM address or--proxy-randomize=0. Comment oncrates/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, |
There was a problem hiding this comment.
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(), |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
getnetworkinfoalways returned"networks": [](net.rs:374). Core lists ipv4, ipv6, onion, i2p and cjdns, each withlimited,reachable,proxyandproxy_randomize_credentials.Now each row comes from what the node actually does:
reachableisAddrMan::reachable, which also decides what gets dialed. It follows--only-net, a SOCKS proxy for onion,--i2p-samand--cjdns-reachable.proxyisDialer::proxy_for:--proxyfor 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 withnetworks: [].