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-
This commit is contained in:
Sebastian Falbesoner
2025-05-05 18:03:36 +02:00
parent 81af4334e8
commit 472f3770ae
20 changed files with 66 additions and 65 deletions

View File

@@ -104,5 +104,5 @@ def fill_mempool(test_framework, node, *, tx_sync_fun=None):
def tx_in_orphanage(node, tx: CTransaction) -> bool:
"""Returns true if the transaction is in the orphanage."""
found = [o for o in node.getorphantxs(verbosity=1) if o["txid"] == tx.txid_hex and o["wtxid"] == tx.getwtxid()]
found = [o for o in node.getorphantxs(verbosity=1) if o["txid"] == tx.txid_hex and o["wtxid"] == tx.wtxid_hex]
return len(found) == 1

View File

@@ -657,7 +657,8 @@ class CTransaction:
def serialize(self):
return self.serialize_with_witness()
def getwtxid(self):
@property
def wtxid_hex(self):
"""Return wtxid (transaction hash with witness) as hex string."""
return hash256(self.serialize())[::-1].hex()

View File

@@ -287,7 +287,7 @@ class MiniWallet:
return {
"sent_vout": 1,
"txid": txid,
"wtxid": tx.getwtxid(),
"wtxid": tx.wtxid_hex,
"hex": tx.serialize().hex(),
"tx": tx,
}
@@ -352,7 +352,7 @@ class MiniWallet:
) for i in range(len(tx.vout))],
"fee": fee,
"txid": txid,
"wtxid": tx.getwtxid(),
"wtxid": tx.wtxid_hex,
"hex": tx.serialize().hex(),
"tx": tx,
}