mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-10 20:03:34 -03:00
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.
This commit is contained in:
parent
abe4fedab7
commit
1dd62c5295
3 changed files with 13 additions and 14 deletions
|
@ -15,6 +15,7 @@
|
||||||
#include <netbase.h>
|
#include <netbase.h>
|
||||||
#include <node/context.h>
|
#include <node/context.h>
|
||||||
#include <policy/settings.h>
|
#include <policy/settings.h>
|
||||||
|
#include <protocol.h>
|
||||||
#include <rpc/blockchain.h>
|
#include <rpc/blockchain.h>
|
||||||
#include <rpc/protocol.h>
|
#include <rpc/protocol.h>
|
||||||
#include <rpc/server_util.h>
|
#include <rpc/server_util.h>
|
||||||
|
@ -91,6 +92,18 @@ static RPCHelpMan ping()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Returns, given services flags, a list of humanly readable (known) network services */
|
||||||
|
static UniValue GetServicesNames(ServiceFlags services)
|
||||||
|
{
|
||||||
|
UniValue servicesNames(UniValue::VARR);
|
||||||
|
|
||||||
|
for (const auto& flag : serviceFlagsToStr(services)) {
|
||||||
|
servicesNames.push_back(flag);
|
||||||
|
}
|
||||||
|
|
||||||
|
return servicesNames;
|
||||||
|
}
|
||||||
|
|
||||||
static RPCHelpMan getpeerinfo()
|
static RPCHelpMan getpeerinfo()
|
||||||
{
|
{
|
||||||
return RPCHelpMan{
|
return RPCHelpMan{
|
||||||
|
|
|
@ -1302,17 +1302,6 @@ std::vector<CScript> EvalDescriptorStringOrObject(const UniValue& scanobject, Fl
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
UniValue GetServicesNames(ServiceFlags services)
|
|
||||||
{
|
|
||||||
UniValue servicesNames(UniValue::VARR);
|
|
||||||
|
|
||||||
for (const auto& flag : serviceFlagsToStr(services)) {
|
|
||||||
servicesNames.push_back(flag);
|
|
||||||
}
|
|
||||||
|
|
||||||
return servicesNames;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Convert a vector of bilingual strings to a UniValue::VARR containing their original untranslated values. */
|
/** Convert a vector of bilingual strings to a UniValue::VARR containing their original untranslated values. */
|
||||||
[[nodiscard]] static UniValue BilingualStringsToUniValue(const std::vector<bilingual_str>& bilingual_strings)
|
[[nodiscard]] static UniValue BilingualStringsToUniValue(const std::vector<bilingual_str>& bilingual_strings)
|
||||||
{
|
{
|
||||||
|
|
|
@ -132,9 +132,6 @@ std::pair<int64_t, int64_t> ParseDescriptorRange(const UniValue& value);
|
||||||
/** Evaluate a descriptor given as a string, or as a {"desc":...,"range":...} object, with default range of 1000. */
|
/** Evaluate a descriptor given as a string, or as a {"desc":...,"range":...} object, with default range of 1000. */
|
||||||
std::vector<CScript> EvalDescriptorStringOrObject(const UniValue& scanobject, FlatSigningProvider& provider, const bool expand_priv = false);
|
std::vector<CScript> EvalDescriptorStringOrObject(const UniValue& scanobject, FlatSigningProvider& provider, const bool expand_priv = false);
|
||||||
|
|
||||||
/** Returns, given services flags, a list of humanly readable (known) network services */
|
|
||||||
UniValue GetServicesNames(ServiceFlags services);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Serializing JSON objects depends on the outer type. Only arrays and
|
* Serializing JSON objects depends on the outer type. Only arrays and
|
||||||
* dictionaries can be nested in json. The top-level outer type is "NONE".
|
* dictionaries can be nested in json. The top-level outer type is "NONE".
|
||||||
|
|
Loading…
Reference in a new issue