Changeset View
Changeset View
Standalone View
Standalone View
src/protocol.cpp
Show First 20 Lines • Show All 248 Lines • ▼ Show 20 Lines | std::string CInv::ToString() const { | ||||
} catch (const std::out_of_range &) { | } catch (const std::out_of_range &) { | ||||
return strprintf("0x%08x %s", type, hash.ToString()); | return strprintf("0x%08x %s", type, hash.ToString()); | ||||
} | } | ||||
} | } | ||||
const std::vector<std::string> &getAllNetMessageTypes() { | const std::vector<std::string> &getAllNetMessageTypes() { | ||||
return allNetMessageTypesVec; | return allNetMessageTypesVec; | ||||
} | } | ||||
std::string serviceFlagToStr(const uint64_t mask, const int bit) { | |||||
switch (ServiceFlags(mask)) { | |||||
case NODE_NONE: | |||||
// impossible | |||||
abort(); | |||||
case NODE_NETWORK: | |||||
return "NETWORK"; | |||||
case NODE_GETUTXO: | |||||
return "GETUTXO"; | |||||
case NODE_BLOOM: | |||||
return "BLOOM"; | |||||
case NODE_XTHIN: | |||||
return "XTHIN"; | |||||
case NODE_NETWORK_LIMITED: | |||||
return "NETWORK_LIMITED"; | |||||
case NODE_AVALANCHE: | |||||
return "AVALANCHE"; | |||||
default: | |||||
std::ostringstream stream; | |||||
stream.imbue(std::locale::classic()); | |||||
stream << "UNKNOWN["; | |||||
if (bit < 8) { | |||||
stream << mask; | |||||
} else { | |||||
stream << "2^" << bit; | |||||
} | |||||
stream << "]"; | |||||
return stream.str(); | |||||
} | |||||
} |