aboutsummaryrefslogtreecommitdiff
path: root/src/net.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/net.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/net.cpp')
-rw-r--r--src/net.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/net.cpp b/src/net.cpp
index 7c82f01d75..74f1eea485 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -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) {