Skip to content

Commit 472f377

Browse files
committed
scripted-diff: test: rename CTransaction .getwtxid() -> wtxid_hex for consistency
-BEGIN VERIFY SCRIPT- sed -i "s|def getwtxid|@Property\n def wtxid_hex|g" ./test/functional/test_framework/messages.py sed -i "s|getwtxid()|wtxid_hex|g" $(git grep -l getwtxid) -END VERIFY SCRIPT-
1 parent 81af433 commit 472f377

20 files changed

+66
-65
lines changed

test/functional/feature_cltv.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def run_test(self):
163163
# First we show that this tx is valid except for CLTV by getting it
164164
# rejected from the mempool for exactly that reason.
165165
spendtx_txid = spendtx.txid_hex
166-
spendtx_wtxid = spendtx.getwtxid()
166+
spendtx_wtxid = spendtx.wtxid_hex
167167
assert_equal(
168168
[{
169169
'txid': spendtx_txid,

test/functional/feature_dersig.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def run_test(self):
115115
# First we show that this tx is valid except for DERSIG by getting it
116116
# rejected from the mempool for exactly that reason.
117117
spendtx_txid = spendtx.txid_hex
118-
spendtx_wtxid = spendtx.getwtxid()
118+
spendtx_wtxid = spendtx.wtxid_hex
119119
assert_equal(
120120
[{
121121
'txid': spendtx_txid,

test/functional/feature_segwit.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ def run_test(self):
251251
tx1 = tx_from_hex(tx1_hex)
252252

253253
# Check that wtxid is properly reported in mempool entry (txid1)
254-
assert_equal(self.nodes[0].getmempoolentry(txid1)["wtxid"], tx1.getwtxid())
254+
assert_equal(self.nodes[0].getmempoolentry(txid1)["wtxid"], tx1.wtxid_hex)
255255

256256
# Check that weight and vsize are properly reported in mempool entry (txid1)
257257
assert_equal(self.nodes[0].getmempoolentry(txid1)["vsize"], tx1.get_vsize())
@@ -267,7 +267,7 @@ def run_test(self):
267267
assert not tx.wit.is_null()
268268

269269
# Check that wtxid is properly reported in mempool entry (txid2)
270-
assert_equal(self.nodes[0].getmempoolentry(txid2)["wtxid"], tx.getwtxid())
270+
assert_equal(self.nodes[0].getmempoolentry(txid2)["wtxid"], tx.wtxid_hex)
271271

272272
# Check that weight and vsize are properly reported in mempool entry (txid2)
273273
assert_equal(self.nodes[0].getmempoolentry(txid2)["vsize"], tx.get_vsize())
@@ -289,7 +289,7 @@ def run_test(self):
289289
assert txid3 in template_txids
290290

291291
# Check that wtxid is properly reported in mempool entry (txid3)
292-
assert_equal(self.nodes[0].getmempoolentry(txid3)["wtxid"], tx.getwtxid())
292+
assert_equal(self.nodes[0].getmempoolentry(txid3)["wtxid"], tx.wtxid_hex)
293293

294294
# Check that weight and vsize are properly reported in mempool entry (txid3)
295295
assert_equal(self.nodes[0].getmempoolentry(txid3)["vsize"], tx.get_vsize())

test/functional/mempool_accept.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ def run_test(self):
454454
anchor_spend.vout.append(CTxOut(anchor_value - int(fee*COIN), script_to_p2wsh_script(CScript([OP_TRUE]))))
455455
anchor_spend.wit.vtxinwit.append(CTxInWitness())
456456
# It's "segwit" but txid == wtxid since there is no witness data
457-
assert_equal(anchor_spend.txid_hex, anchor_spend.getwtxid())
457+
assert_equal(anchor_spend.txid_hex, anchor_spend.wtxid_hex)
458458

459459
self.check_mempool_result(
460460
result_expected=[{'txid': anchor_spend.txid_hex, 'allowed': True, 'vsize': anchor_spend.get_vsize(), 'fees': { 'base': Decimal('0.00000700')}}],

test/functional/mempool_accept_wtxid.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,13 @@ def run_test(self):
7676
child_one.vout.append(CTxOut(int(9.99996 * COIN), child_script_pubkey))
7777
child_one.wit.vtxinwit.append(CTxInWitness())
7878
child_one.wit.vtxinwit[0].scriptWitness.stack = [b'Preimage', b'\x01', witness_script]
79-
child_one_wtxid = child_one.getwtxid()
79+
child_one_wtxid = child_one.wtxid_hex
8080
child_one_txid = child_one.txid_hex
8181

8282
# Create another identical transaction with witness solving second branch
8383
child_two = deepcopy(child_one)
8484
child_two.wit.vtxinwit[0].scriptWitness.stack = [b'', witness_script]
85-
child_two_wtxid = child_two.getwtxid()
85+
child_two_wtxid = child_two.wtxid_hex
8686
child_two_txid = child_two.txid_hex
8787

8888
assert_equal(child_one_txid, child_two_txid)

test/functional/mempool_ephemeral_dust.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ def add_output_to_create_multi_result(self, result, output_value=0):
4040
result["new_utxos"][0]["value"] = Decimal(result["tx"].vout[0].nValue) / COIN
4141
new_txid = result["tx"].txid_hex
4242
result["txid"] = new_txid
43-
result["wtxid"] = result["tx"].getwtxid()
43+
result["wtxid"] = result["tx"].wtxid_hex
4444
result["hex"] = result["tx"].serialize().hex()
4545
for new_utxo in result["new_utxos"]:
4646
new_utxo["txid"] = new_txid
47-
new_utxo["wtxid"] = result["tx"].getwtxid()
47+
new_utxo["wtxid"] = result["tx"].wtxid_hex
4848

4949
result["new_utxos"].append({"txid": new_txid, "vout": len(result["tx"].vout) - 1, "value": Decimal(output_value) / COIN, "height": 0, "coinbase": False, "confirmations": 0})
5050

test/functional/mempool_limit.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ def run_test(self):
379379

380380
rich_parent_result = submitpackage_result["tx-results"][tx_rich["wtxid"]]
381381
poor_parent_result = submitpackage_result["tx-results"][tx_poor["wtxid"]]
382-
child_result = submitpackage_result["tx-results"][tx_child["tx"].getwtxid()]
382+
child_result = submitpackage_result["tx-results"][tx_child["tx"].wtxid_hex]
383383
assert_fee_amount(poor_parent_result["fees"]["base"], tx_poor["tx"].get_vsize(), relayfee)
384384
assert_equal(rich_parent_result["fees"]["base"], 0)
385385
assert_equal(child_result["fees"]["base"], DEFAULT_FEE)
@@ -392,11 +392,11 @@ def run_test(self):
392392
package_vsize = tx_poor["tx"].get_vsize() + tx_child["tx"].get_vsize()
393393
assert_fee_amount(package_fees, package_vsize, poor_parent_result["fees"]["effective-feerate"])
394394
assert_fee_amount(package_fees, package_vsize, child_result["fees"]["effective-feerate"])
395-
assert_equal([tx_poor["wtxid"], tx_child["tx"].getwtxid()], poor_parent_result["fees"]["effective-includes"])
396-
assert_equal([tx_poor["wtxid"], tx_child["tx"].getwtxid()], child_result["fees"]["effective-includes"])
395+
assert_equal([tx_poor["wtxid"], tx_child["tx"].wtxid_hex], poor_parent_result["fees"]["effective-includes"])
396+
assert_equal([tx_poor["wtxid"], tx_child["tx"].wtxid_hex], child_result["fees"]["effective-includes"])
397397

398398
# The node will broadcast each transaction, still abiding by its peer's fee filter
399-
peer.wait_for_broadcast([tx["tx"].getwtxid() for tx in package_txns])
399+
peer.wait_for_broadcast([tx["tx"].wtxid_hex for tx in package_txns])
400400

401401
self.log.info("Check a package that passes mempoolminfee but is evicted immediately after submission")
402402
mempoolmin_feerate = node.getmempoolinfo()["mempoolminfee"]

test/functional/mempool_package_onemore.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ def run_test(self):
6060
txns_hex = [tx.serialize().hex() for tx in txns]
6161
assert_equal(self.nodes[0].testmempoolaccept(txns_hex)[0]["reject-reason"], "too-long-mempool-chain")
6262
pkg_result = self.nodes[0].submitpackage(txns_hex)
63-
assert "too-long-mempool-chain" in pkg_result["tx-results"][txns[0].getwtxid()]["error"]
64-
assert_equal(pkg_result["tx-results"][txns[1].getwtxid()]["error"], "bad-txns-inputs-missingorspent")
63+
assert "too-long-mempool-chain" in pkg_result["tx-results"][txns[0].wtxid_hex]["error"]
64+
assert_equal(pkg_result["tx-results"][txns[1].wtxid_hex]["error"], "bad-txns-inputs-missingorspent")
6565
# But not if it chains directly off the first transaction
6666
self.nodes[0].sendrawtransaction(replaceable_tx["hex"])
6767
# and the second chain should work just fine

test/functional/mempool_reorg.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def test_reorg_relay(self):
7373
# request very recent, unanounced transactions.
7474
assert_equal(len(peer1.get_invs()), 0)
7575
# It's too early to request these two transactions
76-
requests_too_recent = msg_getdata([CInv(t=MSG_WTX, h=int(tx["tx"].getwtxid(), 16)) for tx in [tx_before_reorg, tx_child]])
76+
requests_too_recent = msg_getdata([CInv(t=MSG_WTX, h=int(tx["tx"].wtxid_hex, 16)) for tx in [tx_before_reorg, tx_child]])
7777
peer1.send_and_ping(requests_too_recent)
7878
for _ in range(len(requests_too_recent.inv)):
7979
peer1.sync_with_ping()
@@ -82,15 +82,15 @@ def test_reorg_relay(self):
8282
assert "notfound" in peer1.last_message
8383

8484
# Request the tx from the disconnected block
85-
request_disconnected_tx = msg_getdata([CInv(t=MSG_WTX, h=int(tx_disconnected["tx"].getwtxid(), 16))])
85+
request_disconnected_tx = msg_getdata([CInv(t=MSG_WTX, h=int(tx_disconnected["tx"].wtxid_hex, 16))])
8686
peer1.send_and_ping(request_disconnected_tx)
8787

8888
# The tx from the disconnected block was never announced, and it entered the mempool later
8989
# than the transactions that are too recent.
9090
assert_equal(len(peer1.get_invs()), 0)
9191
with p2p_lock:
9292
# However, the node will answer requests for the tx from the recently-disconnected block.
93-
assert_equal(peer1.last_message["tx"].tx.getwtxid(),tx_disconnected["tx"].getwtxid())
93+
assert_equal(peer1.last_message["tx"].tx.wtxid_hex,tx_disconnected["tx"].wtxid_hex)
9494

9595
self.nodes[1].setmocktime(int(time.time()) + 300)
9696
peer1.sync_with_ping()
@@ -102,7 +102,7 @@ def test_reorg_relay(self):
102102
last_tx_received = peer1.last_message["tx"]
103103

104104
tx_after_reorg = self.wallet.send_self_transfer(from_node=self.nodes[1])
105-
request_after_reorg = msg_getdata([CInv(t=MSG_WTX, h=int(tx_after_reorg["tx"].getwtxid(), 16))])
105+
request_after_reorg = msg_getdata([CInv(t=MSG_WTX, h=int(tx_after_reorg["tx"].wtxid_hex, 16))])
106106
assert tx_after_reorg["txid"] in self.nodes[1].getrawmempool()
107107
peer1.send_and_ping(request_after_reorg)
108108
with p2p_lock:

test/functional/mempool_sigoplimit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def create_bare_multisig_tx(utxo_to_spend=None):
168168

169169
# When we actually try to submit, the parent makes it into the mempool, but the child would exceed ancestor vsize limits
170170
res = self.nodes[0].submitpackage([tx_parent.serialize().hex(), tx_child.serialize().hex()])
171-
assert "too-long-mempool-chain" in res["tx-results"][tx_child.getwtxid()]["error"]
171+
assert "too-long-mempool-chain" in res["tx-results"][tx_child.wtxid_hex]["error"]
172172
assert tx_parent.txid_hex in self.nodes[0].getrawmempool()
173173

174174
# Transactions are tiny in weight

0 commit comments

Comments
 (0)