From f7d2db28e90297664390d527881ebbbf2c6ce6f0 Mon Sep 17 00:00:00 2001 From: Jon Atack Date: Sun, 16 Feb 2025 09:22:46 -0600 Subject: [PATCH] netinfo: return shortened services, if peers list requested When the detailed peers list is requested, return the shortened services in the -netinfo header in the same format as the "serv" column, instead of the full names list in the report. --- src/bitcoin-cli.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index 1f4b512f420..56f2a906b5f 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -566,7 +566,8 @@ public: } // Generate report header. - std::string result{strprintf("%s client %s%s - server %i%s\n\n", CLIENT_NAME, FormatFullVersion(), ChainToString(), networkinfo["protocolversion"].getInt(), networkinfo["subversion"].get_str())}; + const std::string services{DetailsRequested() ? strprintf(" - services %s", FormatServices(networkinfo["localservicesnames"])) : ""}; + std::string result{strprintf("%s client %s%s - server %i%s%s\n\n", CLIENT_NAME, FormatFullVersion(), ChainToString(), networkinfo["protocolversion"].getInt(), networkinfo["subversion"].get_str(), services)}; // Report detailed peer connections list sorted by direction and minimum ping time. if (DetailsRequested() && !m_peers.empty()) { @@ -648,7 +649,9 @@ public: } // Report local services, addresses, ports, and scores. - result += strprintf("\n\nLocal services: %s", ServicesList(networkinfo["localservicesnames"])); + if (!DetailsRequested()) { + result += strprintf("\n\nLocal services: %s", ServicesList(networkinfo["localservicesnames"])); + } result += "\n\nLocal addresses"; const std::vector& local_addrs{networkinfo["localaddresses"].getValues()}; if (local_addrs.empty()) {