This change avoids relying on tip_header.hash
, which is None
when the header is deserialized from hex during CBlockHeader()
construction.
Instead, tip_header.rehash()
explicitly computes the hash, making the test behavior more robust.
Using the explicit rehash()
avoids depending on wait_for_getheaders()
falling back to any received message, thus making the test more deterministic.
This is a follow-up to #32742.
Also, as noted in a previous review comment, “the hash field is wrong either way, simply due to being the wrong type (it is an optional hex string), as opposed to an optional int”.
The first commit intention is to improve clarity around the tests purpose, helping reviewers follow what’s being verified and why. What started as a small comment during review of #32742 led me reviewing and try to improve most relevant tests comments for consistency and correctness.