Merge #18165: Consolidate service flag bit-to-name conversion to a shared serviceFlagToStr function

c31bc5bcfd Consolidate service flag bit-to-name conversion to a shared serviceFlagToStr function (Luke Dashjr)
cea91a1e40 Bugfix: 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~~ c31bc5bcfd

Tree-SHA512: 32c7ba8ac7ef2d4087f4f317447ae93a328ec9fb9ad81301df2fbaeeb21a3db7a503187a369552b05a9414251b7cf8e15bcde74c1ea2ef36591ea7ffb6721f60
This commit is contained in:
Jonas Schnelli
2020-05-29 11:06:03 +02:00
4 changed files with 36 additions and 31 deletions

View File

@@ -257,7 +257,7 @@ const std::vector<std::string>& getAllNetMessageTypes();
/** nServices flags */
enum ServiceFlags : uint64_t {
// NOTE: When adding here, be sure to update qt/guiutil.cpp's formatServicesStr too
// NOTE: When adding here, be sure to update serviceFlagToStr too
// Nothing
NODE_NONE = 0,
// NODE_NETWORK means that the node is capable of serving the complete block chain. It is currently
@@ -288,6 +288,8 @@ enum ServiceFlags : uint64_t {
// BIP process.
};
std::string serviceFlagToStr(uint64_t mask, int bit);
/**
* Gets the set of service flags which are "desirable" for a given peer.
*