refactor: Make CTransaction constructor explicit #25694

pull MarcoFalke wants to merge 1 commits into bitcoin:master from MarcoFalke:2207-tx-exp-📏 changing 4 files +30 −16
  1. MarcoFalke commented at 10:17 AM on July 25, 2022: member

    It involves calculating two hashes, so the performance impact should be made explicit.

    Also, add the module to iwyu.

  2. refactor: Make CTransaction constructor explicit
    It involves calculating two hashes, so the performance impact should be
    made explicit.
    
    Also, add the module to iwyu.
    fa2247a9f9
  3. DrahtBot added the label Refactoring on Jul 25, 2022
  4. hebasto approved
  5. hebasto commented at 1:29 PM on July 25, 2022: member

    ACK fa2247a9f9754d90ea60f254f6c0ed881c55772b, I have reviewed the code and it looks OK, I agree it can be merged.

  6. aureleoules commented at 2:14 PM on July 25, 2022: member

    ACK fa2247a9f9754d90ea60f254f6c0ed881c55772b. In my understanding, these changes disable copy-initialization of CTransaction to avoid potentially hashing twice.

    On a related note, should we make all single-argument constructors explicit ? https://github.com/isocpp/CppCoreGuidelines/blob/6f27719b2b994d1304f78194dc7824e4ddeea5f5/CppCoreGuidelines.md#c46-by-default-declare-single-argument-constructors-explicit

  7. MarcoFalke commented at 2:18 PM on July 25, 2022: member

    In my understanding, these changes disable copy-initialization of CTransaction to avoid potentially hashing twice.

    Not sure what you mean, but this should not change any constructor or code logic. This simply forces devs to write CTransaction at least once if they want to construct one.

    On a related note, should we make all single-argument constructors explicit ? https://github.com/isocpp/CppCoreGuidelines/blob/6f27719b2b994d1304f78194dc7824e4ddeea5f5/CppCoreGuidelines.md#c46-by-default-declare-single-argument-constructors-explicit

    Probably not, as the url you link to advises against that.

  8. DrahtBot commented at 6:29 PM on July 25, 2022: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #17529 (rpc: Faster getblock using PureBlock by MarcoFalke)

    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.

  9. MarcoFalke merged this on Jul 26, 2022
  10. MarcoFalke closed this on Jul 26, 2022

  11. sidhujag referenced this in commit c1cc218475 on Jul 27, 2022
  12. bitcoin locked this on Jul 26, 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-17 06:13 UTC

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