Consolidate service flag bit-to-name conversion to a shared serviceFlagToStr function

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.
This commit is contained in:
Luke Dashjr
2020-02-17 01:53:13 +00:00
parent cea91a1e40
commit c31bc5bcfd
4 changed files with 35 additions and 30 deletions

View File

@@ -237,7 +237,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
@@ -268,6 +268,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.
*