MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / serviceFlagToStr

Function serviceFlagToStr

src/protocol.cpp:91–106  ·  view source on GitHub ↗

* Convert a service flag (NODE_*) to a human readable string. * It supports unknown service flags which will be returned as "UNKNOWN[...]". * @param[in] bit the service flag is calculated as (1 << bit) */

Source from the content-addressed store, hash-verified

89 * @param[in] bit the service flag is calculated as (1 << bit)
90 */
91static std::string serviceFlagToStr(size_t bit)
92{
93 const uint64_t service_flag = 1ULL << bit;
94 switch ((ServiceFlags)service_flag) {
95 case NODE_NONE: abort(); // impossible
96 case NODE_NETWORK: return "NETWORK";
97 case NODE_BLOOM: return "BLOOM";
98 case NODE_WITNESS: return "WITNESS";
99 case NODE_COMPACT_FILTERS: return "COMPACT_FILTERS";
100 case NODE_NETWORK_LIMITED: return "NETWORK_LIMITED";
101 case NODE_P2P_V2: return "P2P_V2";
102 // Not using default, so we get warned when a case is missing
103 }
104
105 return strprintf("UNKNOWN[2^%u]", bit);
106}
107
108std::vector<std::string> serviceFlagsToStr(uint64_t flags)
109{

Callers 1

serviceFlagsToStrFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected