refactor: Remove duplicate allNetMessageTypesVec

With C++11 (and later), the duplicate variable is no longer needed.

Also, run clang-format on the namespace, as the script in the next
commit relies on a specific format. This prevents a clang-format run in
the future from breaking the script. (Review hint: --ignore-all-space).
This commit is contained in:
MarcoFalke
2023-07-11 15:44:43 +02:00
parent 21ed784614
commit fa1471e575

View File

@ -52,7 +52,7 @@ const char *SENDTXRCNCL="sendtxrcncl";
/** All known message types. Keep this in the same order as the list of
* messages above and in protocol.h.
*/
const static std::string allNetMessageTypes[] = {
const static std::vector<std::string> g_all_net_message_types{
NetMsgType::VERSION,
NetMsgType::VERACK,
NetMsgType::ADDR,
@ -89,7 +89,6 @@ const static std::string allNetMessageTypes[] = {
NetMsgType::WTXIDRELAY,
NetMsgType::SENDTXRCNCL,
};
const static std::vector<std::string> allNetMessageTypesVec(std::begin(allNetMessageTypes), std::end(allNetMessageTypes));
CMessageHeader::CMessageHeader(const MessageStartChars& pchMessageStartIn, const char* pszCommand, unsigned int nMessageSizeIn)
{
@ -182,7 +181,7 @@ std::string CInv::ToString() const
const std::vector<std::string> &getAllNetMessageTypes()
{
return allNetMessageTypesVec;
return g_all_net_message_types;
}
/**