diff options
author | TheCharlatan <seb.kung@gmail.com> | 2023-11-11 13:04:18 +0100 |
---|---|---|
committer | TheCharlatan <seb.kung@gmail.com> | 2023-11-13 14:17:59 +0100 |
commit | d49d1988406f2f0d350bc5b552625f9823090130 (patch) | |
tree | 3b8d62ad7be7783a0cb0d51699ca43ac1aa177ee /src/net.cpp | |
parent | 8243762700bc6e7876ae5d4fc000500858b99f66 (diff) | |
download | bitcoin-d49d1988406f2f0d350bc5b552625f9823090130.tar.xz |
refactor: Initialize magic bytes in constructor initializer
Also remove an assert that is already enforced by the compiler checking
that the length of the std::array matches.
Diffstat (limited to 'src/net.cpp')
-rw-r--r-- | src/net.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/net.cpp b/src/net.cpp index 4aee78846a..a2f80cbcf7 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -684,10 +684,8 @@ bool CNode::ReceiveMsgBytes(Span<const uint8_t> msg_bytes, bool& complete) } V1Transport::V1Transport(const NodeId node_id, int nTypeIn, int nVersionIn) noexcept : - m_node_id(node_id), hdrbuf(nTypeIn, nVersionIn), vRecv(nTypeIn, nVersionIn) + m_magic_bytes{Params().MessageStart()}, m_node_id(node_id), hdrbuf(nTypeIn, nVersionIn), vRecv(nTypeIn, nVersionIn) { - assert(std::size(Params().MessageStart()) == std::size(m_magic_bytes)); - m_magic_bytes = Params().MessageStart(); LOCK(m_recv_mutex); Reset(); } |