mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 06:58:57 +01:00
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.
This commit is contained in:
@@ -3701,8 +3701,9 @@ CNode::CNode(NodeId idIn,
|
||||
{
|
||||
if (inbound_onion) assert(conn_type_in == ConnectionType::INBOUND);
|
||||
|
||||
for (const std::string &msg : getAllNetMessageTypes())
|
||||
for (const auto& msg : ALL_NET_MESSAGE_TYPES) {
|
||||
mapRecvBytesPerMsgType[msg] = 0;
|
||||
}
|
||||
mapRecvBytesPerMsgType[NET_MESSAGE_TYPE_OTHER] = 0;
|
||||
|
||||
if (fLogIPs) {
|
||||
|
||||
Reference in New Issue
Block a user