aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/util.cpp
diff options
context:
space:
mode:
authorVasil Dimov <vd@FreeBSD.org>2020-05-29 18:52:59 +0200
committerVasil Dimov <vd@FreeBSD.org>2020-05-29 18:59:37 +0200
commit189ae0c38b7d4927c5c73b94664e9542b2b06ed9 (patch)
tree5c2e119d4e08d23351a53f15c558ebc6178a863b /src/rpc/util.cpp
parentfbacad1880341ace31f669530c66d4e322d19235 (diff)
util: dedup code in callers of serviceFlagToStr()
Introduce `serviceFlagsToStr()` which hides the internals of the bitmask and simplifies callers of `serviceFlagToStr()`.
Diffstat (limited to 'src/rpc/util.cpp')
-rw-r--r--src/rpc/util.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/rpc/util.cpp b/src/rpc/util.cpp
index 6cd4c2664d..39bf05fbbd 100644
--- a/src/rpc/util.cpp
+++ b/src/rpc/util.cpp
@@ -841,14 +841,10 @@ std::vector<CScript> EvalDescriptorStringOrObject(const UniValue& scanobject, Fl
UniValue GetServicesNames(ServiceFlags services)
{
- const uint64_t services_n = services;
UniValue servicesNames(UniValue::VARR);
- for (int i = 0; i < 64; ++i) {
- const uint64_t mask = 1ull << i;
- if (services_n & mask) {
- servicesNames.push_back(serviceFlagToStr(i));
- }
+ for (const auto& flag : serviceFlagsToStr(services)) {
+ servicesNames.push_back(flag);
}
return servicesNames;