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

Since the previous commit, CTransaction 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
2025-05-04 23:06:06 +02:00
parent a2724e3ea3
commit 9b3dce24a3
26 changed files with 0 additions and 158 deletions

View File

@@ -134,7 +134,6 @@ def add_witness_commitment(block, nonce=0):
# witness commitment is the last OP_RETURN output in coinbase
block.vtx[0].vout.append(CTxOut(0, get_witness_script(witness_root, witness_nonce)))
block.vtx[0].rehash()
block.hashMerkleRoot = block.calc_merkle_root()
block.rehash()
@@ -176,7 +175,6 @@ def create_coinbase(height, pubkey=None, *, script_pubkey=None, extra_output_scr
coinbaseoutput2.nValue = 0
coinbaseoutput2.scriptPubKey = extra_output_script
coinbase.vout.append(coinbaseoutput2)
coinbase.calc_sha256()
return coinbase
def create_tx_with_script(prevtx, n, script_sig=b"", *, amount, output_script=None):
@@ -191,7 +189,6 @@ def create_tx_with_script(prevtx, n, script_sig=b"", *, amount, output_script=No
assert n < len(prevtx.vout)
tx.vin.append(CTxIn(COutPoint(prevtx.sha256, n), script_sig, SEQUENCE_FINAL))
tx.vout.append(CTxOut(amount, output_script))
tx.calc_sha256()
return tx
def get_legacy_sigopcount_block(block, accurate=True):