HomePhabricator

refactor: rpc: Pass CBlockIndex by reference instead of pointer

Description

refactor: rpc: Pass CBlockIndex by reference instead of pointer

Summary:
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 casts in touched lines.

Also, add CHECK_NONFATAL checks, to turn segfault crashes into an
recoverable runtime error with debug information.

This concludes backport of core#29021
https://github.com/bitcoin/bitcoin/pull/29021/commits/fa5989d514d246e56977c528b2dd2abe6dc8efcc

Depends on D18257

Test Plan: ninja all check-all bench-bitcoin

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D18258

Details

Provenance
MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>Authored on Dec 7 2023, 10:01
PiRKCommitted on Jun 17 2025, 19:19
PiRKPushed on Jun 17 2025, 19:19
Reviewer
Restricted Project
Differential Revision
D18258: refactor: rpc: Pass CBlockIndex by reference instead of pointer
Parents
rABC23736ac049b1: init: Allow -proxy="" setting values
Branches
Unknown
Tags
Unknown