HomePhabricator

test: remove header hash caching in CBlockHeader class

Description

test: remove header hash caching in CBlockHeader class

Summary:
Rather than block hashes (represented by the fields .sha256 and
.hash) being stateful, simply compute them on-the-fly. This ensures
that the correct values are always returned and takes the burden of
rehashing from test writers, making the code shorter overall. In a
first step, the fields are kept at the same name with @property
functions as drop-in replacements, for a minimal diff. In later commits,
the names are changed to be more descriptive and indicating the return
type of the block hash.

This is a partial backport of core#32868
https://github.com/bitcoin/bitcoin/pull/32868/commits/0716382c20a6f9297f5bceb88120905fb4857c02

Depends on D18736

Test Plan:
ninja check-functional-extened

chronik-client-integration-tests
build-chronik-plugins

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

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

Details

Provenance
Sebastian Falbesoner <sebastian.falbesoner@gmail.com>Authored on Jun 12 2025, 10:51
PiRKCommitted on Oct 1 2025, 08:50
PiRKPushed on Oct 1 2025, 08:50
Reviewer
Restricted Project
Differential Revision
D18738: test: remove header hash caching in CBlockHeader class
Parents
rABC2997ff694bf4: test: avoid direct block header modification
Branches
Unknown
Tags
Unknown