mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-08-24 17:41:40 +02:00
netinfo: return local services in the default report
Credit to l0rinc for refactoring ServicesList(). Co-authored-by: l0rinc <pap.lorinc@gmail.com> Co-authored-by: Daniela Brozzoni <danielabrozzoni@protonmail.com>
This commit is contained in:
@@ -463,6 +463,17 @@ private:
|
||||
}
|
||||
return str;
|
||||
}
|
||||
static std::string ServicesList(const UniValue& services)
|
||||
{
|
||||
std::string str{services.size() ? services[0].get_str() : ""};
|
||||
for (size_t i{1}; i < services.size(); ++i) {
|
||||
str += ", " + services[i].get_str();
|
||||
}
|
||||
for (auto& c: str) {
|
||||
c = (c == '_' ? ' ' : ToLower(c));
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
public:
|
||||
static constexpr int ID_PEERINFO = 0;
|
||||
@@ -636,7 +647,8 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
// Report local addresses, ports, and scores.
|
||||
// Report local services, addresses, ports, and scores.
|
||||
result += strprintf("\n\nLocal services: %s", ServicesList(networkinfo["localservicesnames"]));
|
||||
result += "\n\nLocal addresses";
|
||||
const std::vector<UniValue>& local_addrs{networkinfo["localaddresses"].getValues()};
|
||||
if (local_addrs.empty()) {
|
||||
|
Reference in New Issue
Block a user