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: rpc: Pass CBlockIndex by reference instead of pointer #29021

Merged
merged 2 commits into from
Dec 12, 2023

Conversation

maflcko
Copy link
Member

@maflcko maflcko commented Dec 7, 2023

Follow-up to #29003 (comment)

MarcoFalke added 2 commits December 7, 2023 12:02
This makes it harder to pass nullptr and cause issues such as
bitcoin@dde7ac5
All functions assume that the pointer is never null, so pass by
reference, to avoid accidental segfaults at runtime, or at least make
them more obvious.

Also, remove unused c-style casts in touched lines.

Also, add CHECK_NONFATAL checks, to turn segfault crashes into an
recoverable runtime error with debug information.
@DrahtBot
Copy link
Contributor

DrahtBot commented Dec 7, 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 TheCharlatan, pablomartin4btc, dergoegge

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:

  • #26415 (rpc,rest,zmq: faster getblock, NotifyBlock and rest_block by reading raw block by andrewtoth)

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.

@DrahtBot DrahtBot changed the title refactor: rpc: Pass CBlockIndex by reference instead of pointer refactor: rpc: Pass CBlockIndex by reference instead of pointer Dec 7, 2023
Copy link
Contributor

@TheCharlatan TheCharlatan left a comment

Choose a reason for hiding this comment

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

ACK fa5989d

Copy link
Member

@pablomartin4btc pablomartin4btc left a comment

Choose a reason for hiding this comment

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

tACK fa5989d

I've re-tested #29003 & getblockchaininfo on mainnet.

@fanquake fanquake requested a review from dergoegge December 8, 2023 11:25
Copy link
Member

@dergoegge dergoegge left a comment

Choose a reason for hiding this comment

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

Code review ACK fa5989d

@fanquake fanquake merged commit 622e79e into bitcoin:master Dec 12, 2023
16 checks passed
@maflcko maflcko deleted the 2312-less-segfault- branch December 12, 2023 10:58
@bitcoin bitcoin locked and limited conversation to collaborators Dec 11, 2024
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.

6 participants