Skip to content

Commit 1dd62c5

Browse files
committed
refactor: move GetServicesNames from rpc/util.{h,cpp} to rpc/net.cpp
as it is only called from that compilation unit. This avoids needlessly compiling GetServicesNames() in the 35 other files that include rpc/util.h.
1 parent abe4fed commit 1dd62c5

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

src/rpc/net.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <netbase.h>
1616
#include <node/context.h>
1717
#include <policy/settings.h>
18+
#include <protocol.h>
1819
#include <rpc/blockchain.h>
1920
#include <rpc/protocol.h>
2021
#include <rpc/server_util.h>
@@ -91,6 +92,18 @@ static RPCHelpMan ping()
9192
};
9293
}
9394

95+
/** Returns, given services flags, a list of humanly readable (known) network services */
96+
static UniValue GetServicesNames(ServiceFlags services)
97+
{
98+
UniValue servicesNames(UniValue::VARR);
99+
100+
for (const auto& flag : serviceFlagsToStr(services)) {
101+
servicesNames.push_back(flag);
102+
}
103+
104+
return servicesNames;
105+
}
106+
94107
static RPCHelpMan getpeerinfo()
95108
{
96109
return RPCHelpMan{

src/rpc/util.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1302,17 +1302,6 @@ std::vector<CScript> EvalDescriptorStringOrObject(const UniValue& scanobject, Fl
13021302
return ret;
13031303
}
13041304

1305-
UniValue GetServicesNames(ServiceFlags services)
1306-
{
1307-
UniValue servicesNames(UniValue::VARR);
1308-
1309-
for (const auto& flag : serviceFlagsToStr(services)) {
1310-
servicesNames.push_back(flag);
1311-
}
1312-
1313-
return servicesNames;
1314-
}
1315-
13161305
/** Convert a vector of bilingual strings to a UniValue::VARR containing their original untranslated values. */
13171306
[[nodiscard]] static UniValue BilingualStringsToUniValue(const std::vector<bilingual_str>& bilingual_strings)
13181307
{

src/rpc/util.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,6 @@ std::pair<int64_t, int64_t> ParseDescriptorRange(const UniValue& value);
132132
/** Evaluate a descriptor given as a string, or as a {"desc":...,"range":...} object, with default range of 1000. */
133133
std::vector<CScript> EvalDescriptorStringOrObject(const UniValue& scanobject, FlatSigningProvider& provider, const bool expand_priv = false);
134134

135-
/** Returns, given services flags, a list of humanly readable (known) network services */
136-
UniValue GetServicesNames(ServiceFlags services);
137-
138135
/**
139136
* Serializing JSON objects depends on the outer type. Only arrays and
140137
* dictionaries can be nested in json. The top-level outer type is "NONE".

0 commit comments

Comments
 (0)