mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 06:58:57 +01:00
Merge #18165: Consolidate service flag bit-to-name conversion to a shared serviceFlagToStr function
c31bc5bcfdConsolidate service flag bit-to-name conversion to a shared serviceFlagToStr function (Luke Dashjr)cea91a1e40Bugfix: GUI: Use unsigned long long type to avoid implicit conversion of MSB check (Luke Dashjr) Pull request description: Side effect: this results in the RPC showing unknown service bits as "UNKNOWN[n]" like the GUI. Note that there is no common mask-to-`vector<string>` function because both GUI and RPC would need to iterate through it to convert to their desired target formats. ACKs for top commit: jonasschnelli: utACK ~~cea91a1e40e12029140ebfba969ce3ef2965029c~~c31bc5bcfdTree-SHA512: 32c7ba8ac7ef2d4087f4f317447ae93a328ec9fb9ad81301df2fbaeeb21a3db7a503187a369552b05a9414251b7cf8e15bcde74c1ea2ef36591ea7ffb6721f60
This commit is contained in:
@@ -841,18 +841,15 @@ std::vector<CScript> EvalDescriptorStringOrObject(const UniValue& scanobject, Fl
|
||||
|
||||
UniValue GetServicesNames(ServiceFlags services)
|
||||
{
|
||||
const uint64_t services_n = services;
|
||||
UniValue servicesNames(UniValue::VARR);
|
||||
|
||||
if (services & NODE_NETWORK)
|
||||
servicesNames.push_back("NETWORK");
|
||||
if (services & NODE_GETUTXO)
|
||||
servicesNames.push_back("GETUTXO");
|
||||
if (services & NODE_BLOOM)
|
||||
servicesNames.push_back("BLOOM");
|
||||
if (services & NODE_WITNESS)
|
||||
servicesNames.push_back("WITNESS");
|
||||
if (services & NODE_NETWORK_LIMITED)
|
||||
servicesNames.push_back("NETWORK_LIMITED");
|
||||
for (int i = 0; i < 64; ++i) {
|
||||
const uint64_t mask = 1ull << i;
|
||||
if (services_n & mask) {
|
||||
servicesNames.push_back(serviceFlagToStr(mask, i));
|
||||
}
|
||||
}
|
||||
|
||||
return servicesNames;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user