HomePhabricator

util: Add Assert identity function

Description

util: Add Assert identity function

Summary:

The utility function is primarily useful to dereference pointer types,
which are known to be not null at that time.

For example, the ArgsManager is known to exist when the wallets are
started:
https://github.com/bitcoin/bitcoin/pull/18923/files#diff-fdb2a1a1d8bc790fcddeb6cf5a42ac55R503
. Instead of silently relying on that assumption, Assert can be used to
abort the program and avoid UB should the assumption ever be violated.

Backport of core PR19277.

Depends on D8565.

Test Plan:

ninja all check-all

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

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

Details

Provenance
MarcoFalke <falke.marco@gmail.com>Authored on Jun 8 2020, 12:54
FabienCommitted on Dec 1 2020, 16:23
FabienPushed on Dec 1 2020, 16:24
Reviewer
Restricted Project
Differential Revision
D8566: util: Add Assert identity function
Parents
rABC57cc486f0e9f: validation: Mark g_chainman DEPRECATED
Branches
Unknown
Tags
Unknown