aboutsummaryrefslogtreecommitdiff
path: root/src/protocol.cpp
diff options
context:
space:
mode:
authorVasil Dimov <vd@FreeBSD.org>2023-11-16 12:34:27 +0100
committerVasil Dimov <vd@FreeBSD.org>2024-02-28 18:03:22 +0100
commit2fa9de06c2c8583ee8e2434dc97014b26e218ab5 (patch)
tree3e55459da61c2ac8e903e537a9e6cd669f4f4345 /src/protocol.cpp
parentba907f96ad37c09c49c0e1532fad118fcb8dd4a8 (diff)
downloadbitcoin-2fa9de06c2c8583ee8e2434dc97014b26e218ab5.tar.xz
net: make the list of known message types a compile time constant
Turn the `std::vector` to `std::array` because it is cheaper and allows us to have the number of the messages as a compile time constant: `ALL_NET_MESSAGE_TYPES.size()` which can be used in future code to build other `std::array`s with that size.
Diffstat (limited to 'src/protocol.cpp')
-rw-r--r--src/protocol.cpp46
1 files changed, 0 insertions, 46 deletions
diff --git a/src/protocol.cpp b/src/protocol.cpp
index 0da160768d..b85571315a 100644
--- a/src/protocol.cpp
+++ b/src/protocol.cpp
@@ -47,47 +47,6 @@ const char* WTXIDRELAY = "wtxidrelay";
const char* SENDTXRCNCL = "sendtxrcncl";
} // namespace NetMsgType
-/** All known message types. Keep this in the same order as the list of
- * messages above and in protocol.h.
- */
-const static std::vector<std::string> g_all_net_message_types{
- NetMsgType::VERSION,
- NetMsgType::VERACK,
- NetMsgType::ADDR,
- NetMsgType::ADDRV2,
- NetMsgType::SENDADDRV2,
- NetMsgType::INV,
- NetMsgType::GETDATA,
- NetMsgType::MERKLEBLOCK,
- NetMsgType::GETBLOCKS,
- NetMsgType::GETHEADERS,
- NetMsgType::TX,
- NetMsgType::HEADERS,
- NetMsgType::BLOCK,
- NetMsgType::GETADDR,
- NetMsgType::MEMPOOL,
- NetMsgType::PING,
- NetMsgType::PONG,
- NetMsgType::NOTFOUND,
- NetMsgType::FILTERLOAD,
- NetMsgType::FILTERADD,
- NetMsgType::FILTERCLEAR,
- NetMsgType::SENDHEADERS,
- NetMsgType::FEEFILTER,
- NetMsgType::SENDCMPCT,
- NetMsgType::CMPCTBLOCK,
- NetMsgType::GETBLOCKTXN,
- NetMsgType::BLOCKTXN,
- NetMsgType::GETCFILTERS,
- NetMsgType::CFILTER,
- NetMsgType::GETCFHEADERS,
- NetMsgType::CFHEADERS,
- NetMsgType::GETCFCHECKPT,
- NetMsgType::CFCHECKPT,
- NetMsgType::WTXIDRELAY,
- NetMsgType::SENDTXRCNCL,
-};
-
CMessageHeader::CMessageHeader(const MessageStartChars& pchMessageStartIn, const char* pszCommand, unsigned int nMessageSizeIn)
: pchMessageStart{pchMessageStartIn}
{
@@ -164,11 +123,6 @@ std::string CInv::ToString() const
}
}
-const std::vector<std::string> &getAllNetMessageTypes()
-{
- return g_all_net_message_types;
-}
-
/**
* Convert a service flag (NODE_*) to a human readable string.
* It supports unknown service flags which will be returned as "UNKNOWN[...]".