diff options
author | Wladimir J. van der Laan <laanwj@protonmail.com> | 2020-11-09 17:03:37 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@protonmail.com> | 2020-11-09 17:07:23 +0100 |
commit | 79a3b59cc70622fbadc43ade5fce31fcf94d852d (patch) | |
tree | e57248e1840572b8ef9b02625f8faf317d530c64 /src/rpc | |
parent | 4fd37d0a104ff1b05a3c8e374af9b2c92a0078c2 (diff) | |
parent | 7b5bd3102e06f7ff34b5d0f1d45a005560f265a5 (diff) |
Merge #20120: net, rpc, test, bugfix: update GetNetworkName, GetNetworksInfo, regression tests
7b5bd3102e06f7ff34b5d0f1d45a005560f265a5 test: add getnetworkinfo network name regression tests (Jon Atack)
9a75e1e5697476058b56cd8014a36de31bfecd4c rpc: update GetNetworksInfo() to not return unsupported networks (Jon Atack)
ba8997fb2eda73603ce457bfec668cb7e0acbc89 net: update GetNetworkName() with all enum Network cases (Jon Atack)
Pull request description:
Following up on the BIP155 addrv2 changes, and starting with 7be6ff6 in #19845, RPC getnetworkinfo began returning networks with empty names.
<details><summary><code>getnetworkinfo</code> on current master</summary><p>
```
"networks": [
{
"name": "ipv4",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "ipv6",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "onion",
"limited": false,
"reachable": true,
"proxy": "127.0.0.1:9050",
"proxy_randomize_credentials": true
},
{
"name": "",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
}
],
```
</p></details>
<details><summary><code>getnetworkinfo</code> on this branch</summary><p>
```
"networks": [
{
"name": "ipv4",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "ipv6",
"limited": false,
"reachable": true,
"proxy": "",
"proxy_randomize_credentials": false
},
{
"name": "onion",
"limited": false,
"reachable": true,
"proxy": "127.0.0.1:9050",
"proxy_randomize_credentials": true
}
],
```
</p></details>
This patch:
- updates `GetNetworkName()` to the current Network enum
- updates `getNetworksInfo()` to ignore as-yet unsupported networks
- adds regression tests
ACKs for top commit:
hebasto:
re-ACK 7b5bd3102e06f7ff34b5d0f1d45a005560f265a5
vasild:
ACK 7b5bd3102
Tree-SHA512: 8f12363eb430e6f45e59e3b1d69c2f2eb5ead254ce7a67547d116c3b70138d763157335a3c85b51f684a3b3b502c6aace4f6fa60ac3b988cf7a9475a7423c4d7
Diffstat (limited to 'src/rpc')
-rw-r--r-- | src/rpc/net.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/rpc/net.cpp b/src/rpc/net.cpp index b81e6414a5..f98ea63782 100644 --- a/src/rpc/net.cpp +++ b/src/rpc/net.cpp @@ -497,11 +497,9 @@ static RPCHelpMan getnettotals() static UniValue GetNetworksInfo() { UniValue networks(UniValue::VARR); - for(int n=0; n<NET_MAX; ++n) - { + for (int n = 0; n < NET_MAX; ++n) { enum Network network = static_cast<enum Network>(n); - if(network == NET_UNROUTABLE || network == NET_INTERNAL) - continue; + if (network == NET_UNROUTABLE || network == NET_I2P || network == NET_CJDNS || network == NET_INTERNAL) continue; proxyType proxy; UniValue obj(UniValue::VOBJ); GetProxy(network, proxy); |