Skip to content

Conversation

@sedited
Copy link
Contributor

@sedited sedited commented Nov 13, 2023

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.

Also remove an assert that is already enforced by the compiler checking
that the length of the std::array matches.
@sedited sedited force-pushed the netSerializationFollowup branch from 151ad29 to 1e5b861 Compare November 13, 2023 13:18
@sedited sedited 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

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
@bitcoin bitcoin locked and limited conversation to collaborators Nov 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

Status: Done or Closed or Rethinking

Development

Successfully merging this pull request may close these issues.

5 participants