This is a followup-PR for #28423
- Initialize magic bytes in constructor
- Add a small unit test for serializing arrays.
This is a followup-PR for #28423
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--006a51241073e994b41acfe9ec718e94-->
For detailed information about the code coverage, see the test coverage report.
<!--021abf342d371248e50ceaed478a90ca-->
See the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.
<!--174a7506f384e20aa4161008e828411d-->
Reviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
89 | @@ -90,10 +90,9 @@ const static std::vector<std::string> g_all_net_message_types{ 90 | NetMsgType::SENDTXRCNCL, 91 | }; 92 | 93 | -CMessageHeader::CMessageHeader(const MessageStartChars& pchMessageStartIn, const char* pszCommand, unsigned int nMessageSizeIn) 94 | +CMessageHeader::CMessageHeader(const MessageStartChars& pchMessageStartIn, const char* pszCommand, unsigned int nMessageSizeIn) : 95 | + pchMessageStart{pchMessageStartIn}
CMessageHeader::CMessageHeader(const MessageStartChars& pchMessageStartIn, const char* pszCommand, unsigned int nMessageSizeIn)
: pchMessageStart{pchMessageStartIn}
nit: on the next line, according to clang-format?
Thanks, pushed.
Also remove an assert that is already enforced by the compiler checking
that the length of the std::array matches.
utACK 1e5b86171e81ab4b022b9746bb06e1968ecf4086
84 | @@ -85,6 +85,8 @@ BOOST_AUTO_TEST_CASE(sizes) 85 | BOOST_CHECK_EQUAL(GetSerializeSize(int64_t(0), 0), 8U); 86 | BOOST_CHECK_EQUAL(GetSerializeSize(uint64_t(0), 0), 8U); 87 | BOOST_CHECK_EQUAL(GetSerializeSize(bool(0), 0), 1U); 88 | + BOOST_CHECK_EQUAL(GetSerializeSize(std::array<uint8_t, 1>{0}, 0), 1U); 89 | + BOOST_CHECK_EQUAL(GetSerializeSize(std::array<uint8_t, 2>{0, 0}, 0), 2U);
BOOST_CHECK_EQUAL(GetSerializeSize(std::array<uint8_t, 2>{}, 0), 2U);
nit: I think array will fill itself with zeros if they are omitted
lgtm ACK 1e5b86171e81ab4b022b9746bb06e1968ecf4086