Page MenuHomePhabricator

test: remove header hash caching in CBlockHeader class
ClosedPublic

Authored by PiRK on Sep 30 2025, 14:58.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC6faf0a274439: 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