HomePhabricator

Merge #11337: Fix code constness in CBlockIndex::GetAncestor() overloads

Description

Merge #11337: Fix code constness in CBlockIndex::GetAncestor() overloads

Summary:
b4058ed Fix code constness in CBlockIndex::GetAncestor() overloads (Dan Raviv)

Pull request description:

Make the non-const overload of `CBlockIndex::GetAncestor()` reuse the const overload implementation instead of the other way around. This way, the constness of the const overload implementation is guaranteed. The other way around, it was possible to implement the non-const overload in a way which mutates the object, and since that implementation would be called even for const objects (due to the reuse), we would get undefined behavior.

Tree-SHA512: 545a8639bc52502ea06dbd924e8fabec6274fa69b43e3b8966a7987ce4dae6fb2498f623730fde7ed0e47478941c7f8baa2e76a12018134ff7c14c0dfa25ba3a

Backport of Core PR11337
https://github.com/bitcoin/bitcoin/pull/11337

Test Plan:

make check
test_runner.py

Reviewers: jasonbcox, deadalnix, Fabien, O1 Bitcoin ABC, #bitcoin_abc

Reviewed By: deadalnix, Fabien, O1 Bitcoin ABC, #bitcoin_abc

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

Details

Provenance
Wladimir J. van der Laan <laanwj@gmail.com>Authored on Dec 1 2017, 14:17
nakihitoCommitted on Jun 4 2019, 16:33
nakihitoPushed on Jun 4 2019, 16:34
Reviewer
Restricted Owners Package
Differential Revision
D3190: Merge #11337: Fix code constness in CBlockIndex::GetAncestor() overloads
Parents
rABC24b7f17efefd: Remove BIP9 from chain parameters
Branches
Unknown
Tags
Unknown