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 committed 2025-06-11 00:52:25 +02:00
1 parent ce83924237
commit 81af4334e8
13 files changed
+114 -114

No files matched your search

+10 -10
View File
@@ -166,7 +166,7 @@ class CompactBlocksTest(BitcoinTestFramework):
total_value = block.vtx[0].vout[0].nValue
out_value = total_value // 10
tx = CTransaction()
tx.vin.append(CTxIn(COutPoint(block.vtx[0].sha256, 0), b''))
tx.vin.append(CTxIn(COutPoint(block.vtx[0].txid_int, 0), b''))
for _ in range(10):
tx.vout.append(CTxOut(out_value, CScript([OP_TRUE])))
@@ -176,7 +176,7 @@ class CompactBlocksTest(BitcoinTestFramework):
block2.solve()
self.segwit_node.send_and_ping(msg_no_witness_block(block2))
assert_equal(int(self.nodes[0].getbestblockhash(), 16), block2.sha256)
self.utxos.extend([[tx.sha256, i, out_value] for i in range(10)])
self.utxos.extend([[tx.txid_int, i, out_value] for i in range(10)])
# Test "sendcmpct" (between peers preferring the same version):
@@ -420,7 +420,7 @@ class CompactBlocksTest(BitcoinTestFramework):
tx = CTransaction()
tx.vin.append(CTxIn(COutPoint(utxo[0], utxo[1]), b''))
tx.vout.append(CTxOut(utxo[2] - 1000, CScript([OP_TRUE, OP_DROP] * 15 + [OP_TRUE])))
utxo = [tx.sha256, 0, tx.vout[0].nValue]
utxo = [tx.txid_int, 0, tx.vout[0].nValue]
block.vtx.append(tx)
block.hashMerkleRoot = block.calc_merkle_root()
@@ -450,7 +450,7 @@ class CompactBlocksTest(BitcoinTestFramework):
utxo = self.utxos.pop(0)
block = self.build_block_with_transactions(node, utxo, 5)
self.utxos.append([block.vtx[-1].sha256, 0, block.vtx[-1].vout[0].nValue])
self.utxos.append([block.vtx[-1].txid_int, 0, block.vtx[-1].vout[0].nValue])
comp_block = HeaderAndShortIDs()
comp_block.initialize_from_block(block, use_witness=True)
@@ -463,7 +463,7 @@ class CompactBlocksTest(BitcoinTestFramework):
utxo = self.utxos.pop(0)
block = self.build_block_with_transactions(node, utxo, 5)
self.utxos.append([block.vtx[-1].sha256, 0, block.vtx[-1].vout[0].nValue])
self.utxos.append([block.vtx[-1].txid_int, 0, block.vtx[-1].vout[0].nValue])
# Now try interspersing the prefilled transactions
comp_block.initialize_from_block(block, prefill_list=[0, 1, 5], use_witness=True)
@@ -474,7 +474,7 @@ class CompactBlocksTest(BitcoinTestFramework):
# Now try giving one transaction ahead of time.
utxo = self.utxos.pop(0)
block = self.build_block_with_transactions(node, utxo, 5)
self.utxos.append([block.vtx[-1].sha256, 0, block.vtx[-1].vout[0].nValue])
self.utxos.append([block.vtx[-1].txid_int, 0, block.vtx[-1].vout[0].nValue])
test_node.send_and_ping(msg_tx(block.vtx[1]))
assert block.vtx[1].txid_hex in node.getrawmempool()
@@ -490,7 +490,7 @@ class CompactBlocksTest(BitcoinTestFramework):
# announced and verify reconstruction happens immediately.
utxo = self.utxos.pop(0)
block = self.build_block_with_transactions(node, utxo, 10)
self.utxos.append([block.vtx[-1].sha256, 0, block.vtx[-1].vout[0].nValue])
self.utxos.append([block.vtx[-1].txid_int, 0, block.vtx[-1].vout[0].nValue])
for tx in block.vtx[1:]:
test_node.send_without_ping(msg_tx(tx))
test_node.sync_with_ping()
@@ -517,7 +517,7 @@ class CompactBlocksTest(BitcoinTestFramework):
utxo = self.utxos.pop(0)
block = self.build_block_with_transactions(node, utxo, 10)
self.utxos.append([block.vtx[-1].sha256, 0, block.vtx[-1].vout[0].nValue])
self.utxos.append([block.vtx[-1].txid_int, 0, block.vtx[-1].vout[0].nValue])
# Relay the first 5 transactions from the block in advance
for tx in block.vtx[1:6]:
test_node.send_without_ping(msg_tx(tx))
@@ -770,7 +770,7 @@ class CompactBlocksTest(BitcoinTestFramework):
delivery_peer.send_and_ping(msg_cmpctblock(cmpct_block.to_p2p()))
assert_equal(int(node.getbestblockhash(), 16), block.sha256)
self.utxos.append([block.vtx[-1].sha256, 0, block.vtx[-1].vout[0].nValue])
self.utxos.append([block.vtx[-1].txid_int, 0, block.vtx[-1].vout[0].nValue])
# Now test that delivering an invalid compact block won't break relay
@@ -884,7 +884,7 @@ class CompactBlocksTest(BitcoinTestFramework):
# Nothing bad should happen if we get a late fill from the first peer...
stalling_peer.send_and_ping(msg)
self.utxos.append([block.vtx[-1].sha256, 0, block.vtx[-1].vout[0].nValue])
self.utxos.append([block.vtx[-1].txid_int, 0, block.vtx[-1].vout[0].nValue])
delivery_peer.clear_getblocktxn()
inbound_peer.clear_getblocktxn()