refactor: Pass reference to last header, not pointer #26378

pull maflcko wants to merge 1 commits into bitcoin:master from maflcko:2210-p2p-less-pointers-🍟 changing 1 files +19 −20
  1. maflcko commented at 12:56 PM on October 24, 2022: member

    It is never a nullptr, otherwise an assertion would fire in UpdatePeerStateForReceivedHeaders.

    Passing a reference makes the code easier to read and less brittle.

  2. refactor: Pass reference to last header, not pointer
    It is never a nullptr, otherwise an assertion would fire in
    UpdatePeerStateForReceivedHeaders.
    
    Passing a reference makes the code easier to read and less brittle.
    fa579f3063
  3. DrahtBot added the label Refactoring on Oct 24, 2022
  4. DrahtBot commented at 10:24 PM on October 24, 2022: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process.

    Type Count Reviewers
    ACK 2 aureleoules, john-moffett
    Concept ACK 1 dergoegge

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #26140 (refactor: Move CNodeState members guarded by g_msgproc_mutex to Peer by dergoegge)
    • #25268 (refactor: Introduce EvictionManager by dergoegge)
    • #24571 (p2p: Prevent block index fingerprinting by sending additional getheaders messages by dergoegge)

    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.

  5. dergoegge commented at 10:52 AM on October 25, 2022: member

    Concept ACK

  6. john-moffett commented at 5:04 PM on November 1, 2022: contributor

    ACK fa579f3

    Code review and rebased on master. Built/tests/ran bitcoind. Agree with using assert instead of Assume. The renamed parameters are clearer.

    I don't know the policy on unrelated spelling corrections, but maybe this is a good place to fix the log line at 2867: https://github.com/bitcoin/bitcoin/blob/fa579f306363ed03c1138121415b67b9b36b4d53/src/net_processing.cpp#L2867

    I think it should read "to send to" rather than "to end to".

  7. maflcko commented at 5:24 PM on November 1, 2022: member

    "to end" is correct, meaning "to their chain tip"

  8. aureleoules approved
  9. aureleoules commented at 3:07 PM on November 17, 2022: member

    ACK fa579f306363ed03c1138121415b67b9b36b4d53

  10. maflcko merged this on Dec 8, 2022
  11. maflcko closed this on Dec 8, 2022

  12. maflcko deleted the branch on Dec 8, 2022
  13. sidhujag referenced this in commit fdda07dc55 on Dec 8, 2022
  14. bitcoin locked this on Dec 8, 2023

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-22 06:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me