test: rename CTransaction .sha256 -> .txid_int for consistency

Note that we unfortunately can't use a scripted diff here, as the same
property name is also used for `CBlockHeader`/`CBlock` instances.
This commit is contained in:
Sebastian Falbesoner
2025-05-05 16:00:44 +02:00
parent ce83924237
commit 81af4334e8
13 changed files with 114 additions and 114 deletions

View File

@@ -672,7 +672,7 @@ class CTransaction:
return hash256(self.serialize_without_witness())[::-1].hex()
@property
def sha256(self):
def txid_int(self):
"""Return txid (transaction hash without witness) as integer."""
return uint256_from_str(hash256(self.serialize_without_witness()))
@@ -804,7 +804,7 @@ class CBlock(CBlockHeader):
def calc_merkle_root(self):
hashes = []
for tx in self.vtx:
hashes.append(ser_uint256(tx.sha256))
hashes.append(ser_uint256(tx.txid_int))
return self.get_merkle_root(hashes)
def calc_witness_merkle_root(self):
@@ -996,7 +996,7 @@ class HeaderAndShortIDs:
[k0, k1] = self.get_siphash_keys()
for i in range(len(block.vtx)):
if i not in prefill_list:
tx_hash = block.vtx[i].sha256
tx_hash = block.vtx[i].txid_int
if use_witness:
tx_hash = block.vtx[i].wtxid_int
self.shortids.append(calculate_shortid(k0, k1, tx_hash))