diff options
author | Jon Atack <jon@atack.com> | 2020-08-13 16:51:22 +0200 |
---|---|---|
committer | Jon Atack <jon@atack.com> | 2020-08-31 16:12:01 +0200 |
commit | c227100919dd2422b29eb3bca9c0f1a7983cc3a8 (patch) | |
tree | 97498b178d5244cbe4287a2f2f2c5f9e5db583ae /src/bitcoin-cli.cpp | |
parent | d3f77b736e43b187771b901a6a3452f83c116918 (diff) |
cli: create local addresses, ports, and scores report
Diffstat (limited to 'src/bitcoin-cli.cpp')
-rw-r--r-- | src/bitcoin-cli.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index 7833aa946c..ac59665c12 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -387,6 +387,17 @@ public: result += strprintf("out %5i %5i %5i %5i %5i\n", ipv4_o, ipv6_o, onion_o, total_o, block_relay_o); result += strprintf("total %5i %5i %5i %5i %5i\n", ipv4_i + ipv4_o, ipv6_i + ipv6_o, onion_i + onion_o, total_i + total_o, block_relay_i + block_relay_o); + // Report local addresses, ports, and scores. + result += "\nLocal addresses"; + const UniValue& local_addrs{networkinfo["localaddresses"]}; + if (local_addrs.empty()) { + result += ": n/a\n"; + } else { + for (const UniValue& addr : local_addrs.getValues()) { + result += strprintf("\n%-40i port %5i score %6i", addr["address"].get_str(), addr["port"].get_int(), addr["score"].get_int()); + } + } + return JSONRPCReplyObj(UniValue{result}, NullUniValue, 1); } }; |