Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test, refactor: Magic bytes array followup #28857

Merged
merged 2 commits into from
Nov 14, 2023

Conversation

TheCharlatan
Copy link
Contributor

This is a followup-PR for #28423

  • Initialize magic bytes in constructor
  • Add a small unit test for serializing arrays.

@DrahtBot
Copy link
Contributor

DrahtBot commented Nov 13, 2023

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Code Coverage

For detailed information about the code coverage, see the test coverage report.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK sipa, maflcko

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #28686 (refactor: Split per-peer parts of net module into new node/connection module by ajtowns)
  • #28451 (refactor: Remove unused SER_DISK, SER_NETWORK, SER_GETHASH by maflcko)

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.

src/protocol.cpp Outdated Show resolved Hide resolved
Also remove an assert that is already enforced by the compiler checking
that the length of the std::array matches.
@TheCharlatan TheCharlatan marked this pull request as ready for review November 13, 2023 13:22
@sipa
Copy link
Member

sipa commented Nov 13, 2023

utACK 1e5b861

Copy link
Member

@maflcko maflcko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm ACK 1e5b861

@@ -85,6 +85,8 @@ BOOST_AUTO_TEST_CASE(sizes)
BOOST_CHECK_EQUAL(GetSerializeSize(int64_t(0), 0), 8U);
BOOST_CHECK_EQUAL(GetSerializeSize(uint64_t(0), 0), 8U);
BOOST_CHECK_EQUAL(GetSerializeSize(bool(0), 0), 1U);
BOOST_CHECK_EQUAL(GetSerializeSize(std::array<uint8_t, 1>{0}, 0), 1U);
BOOST_CHECK_EQUAL(GetSerializeSize(std::array<uint8_t, 2>{0, 0}, 0), 2U);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

@fanquake fanquake merged commit 8992a34 into bitcoin:master Nov 14, 2023
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done or Closed or Rethinking
Development

Successfully merging this pull request may close these issues.

None yet

5 participants