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

refactor: make active_chain_tip a reference #25677

Merged
merged 1 commit into from
Aug 12, 2022

Conversation

aureleoules
Copy link
Member

This PR fixes a TODO introduced in #21055.

Makes active_chain_tip argument in CheckFinalTxAtTip function a reference instead of a pointer.

@DrahtBot
Copy link
Contributor

DrahtBot commented Jul 23, 2022

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

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #25073 (test: Cleanup miner_tests by MarcoFalke)
  • #23897 (refactor: Move calculation logic out from CheckSequenceLocksAtTip() by hebasto)

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.

@fanquake
Copy link
Member

fanquake commented Aug 5, 2022

cc @MarcoFalke @dongcarl re #20750 (comment).

@dongcarl
Copy link
Contributor

ACK 9376a6d

I'm guessing cuz the reference is const it's getting lifetime extension?

@maflcko maflcko merged commit 27724c2 into bitcoin:master Aug 12, 2022
@maflcko
Copy link
Member

maflcko commented Aug 12, 2022

I'm guessing cuz the reference is const it's getting lifetime extension?

I don't think any lifetimes change here, as passing a reference as a parameter is lifetime-wise identical to passing a pointer. Also, lifetimes shouldn't matter here, as the function does not return the reference/pointer or otherwise stores it in memory that survives past the return of the function.

If you are asking whether a temporary can now be passed into the function: Then yes, this is now possible and legal C++ code. However for the purposes of our validation code creating a temporary is just as illegal as creating a copy, see #25311.

sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Aug 12, 2022
9376a6d refactor: make active_chain_tip a reference (Aurèle Oulès)

Pull request description:

  This PR fixes a TODO introduced in bitcoin#21055.

  Makes `active_chain_tip` argument in `CheckFinalTxAtTip` function a reference instead of a pointer.

ACKs for top commit:
  dongcarl:
    ACK 9376a6d

Tree-SHA512: c36d1769e0b9598b7f79334704b26b73e958d54caa3bd7e4eff954f3964fcf3f5e3a44a5a760497afad51b76e1614c86314fe035e4083c855e3574a620de7f4d
@aureleoules aureleoules deleted the 2022-07-make-active-chain-ref branch August 25, 2022 10:22
@bitcoin bitcoin locked and limited conversation to collaborators Aug 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants