test: remove bare CBlockHeader .rehash()/.calc_sha256() calls

Since the previous commit, CBlockHeader/CBlock object calls to the
methods `.rehash()` and `.calc_sha256()` are effectively no-ops
if the returned value is not used, so we can just remove them.
This commit is contained in:
Sebastian Falbesoner committed 2025-07-17 11:59:09 +02:00
1 parent 0716382c20
commit 8b09cc350a
16 files changed
-32

No files matched your search

-3
View File
@@ -288,10 +288,8 @@ class InvalidMessagesTest(BitcoinTestFramework):
blockheader.hashPrevBlock = int(blockheader_tip_hash, 16)
blockheader.nTime = int(time.time())
blockheader.nBits = blockheader_tip.nBits
blockheader.rehash()
while not blockheader.hash.startswith('0'):
blockheader.nNonce += 1
blockheader.rehash()
peer = self.nodes[0].add_p2p_connection(P2PInterface())
peer.send_and_ping(msg_headers([blockheader]))
assert_equal(self.nodes[0].getblockchaininfo()['headers'], 1)
@@ -302,7 +300,6 @@ class InvalidMessagesTest(BitcoinTestFramework):
# invalidate PoW
while not blockheader.hash.startswith('f'):
blockheader.nNonce += 1
blockheader.rehash()
with self.nodes[0].assert_debug_log(['Misbehaving', 'header with invalid proof of work']):
peer.send_without_ping(msg_headers([blockheader]))
peer.wait_for_disconnect()