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 committed 2025-06-11 00:52:25 +02:00
1 parent 81af4334e8
commit 472f3770ae
20 files changed
+66 -65

No files matched your search

+1 -1
View File
@@ -163,7 +163,7 @@ class BIP65Test(BitcoinTestFramework):
# First we show that this tx is valid except for CLTV by getting it # First we show that this tx is valid except for CLTV by getting it
# rejected from the mempool for exactly that reason. # rejected from the mempool for exactly that reason.
spendtx_txid = spendtx.txid_hex spendtx_txid = spendtx.txid_hex
spendtx_wtxid = spendtx.getwtxid() spendtx_wtxid = spendtx.wtxid_hex
assert_equal( assert_equal(
[{ [{
'txid': spendtx_txid, 'txid': spendtx_txid,
+1 -1
View File
@@ -115,7 +115,7 @@ class BIP66Test(BitcoinTestFramework):
# First we show that this tx is valid except for DERSIG by getting it # First we show that this tx is valid except for DERSIG by getting it
# rejected from the mempool for exactly that reason. # rejected from the mempool for exactly that reason.
spendtx_txid = spendtx.txid_hex spendtx_txid = spendtx.txid_hex
spendtx_wtxid = spendtx.getwtxid() spendtx_wtxid = spendtx.wtxid_hex
assert_equal( assert_equal(
[{ [{
'txid': spendtx_txid, 'txid': spendtx_txid,
+3 -3
View File
@@ -251,7 +251,7 @@ class SegWitTest(BitcoinTestFramework):
tx1 = tx_from_hex(tx1_hex) tx1 = tx_from_hex(tx1_hex)
# Check that wtxid is properly reported in mempool entry (txid1) # Check that wtxid is properly reported in mempool entry (txid1)
assert_equal(self.nodes[0].getmempoolentry(txid1)["wtxid"], tx1.getwtxid()) assert_equal(self.nodes[0].getmempoolentry(txid1)["wtxid"], tx1.wtxid_hex)
# Check that weight and vsize are properly reported in mempool entry (txid1) # Check that weight and vsize are properly reported in mempool entry (txid1)
assert_equal(self.nodes[0].getmempoolentry(txid1)["vsize"], tx1.get_vsize()) assert_equal(self.nodes[0].getmempoolentry(txid1)["vsize"], tx1.get_vsize())
@@ -267,7 +267,7 @@ class SegWitTest(BitcoinTestFramework):
assert not tx.wit.is_null() assert not tx.wit.is_null()
# Check that wtxid is properly reported in mempool entry (txid2) # Check that wtxid is properly reported in mempool entry (txid2)
assert_equal(self.nodes[0].getmempoolentry(txid2)["wtxid"], tx.getwtxid()) assert_equal(self.nodes[0].getmempoolentry(txid2)["wtxid"], tx.wtxid_hex)
# Check that weight and vsize are properly reported in mempool entry (txid2) # Check that weight and vsize are properly reported in mempool entry (txid2)
assert_equal(self.nodes[0].getmempoolentry(txid2)["vsize"], tx.get_vsize()) assert_equal(self.nodes[0].getmempoolentry(txid2)["vsize"], tx.get_vsize())
@@ -289,7 +289,7 @@ class SegWitTest(BitcoinTestFramework):
assert txid3 in template_txids assert txid3 in template_txids
# Check that wtxid is properly reported in mempool entry (txid3) # Check that wtxid is properly reported in mempool entry (txid3)
assert_equal(self.nodes[0].getmempoolentry(txid3)["wtxid"], tx.getwtxid()) assert_equal(self.nodes[0].getmempoolentry(txid3)["wtxid"], tx.wtxid_hex)
# Check that weight and vsize are properly reported in mempool entry (txid3) # Check that weight and vsize are properly reported in mempool entry (txid3)
assert_equal(self.nodes[0].getmempoolentry(txid3)["vsize"], tx.get_vsize()) assert_equal(self.nodes[0].getmempoolentry(txid3)["vsize"], tx.get_vsize())
+1 -1
View File
@@ -454,7 +454,7 @@ class MempoolAcceptanceTest(BitcoinTestFramework):
anchor_spend.vout.append(CTxOut(anchor_value - int(fee*COIN), script_to_p2wsh_script(CScript([OP_TRUE])))) anchor_spend.vout.append(CTxOut(anchor_value - int(fee*COIN), script_to_p2wsh_script(CScript([OP_TRUE]))))
anchor_spend.wit.vtxinwit.append(CTxInWitness()) anchor_spend.wit.vtxinwit.append(CTxInWitness())
# It's "segwit" but txid == wtxid since there is no witness data # It's "segwit" but txid == wtxid since there is no witness data
assert_equal(anchor_spend.txid_hex, anchor_spend.getwtxid()) assert_equal(anchor_spend.txid_hex, anchor_spend.wtxid_hex)
self.check_mempool_result( self.check_mempool_result(
result_expected=[{'txid': anchor_spend.txid_hex, 'allowed': True, 'vsize': anchor_spend.get_vsize(), 'fees': { 'base': Decimal('0.00000700')}}], result_expected=[{'txid': anchor_spend.txid_hex, 'allowed': True, 'vsize': anchor_spend.get_vsize(), 'fees': { 'base': Decimal('0.00000700')}}],
+2 -2
View File
@@ -76,13 +76,13 @@ class MempoolWtxidTest(BitcoinTestFramework):
child_one.vout.append(CTxOut(int(9.99996 * COIN), child_script_pubkey)) child_one.vout.append(CTxOut(int(9.99996 * COIN), child_script_pubkey))
child_one.wit.vtxinwit.append(CTxInWitness()) child_one.wit.vtxinwit.append(CTxInWitness())
child_one.wit.vtxinwit[0].scriptWitness.stack = [b'Preimage', b'\x01', witness_script] child_one.wit.vtxinwit[0].scriptWitness.stack = [b'Preimage', b'\x01', witness_script]
child_one_wtxid = child_one.getwtxid() child_one_wtxid = child_one.wtxid_hex
child_one_txid = child_one.txid_hex child_one_txid = child_one.txid_hex
# Create another identical transaction with witness solving second branch # Create another identical transaction with witness solving second branch
child_two = deepcopy(child_one) child_two = deepcopy(child_one)
child_two.wit.vtxinwit[0].scriptWitness.stack = [b'', witness_script] child_two.wit.vtxinwit[0].scriptWitness.stack = [b'', witness_script]
child_two_wtxid = child_two.getwtxid() child_two_wtxid = child_two.wtxid_hex
child_two_txid = child_two.txid_hex child_two_txid = child_two.txid_hex
assert_equal(child_one_txid, child_two_txid) assert_equal(child_one_txid, child_two_txid)
+2 -2
View File
@@ -40,11 +40,11 @@ class EphemeralDustTest(BitcoinTestFramework):
result["new_utxos"][0]["value"] = Decimal(result["tx"].vout[0].nValue) / COIN result["new_utxos"][0]["value"] = Decimal(result["tx"].vout[0].nValue) / COIN
new_txid = result["tx"].txid_hex new_txid = result["tx"].txid_hex
result["txid"] = new_txid result["txid"] = new_txid
result["wtxid"] = result["tx"].getwtxid() result["wtxid"] = result["tx"].wtxid_hex
result["hex"] = result["tx"].serialize().hex() result["hex"] = result["tx"].serialize().hex()
for new_utxo in result["new_utxos"]: for new_utxo in result["new_utxos"]:
new_utxo["txid"] = new_txid new_utxo["txid"] = new_txid
new_utxo["wtxid"] = result["tx"].getwtxid() new_utxo["wtxid"] = result["tx"].wtxid_hex
result["new_utxos"].append({"txid": new_txid, "vout": len(result["tx"].vout) - 1, "value": Decimal(output_value) / COIN, "height": 0, "coinbase": False, "confirmations": 0}) result["new_utxos"].append({"txid": new_txid, "vout": len(result["tx"].vout) - 1, "value": Decimal(output_value) / COIN, "height": 0, "coinbase": False, "confirmations": 0})
+4 -4
View File
@@ -379,7 +379,7 @@ class MempoolLimitTest(BitcoinTestFramework):
rich_parent_result = submitpackage_result["tx-results"][tx_rich["wtxid"]] rich_parent_result = submitpackage_result["tx-results"][tx_rich["wtxid"]]
poor_parent_result = submitpackage_result["tx-results"][tx_poor["wtxid"]] poor_parent_result = submitpackage_result["tx-results"][tx_poor["wtxid"]]
child_result = submitpackage_result["tx-results"][tx_child["tx"].getwtxid()] child_result = submitpackage_result["tx-results"][tx_child["tx"].wtxid_hex]
assert_fee_amount(poor_parent_result["fees"]["base"], tx_poor["tx"].get_vsize(), relayfee) assert_fee_amount(poor_parent_result["fees"]["base"], tx_poor["tx"].get_vsize(), relayfee)
assert_equal(rich_parent_result["fees"]["base"], 0) assert_equal(rich_parent_result["fees"]["base"], 0)
assert_equal(child_result["fees"]["base"], DEFAULT_FEE) assert_equal(child_result["fees"]["base"], DEFAULT_FEE)
@@ -392,11 +392,11 @@ class MempoolLimitTest(BitcoinTestFramework):
package_vsize = tx_poor["tx"].get_vsize() + tx_child["tx"].get_vsize() package_vsize = tx_poor["tx"].get_vsize() + tx_child["tx"].get_vsize()
assert_fee_amount(package_fees, package_vsize, poor_parent_result["fees"]["effective-feerate"]) assert_fee_amount(package_fees, package_vsize, poor_parent_result["fees"]["effective-feerate"])
assert_fee_amount(package_fees, package_vsize, child_result["fees"]["effective-feerate"]) assert_fee_amount(package_fees, package_vsize, child_result["fees"]["effective-feerate"])
assert_equal([tx_poor["wtxid"], tx_child["tx"].getwtxid()], poor_parent_result["fees"]["effective-includes"]) assert_equal([tx_poor["wtxid"], tx_child["tx"].wtxid_hex], poor_parent_result["fees"]["effective-includes"])
assert_equal([tx_poor["wtxid"], tx_child["tx"].getwtxid()], child_result["fees"]["effective-includes"]) assert_equal([tx_poor["wtxid"], tx_child["tx"].wtxid_hex], child_result["fees"]["effective-includes"])
# The node will broadcast each transaction, still abiding by its peer's fee filter # The node will broadcast each transaction, still abiding by its peer's fee filter
peer.wait_for_broadcast([tx["tx"].getwtxid() for tx in package_txns]) peer.wait_for_broadcast([tx["tx"].wtxid_hex for tx in package_txns])
self.log.info("Check a package that passes mempoolminfee but is evicted immediately after submission") self.log.info("Check a package that passes mempoolminfee but is evicted immediately after submission")
mempoolmin_feerate = node.getmempoolinfo()["mempoolminfee"] mempoolmin_feerate = node.getmempoolinfo()["mempoolminfee"]
+2 -2
View File
@@ -60,8 +60,8 @@ class MempoolPackagesTest(BitcoinTestFramework):
txns_hex = [tx.serialize().hex() for tx in txns] txns_hex = [tx.serialize().hex() for tx in txns]
assert_equal(self.nodes[0].testmempoolaccept(txns_hex)[0]["reject-reason"], "too-long-mempool-chain") assert_equal(self.nodes[0].testmempoolaccept(txns_hex)[0]["reject-reason"], "too-long-mempool-chain")
pkg_result = self.nodes[0].submitpackage(txns_hex) pkg_result = self.nodes[0].submitpackage(txns_hex)
assert "too-long-mempool-chain" in pkg_result["tx-results"][txns[0].getwtxid()]["error"] assert "too-long-mempool-chain" in pkg_result["tx-results"][txns[0].wtxid_hex]["error"]
assert_equal(pkg_result["tx-results"][txns[1].getwtxid()]["error"], "bad-txns-inputs-missingorspent") assert_equal(pkg_result["tx-results"][txns[1].wtxid_hex]["error"], "bad-txns-inputs-missingorspent")
# But not if it chains directly off the first transaction # But not if it chains directly off the first transaction
self.nodes[0].sendrawtransaction(replaceable_tx["hex"]) self.nodes[0].sendrawtransaction(replaceable_tx["hex"])
# and the second chain should work just fine # and the second chain should work just fine
+4 -4
View File
@@ -73,7 +73,7 @@ class MempoolCoinbaseTest(BitcoinTestFramework):
# request very recent, unanounced transactions. # request very recent, unanounced transactions.
assert_equal(len(peer1.get_invs()), 0) assert_equal(len(peer1.get_invs()), 0)
# It's too early to request these two transactions # It's too early to request these two transactions
requests_too_recent = msg_getdata([CInv(t=MSG_WTX, h=int(tx["tx"].getwtxid(), 16)) for tx in [tx_before_reorg, tx_child]]) requests_too_recent = msg_getdata([CInv(t=MSG_WTX, h=int(tx["tx"].wtxid_hex, 16)) for tx in [tx_before_reorg, tx_child]])
peer1.send_and_ping(requests_too_recent) peer1.send_and_ping(requests_too_recent)
for _ in range(len(requests_too_recent.inv)): for _ in range(len(requests_too_recent.inv)):
peer1.sync_with_ping() peer1.sync_with_ping()
@@ -82,7 +82,7 @@ class MempoolCoinbaseTest(BitcoinTestFramework):
assert "notfound" in peer1.last_message assert "notfound" in peer1.last_message
# Request the tx from the disconnected block # Request the tx from the disconnected block
request_disconnected_tx = msg_getdata([CInv(t=MSG_WTX, h=int(tx_disconnected["tx"].getwtxid(), 16))]) request_disconnected_tx = msg_getdata([CInv(t=MSG_WTX, h=int(tx_disconnected["tx"].wtxid_hex, 16))])
peer1.send_and_ping(request_disconnected_tx) peer1.send_and_ping(request_disconnected_tx)
# The tx from the disconnected block was never announced, and it entered the mempool later # The tx from the disconnected block was never announced, and it entered the mempool later
@@ -90,7 +90,7 @@ class MempoolCoinbaseTest(BitcoinTestFramework):
assert_equal(len(peer1.get_invs()), 0) assert_equal(len(peer1.get_invs()), 0)
with p2p_lock: with p2p_lock:
# However, the node will answer requests for the tx from the recently-disconnected block. # However, the node will answer requests for the tx from the recently-disconnected block.
assert_equal(peer1.last_message["tx"].tx.getwtxid(),tx_disconnected["tx"].getwtxid()) assert_equal(peer1.last_message["tx"].tx.wtxid_hex,tx_disconnected["tx"].wtxid_hex)
self.nodes[1].setmocktime(int(time.time()) + 300) self.nodes[1].setmocktime(int(time.time()) + 300)
peer1.sync_with_ping() peer1.sync_with_ping()
@@ -102,7 +102,7 @@ class MempoolCoinbaseTest(BitcoinTestFramework):
last_tx_received = peer1.last_message["tx"] last_tx_received = peer1.last_message["tx"]
tx_after_reorg = self.wallet.send_self_transfer(from_node=self.nodes[1]) tx_after_reorg = self.wallet.send_self_transfer(from_node=self.nodes[1])
request_after_reorg = msg_getdata([CInv(t=MSG_WTX, h=int(tx_after_reorg["tx"].getwtxid(), 16))]) request_after_reorg = msg_getdata([CInv(t=MSG_WTX, h=int(tx_after_reorg["tx"].wtxid_hex, 16))])
assert tx_after_reorg["txid"] in self.nodes[1].getrawmempool() assert tx_after_reorg["txid"] in self.nodes[1].getrawmempool()
peer1.send_and_ping(request_after_reorg) peer1.send_and_ping(request_after_reorg)
with p2p_lock: with p2p_lock:
+1 -1
View File
@@ -168,7 +168,7 @@ class BytesPerSigOpTest(BitcoinTestFramework):
# When we actually try to submit, the parent makes it into the mempool, but the child would exceed ancestor vsize limits # When we actually try to submit, the parent makes it into the mempool, but the child would exceed ancestor vsize limits
res = self.nodes[0].submitpackage([tx_parent.serialize().hex(), tx_child.serialize().hex()]) res = self.nodes[0].submitpackage([tx_parent.serialize().hex(), tx_child.serialize().hex()])
assert "too-long-mempool-chain" in res["tx-results"][tx_child.getwtxid()]["error"] assert "too-long-mempool-chain" in res["tx-results"][tx_child.wtxid_hex]["error"]
assert tx_parent.txid_hex in self.nodes[0].getrawmempool() assert tx_parent.txid_hex in self.nodes[0].getrawmempool()
# Transactions are tiny in weight # Transactions are tiny in weight
+2 -2
View File
@@ -349,7 +349,7 @@ class CompactBlocksTest(BitcoinTestFramework):
assert_equal(entry.tx.txid_hex, block.vtx[entry.index].txid_hex) assert_equal(entry.tx.txid_hex, block.vtx[entry.index].txid_hex)
# And this checks the witness # And this checks the witness
assert_equal(entry.tx.getwtxid(), block.vtx[entry.index].getwtxid()) assert_equal(entry.tx.wtxid_hex, block.vtx[entry.index].wtxid_hex)
# Check that the cmpctblock message announced all the transactions. # Check that the cmpctblock message announced all the transactions.
assert_equal(len(header_and_shortids.prefilled_txn) + len(header_and_shortids.shortids), len(block.vtx)) assert_equal(len(header_and_shortids.prefilled_txn) + len(header_and_shortids.shortids), len(block.vtx))
@@ -586,7 +586,7 @@ class CompactBlocksTest(BitcoinTestFramework):
tx = test_node.last_message["blocktxn"].block_transactions.transactions.pop(0) tx = test_node.last_message["blocktxn"].block_transactions.transactions.pop(0)
assert_equal(tx.txid_hex, block.vtx[index].txid_hex) assert_equal(tx.txid_hex, block.vtx[index].txid_hex)
# Check that the witness matches # Check that the witness matches
assert_equal(tx.getwtxid(), block.vtx[index].getwtxid()) assert_equal(tx.wtxid_hex, block.vtx[index].wtxid_hex)
test_node.last_message.pop("blocktxn", None) test_node.last_message.pop("blocktxn", None)
current_height -= 1 current_height -= 1
+2 -2
View File
@@ -44,7 +44,7 @@ class P2PLeakTxTest(BitcoinTestFramework):
self.log.debug("Request transaction") self.log.debug("Request transaction")
inbound_peer.last_message.pop("tx", None) inbound_peer.last_message.pop("tx", None)
inbound_peer.send_and_ping(want_tx) inbound_peer.send_and_ping(want_tx)
assert_equal(inbound_peer.last_message.get("tx").tx.getwtxid(), wtxid) assert_equal(inbound_peer.last_message.get("tx").tx.wtxid_hex, wtxid)
def test_notfound_on_replaced_tx(self): def test_notfound_on_replaced_tx(self):
self.gen_node.disconnect_p2ps() self.gen_node.disconnect_p2ps()
@@ -57,7 +57,7 @@ class P2PLeakTxTest(BitcoinTestFramework):
tx_b = tx_a["tx"] tx_b = tx_a["tx"]
tx_b.vout[0].nValue -= 9000 tx_b.vout[0].nValue -= 9000
self.gen_node.sendrawtransaction(tx_b.serialize().hex()) self.gen_node.sendrawtransaction(tx_b.serialize().hex())
inbound_peer.wait_until(lambda: "tx" in inbound_peer.last_message and inbound_peer.last_message.get("tx").tx.getwtxid() == tx_b.getwtxid()) inbound_peer.wait_until(lambda: "tx" in inbound_peer.last_message and inbound_peer.last_message.get("tx").tx.wtxid_hex == tx_b.wtxid_hex)
self.log.info("Re-request of tx_a after replacement is answered with notfound") self.log.info("Re-request of tx_a after replacement is answered with notfound")
req_vec = [ req_vec = [
+9 -9
View File
@@ -83,7 +83,7 @@ class PackageRelayTest(BitcoinTestFramework):
peer_sender = node.add_p2p_connection(P2PInterface()) peer_sender = node.add_p2p_connection(P2PInterface())
# 1. Child is received first (perhaps the low feerate parent didn't meet feefilter or the requests were sent to different nodes). It is missing an input. # 1. Child is received first (perhaps the low feerate parent didn't meet feefilter or the requests were sent to different nodes). It is missing an input.
high_child_wtxid_int = int(high_fee_child["tx"].getwtxid(), 16) high_child_wtxid_int = int(high_fee_child["tx"].wtxid_hex, 16)
peer_sender.send_and_ping(msg_inv([CInv(t=MSG_WTX, h=high_child_wtxid_int)])) peer_sender.send_and_ping(msg_inv([CInv(t=MSG_WTX, h=high_child_wtxid_int)]))
peer_sender.wait_for_getdata([high_child_wtxid_int]) peer_sender.wait_for_getdata([high_child_wtxid_int])
peer_sender.send_and_ping(msg_tx(high_fee_child["tx"])) peer_sender.send_and_ping(msg_tx(high_fee_child["tx"]))
@@ -112,7 +112,7 @@ class PackageRelayTest(BitcoinTestFramework):
peer_ignored = node.add_outbound_p2p_connection(P2PInterface(), p2p_idx=2, connection_type="outbound-full-relay") peer_ignored = node.add_outbound_p2p_connection(P2PInterface(), p2p_idx=2, connection_type="outbound-full-relay")
# 1. Parent is relayed first. It is too low feerate. # 1. Parent is relayed first. It is too low feerate.
parent_wtxid_int = int(low_fee_parent["tx"].getwtxid(), 16) parent_wtxid_int = int(low_fee_parent["tx"].wtxid_hex, 16)
peer_sender.send_and_ping(msg_inv([CInv(t=MSG_WTX, h=parent_wtxid_int)])) peer_sender.send_and_ping(msg_inv([CInv(t=MSG_WTX, h=parent_wtxid_int)]))
peer_sender.wait_for_getdata([parent_wtxid_int]) peer_sender.wait_for_getdata([parent_wtxid_int])
peer_sender.send_and_ping(msg_tx(low_fee_parent["tx"])) peer_sender.send_and_ping(msg_tx(low_fee_parent["tx"]))
@@ -123,7 +123,7 @@ class PackageRelayTest(BitcoinTestFramework):
assert "getdata" not in peer_ignored.last_message assert "getdata" not in peer_ignored.last_message
# 2. Child is relayed next. It is missing an input. # 2. Child is relayed next. It is missing an input.
high_child_wtxid_int = int(high_fee_child["tx"].getwtxid(), 16) high_child_wtxid_int = int(high_fee_child["tx"].wtxid_hex, 16)
peer_sender.send_and_ping(msg_inv([CInv(t=MSG_WTX, h=high_child_wtxid_int)])) peer_sender.send_and_ping(msg_inv([CInv(t=MSG_WTX, h=high_child_wtxid_int)]))
peer_sender.wait_for_getdata([high_child_wtxid_int]) peer_sender.wait_for_getdata([high_child_wtxid_int])
peer_sender.send_and_ping(msg_tx(high_fee_child["tx"])) peer_sender.send_and_ping(msg_tx(high_fee_child["tx"]))
@@ -156,7 +156,7 @@ class PackageRelayTest(BitcoinTestFramework):
self.log.info("Check that tx caches low fee parent + low fee child package rejections") self.log.info("Check that tx caches low fee parent + low fee child package rejections")
# 1. Send parent, rejected for being low feerate. # 1. Send parent, rejected for being low feerate.
parent_wtxid_int = int(low_fee_parent["tx"].getwtxid(), 16) parent_wtxid_int = int(low_fee_parent["tx"].wtxid_hex, 16)
peer_sender.send_and_ping(msg_inv([CInv(t=MSG_WTX, h=parent_wtxid_int)])) peer_sender.send_and_ping(msg_inv([CInv(t=MSG_WTX, h=parent_wtxid_int)]))
peer_sender.wait_for_getdata([parent_wtxid_int]) peer_sender.wait_for_getdata([parent_wtxid_int])
peer_sender.send_and_ping(msg_tx(low_fee_parent["tx"])) peer_sender.send_and_ping(msg_tx(low_fee_parent["tx"]))
@@ -167,7 +167,7 @@ class PackageRelayTest(BitcoinTestFramework):
assert "getdata" not in peer_ignored.last_message assert "getdata" not in peer_ignored.last_message
# 2. Send an (orphan) child that has a higher feerate, but not enough to bump the parent. # 2. Send an (orphan) child that has a higher feerate, but not enough to bump the parent.
med_child_wtxid_int = int(med_fee_child["tx"].getwtxid(), 16) med_child_wtxid_int = int(med_fee_child["tx"].wtxid_hex, 16)
peer_sender.send_and_ping(msg_inv([CInv(t=MSG_WTX, h=med_child_wtxid_int)])) peer_sender.send_and_ping(msg_inv([CInv(t=MSG_WTX, h=med_child_wtxid_int)]))
peer_sender.wait_for_getdata([med_child_wtxid_int]) peer_sender.wait_for_getdata([med_child_wtxid_int])
peer_sender.send_and_ping(msg_tx(med_fee_child["tx"])) peer_sender.send_and_ping(msg_tx(med_fee_child["tx"]))
@@ -193,7 +193,7 @@ class PackageRelayTest(BitcoinTestFramework):
assert med_fee_child["txid"] not in node.getrawmempool() assert med_fee_child["txid"] not in node.getrawmempool()
# 5. Send the high feerate (orphan) child # 5. Send the high feerate (orphan) child
high_child_wtxid_int = int(high_fee_child["tx"].getwtxid(), 16) high_child_wtxid_int = int(high_fee_child["tx"].wtxid_hex, 16)
peer_sender.send_and_ping(msg_inv([CInv(t=MSG_WTX, h=high_child_wtxid_int)])) peer_sender.send_and_ping(msg_inv([CInv(t=MSG_WTX, h=high_child_wtxid_int)]))
peer_sender.wait_for_getdata([high_child_wtxid_int]) peer_sender.wait_for_getdata([high_child_wtxid_int])
peer_sender.send_and_ping(msg_tx(high_fee_child["tx"])) peer_sender.send_and_ping(msg_tx(high_fee_child["tx"]))
@@ -229,7 +229,7 @@ class PackageRelayTest(BitcoinTestFramework):
parent_sender = node.add_p2p_connection(P2PInterface()) parent_sender = node.add_p2p_connection(P2PInterface())
# 1. Child is received first. It is missing an input. # 1. Child is received first. It is missing an input.
child_wtxid_int = int(tx_orphan_bad_wit.getwtxid(), 16) child_wtxid_int = int(tx_orphan_bad_wit.wtxid_hex, 16)
bad_orphan_sender.send_and_ping(msg_inv([CInv(t=MSG_WTX, h=child_wtxid_int)])) bad_orphan_sender.send_and_ping(msg_inv([CInv(t=MSG_WTX, h=child_wtxid_int)]))
bad_orphan_sender.wait_for_getdata([child_wtxid_int]) bad_orphan_sender.wait_for_getdata([child_wtxid_int])
bad_orphan_sender.send_and_ping(msg_tx(tx_orphan_bad_wit)) bad_orphan_sender.send_and_ping(msg_tx(tx_orphan_bad_wit))
@@ -270,7 +270,7 @@ class PackageRelayTest(BitcoinTestFramework):
fake_parent_sender = node.add_p2p_connection(P2PInterface()) fake_parent_sender = node.add_p2p_connection(P2PInterface())
# 1. Child is received first. It is missing an input. # 1. Child is received first. It is missing an input.
child_wtxid_int = int(high_fee_child["tx"].getwtxid(), 16) child_wtxid_int = int(high_fee_child["tx"].wtxid_hex, 16)
package_sender.send_and_ping(msg_inv([CInv(t=MSG_WTX, h=child_wtxid_int)])) package_sender.send_and_ping(msg_inv([CInv(t=MSG_WTX, h=child_wtxid_int)]))
package_sender.wait_for_getdata([child_wtxid_int]) package_sender.wait_for_getdata([child_wtxid_int])
package_sender.send_and_ping(msg_tx(high_fee_child["tx"])) package_sender.send_and_ping(msg_tx(high_fee_child["tx"]))
@@ -292,7 +292,7 @@ class PackageRelayTest(BitcoinTestFramework):
self.log.info("Check that fake parent does not cause orphan to be deleted and real package can still be submitted") self.log.info("Check that fake parent does not cause orphan to be deleted and real package can still be submitted")
# 5. Child-sending should not have been punished and the orphan should remain in orphanage. # 5. Child-sending should not have been punished and the orphan should remain in orphanage.
# It can send the "real" parent transaction, and the package is accepted. # It can send the "real" parent transaction, and the package is accepted.
parent_wtxid_int = int(low_fee_parent["tx"].getwtxid(), 16) parent_wtxid_int = int(low_fee_parent["tx"].wtxid_hex, 16)
package_sender.send_and_ping(msg_inv([CInv(t=MSG_WTX, h=parent_wtxid_int)])) package_sender.send_and_ping(msg_inv([CInv(t=MSG_WTX, h=parent_wtxid_int)]))
package_sender.wait_for_getdata([parent_wtxid_int]) package_sender.wait_for_getdata([parent_wtxid_int])
package_sender.send_and_ping(msg_tx(low_fee_parent["tx"])) package_sender.send_and_ping(msg_tx(low_fee_parent["tx"]))
+11 -11
View File
@@ -128,11 +128,11 @@ class OrphanHandlingTest(BitcoinTestFramework):
"""Create package with 1 parent and 1 child, normal fees (no cpfp).""" """Create package with 1 parent and 1 child, normal fees (no cpfp)."""
parent = self.wallet.create_self_transfer() parent = self.wallet.create_self_transfer()
child = self.wallet.create_self_transfer(utxo_to_spend=parent['new_utxo']) child = self.wallet.create_self_transfer(utxo_to_spend=parent['new_utxo'])
return child["tx"].getwtxid(), child["tx"], parent["tx"] return child["tx"].wtxid_hex, child["tx"], parent["tx"]
def relay_transaction(self, peer, tx): def relay_transaction(self, peer, tx):
"""Relay transaction using MSG_WTX""" """Relay transaction using MSG_WTX"""
wtxid = int(tx.getwtxid(), 16) wtxid = int(tx.wtxid_hex, 16)
peer.send_and_ping(msg_inv([CInv(t=MSG_WTX, h=wtxid)])) peer.send_and_ping(msg_inv([CInv(t=MSG_WTX, h=wtxid)]))
self.nodes[0].bumpmocktime(TXREQUEST_TIME_SKIP) self.nodes[0].bumpmocktime(TXREQUEST_TIME_SKIP)
peer.wait_for_getdata([wtxid]) peer.wait_for_getdata([wtxid])
@@ -150,7 +150,7 @@ class OrphanHandlingTest(BitcoinTestFramework):
tx_bad_wit.wit.vtxinwit[0].scriptWitness.stack = [b'garbage'] tx_bad_wit.wit.vtxinwit[0].scriptWitness.stack = [b'garbage']
assert_equal(tx["txid"], tx_bad_wit.txid_hex) assert_equal(tx["txid"], tx_bad_wit.txid_hex)
assert_not_equal(tx["wtxid"], tx_bad_wit.getwtxid()) assert_not_equal(tx["wtxid"], tx_bad_wit.wtxid_hex)
return tx_bad_wit return tx_bad_wit
@@ -184,7 +184,7 @@ class OrphanHandlingTest(BitcoinTestFramework):
# Spy peer should not be able to query the node for the parent yet, since it hasn't been # Spy peer should not be able to query the node for the parent yet, since it hasn't been
# announced / insufficient time has elapsed. # announced / insufficient time has elapsed.
parent_inv = CInv(t=MSG_WTX, h=int(tx_parent_arrives["tx"].getwtxid(), 16)) parent_inv = CInv(t=MSG_WTX, h=int(tx_parent_arrives["tx"].wtxid_hex, 16))
assert_equal(len(peer_spy.get_invs()), 0) assert_equal(len(peer_spy.get_invs()), 0)
peer_spy.assert_no_immediate_response(msg_getdata([parent_inv])) peer_spy.assert_no_immediate_response(msg_getdata([parent_inv]))
@@ -205,7 +205,7 @@ class OrphanHandlingTest(BitcoinTestFramework):
self.log.info("Test orphan handling when a nonsegwit parent is known to be invalid") self.log.info("Test orphan handling when a nonsegwit parent is known to be invalid")
parent_low_fee_nonsegwit = self.wallet_nonsegwit.create_self_transfer(fee_rate=0) parent_low_fee_nonsegwit = self.wallet_nonsegwit.create_self_transfer(fee_rate=0)
assert_equal(parent_low_fee_nonsegwit["txid"], parent_low_fee_nonsegwit["tx"].getwtxid()) assert_equal(parent_low_fee_nonsegwit["txid"], parent_low_fee_nonsegwit["tx"].wtxid_hex)
parent_other = self.wallet_nonsegwit.create_self_transfer() parent_other = self.wallet_nonsegwit.create_self_transfer()
child_nonsegwit = self.wallet_nonsegwit.create_self_transfer_multi( child_nonsegwit = self.wallet_nonsegwit.create_self_transfer_multi(
utxos_to_spend=[parent_other["new_utxo"], parent_low_fee_nonsegwit["new_utxo"]]) utxos_to_spend=[parent_other["new_utxo"], parent_low_fee_nonsegwit["new_utxo"]])
@@ -348,9 +348,9 @@ class OrphanHandlingTest(BitcoinTestFramework):
assert_equal(inflight_parent_AB["txid"], inflight_parent_AB["wtxid"]) assert_equal(inflight_parent_AB["txid"], inflight_parent_AB["wtxid"])
# Announce inflight_parent_AB and wait for getdata # Announce inflight_parent_AB and wait for getdata
peer_txrequest.send_and_ping(msg_inv([CInv(t=MSG_WTX, h=int(inflight_parent_AB["tx"].getwtxid(), 16))])) peer_txrequest.send_and_ping(msg_inv([CInv(t=MSG_WTX, h=int(inflight_parent_AB["tx"].wtxid_hex, 16))]))
self.nodes[0].bumpmocktime(NONPREF_PEER_TX_DELAY) self.nodes[0].bumpmocktime(NONPREF_PEER_TX_DELAY)
peer_txrequest.wait_for_getdata([int(inflight_parent_AB["tx"].getwtxid(), 16)]) peer_txrequest.wait_for_getdata([int(inflight_parent_AB["tx"].wtxid_hex, 16)])
self.log.info("Test that the node does not request a parent if it has an in-flight txrequest") self.log.info("Test that the node does not request a parent if it has an in-flight txrequest")
# Relay orphan child_A # Relay orphan child_A
@@ -408,11 +408,11 @@ class OrphanHandlingTest(BitcoinTestFramework):
self.log.info("Test that an orphan with rejected parents, along with any descendants, cannot be retried with an alternate witness") self.log.info("Test that an orphan with rejected parents, along with any descendants, cannot be retried with an alternate witness")
parent_low_fee_nonsegwit = self.wallet_nonsegwit.create_self_transfer(fee_rate=0) parent_low_fee_nonsegwit = self.wallet_nonsegwit.create_self_transfer(fee_rate=0)
assert_equal(parent_low_fee_nonsegwit["txid"], parent_low_fee_nonsegwit["tx"].getwtxid()) assert_equal(parent_low_fee_nonsegwit["txid"], parent_low_fee_nonsegwit["tx"].wtxid_hex)
child = self.wallet.create_self_transfer(utxo_to_spend=parent_low_fee_nonsegwit["new_utxo"]) child = self.wallet.create_self_transfer(utxo_to_spend=parent_low_fee_nonsegwit["new_utxo"])
grandchild = self.wallet.create_self_transfer(utxo_to_spend=child["new_utxo"]) grandchild = self.wallet.create_self_transfer(utxo_to_spend=child["new_utxo"])
assert_not_equal(child["txid"], child["tx"].getwtxid()) assert_not_equal(child["txid"], child["tx"].wtxid_hex)
assert_not_equal(grandchild["txid"], grandchild["tx"].getwtxid()) assert_not_equal(grandchild["txid"], grandchild["tx"].wtxid_hex)
# Relay the parent. It should be rejected because it pays 0 fees. # Relay the parent. It should be rejected because it pays 0 fees.
self.relay_transaction(peer1, parent_low_fee_nonsegwit["tx"]) self.relay_transaction(peer1, parent_low_fee_nonsegwit["tx"])
@@ -430,7 +430,7 @@ class OrphanHandlingTest(BitcoinTestFramework):
assert_equal(0, len(node.getrawmempool())) assert_equal(0, len(node.getrawmempool()))
assert not tx_in_orphanage(node, grandchild["tx"]) assert not tx_in_orphanage(node, grandchild["tx"])
peer2.assert_never_requested(child["txid"]) peer2.assert_never_requested(child["txid"])
peer2.assert_never_requested(child["tx"].getwtxid()) peer2.assert_never_requested(child["tx"].wtxid_hex)
# The child should never be requested, even if announced again with potentially different witness. # The child should never be requested, even if announced again with potentially different witness.
# Sync with ping to ensure orphans are reconsidered # Sync with ping to ensure orphans are reconsidered
+3 -3
View File
@@ -118,7 +118,7 @@ class P2PPermissionsTests(BitcoinTestFramework):
self.log.debug("Check that node[1] will send the tx to node[0] even though it is already in the mempool") self.log.debug("Check that node[1] will send the tx to node[0] even though it is already in the mempool")
self.connect_nodes(1, 0) self.connect_nodes(1, 0)
with self.nodes[1].assert_debug_log(["Force relaying tx {} (wtxid={}) from peer=0".format(txid, tx.getwtxid())]): with self.nodes[1].assert_debug_log(["Force relaying tx {} (wtxid={}) from peer=0".format(txid, tx.wtxid_hex)]):
p2p_rebroadcast_wallet.send_txs_and_test([tx], self.nodes[1]) p2p_rebroadcast_wallet.send_txs_and_test([tx], self.nodes[1])
self.wait_until(lambda: txid in self.nodes[0].getrawmempool()) self.wait_until(lambda: txid in self.nodes[0].getrawmempool())
@@ -134,14 +134,14 @@ class P2PPermissionsTests(BitcoinTestFramework):
[tx], [tx],
self.nodes[1], self.nodes[1],
success=False, success=False,
reject_reason='{} (wtxid={}) from peer=0 was not accepted: dust'.format(txid, tx.getwtxid()) reject_reason='{} (wtxid={}) from peer=0 was not accepted: dust'.format(txid, tx.wtxid_hex)
) )
p2p_rebroadcast_wallet.send_txs_and_test( p2p_rebroadcast_wallet.send_txs_and_test(
[tx], [tx],
self.nodes[1], self.nodes[1],
success=False, success=False,
reject_reason='Not relaying non-mempool transaction {} (wtxid={}) from forcerelay peer=0'.format(txid, tx.getwtxid()) reject_reason='Not relaying non-mempool transaction {} (wtxid={}) from forcerelay peer=0'.format(txid, tx.wtxid_hex)
) )
def checkpermission(self, args, expectedPermissions): def checkpermission(self, args, expectedPermissions):
+4 -4
View File
@@ -336,7 +336,7 @@ class SegWitTest(BitcoinTestFramework):
# Verify the hash with witness differs from the txid # Verify the hash with witness differs from the txid
# (otherwise our testing framework must be broken!) # (otherwise our testing framework must be broken!)
assert_not_equal(tx.txid_hex, tx.getwtxid()) assert_not_equal(tx.txid_hex, tx.wtxid_hex)
# Construct a block that includes the transaction. # Construct a block that includes the transaction.
block = self.build_next_block() block = self.build_next_block()
@@ -615,7 +615,7 @@ class SegWitTest(BitcoinTestFramework):
assert_equal(testres3, assert_equal(testres3,
[{ [{
'txid': tx3.txid_hex, 'txid': tx3.txid_hex,
'wtxid': tx3.getwtxid(), 'wtxid': tx3.wtxid_hex,
'allowed': True, 'allowed': True,
'vsize': tx3.get_vsize(), 'vsize': tx3.get_vsize(),
'fees': { 'fees': {
@@ -633,7 +633,7 @@ class SegWitTest(BitcoinTestFramework):
assert_equal(testres3_replaced, assert_equal(testres3_replaced,
[{ [{
'txid': tx3.txid_hex, 'txid': tx3.txid_hex,
'wtxid': tx3.getwtxid(), 'wtxid': tx3.wtxid_hex,
'allowed': True, 'allowed': True,
'vsize': tx3.get_vsize(), 'vsize': tx3.get_vsize(),
'fees': { 'fees': {
@@ -1258,7 +1258,7 @@ class SegWitTest(BitcoinTestFramework):
# Test that getrawtransaction returns correct witness information # Test that getrawtransaction returns correct witness information
# hash, size, vsize # hash, size, vsize
raw_tx = self.nodes[0].getrawtransaction(tx3.txid_hex, 1) raw_tx = self.nodes[0].getrawtransaction(tx3.txid_hex, 1)
assert_equal(raw_tx["hash"], tx3.getwtxid()) assert_equal(raw_tx["hash"], tx3.wtxid_hex)
assert_equal(raw_tx["size"], len(tx3.serialize_with_witness())) assert_equal(raw_tx["size"], len(tx3.serialize_with_witness()))
vsize = tx3.get_vsize() vsize = tx3.get_vsize()
assert_equal(raw_tx["vsize"], vsize) assert_equal(raw_tx["vsize"], vsize)
+9 -9
View File
@@ -106,7 +106,7 @@ class RPCPackagesTest(BitcoinTestFramework):
# Package validation is atomic: if the node cannot find a UTXO for any single tx in the package, # Package validation is atomic: if the node cannot find a UTXO for any single tx in the package,
# it terminates immediately to avoid unnecessary, expensive signature verification. # it terminates immediately to avoid unnecessary, expensive signature verification.
package_bad = self.independent_txns_hex + [garbage_tx] package_bad = self.independent_txns_hex + [garbage_tx]
testres_bad = self.independent_txns_testres_blank + [{"txid": tx.txid_hex, "wtxid": tx.getwtxid(), "allowed": False, "reject-reason": "missing-inputs"}] testres_bad = self.independent_txns_testres_blank + [{"txid": tx.txid_hex, "wtxid": tx.wtxid_hex, "allowed": False, "reject-reason": "missing-inputs"}]
self.assert_testres_equal(package_bad, testres_bad) self.assert_testres_equal(package_bad, testres_bad)
self.log.info("Check testmempoolaccept tells us when some transactions completed validation successfully") self.log.info("Check testmempoolaccept tells us when some transactions completed validation successfully")
@@ -118,7 +118,7 @@ class RPCPackagesTest(BitcoinTestFramework):
# have been fully validated, which is why the node returns full validation results for all # have been fully validated, which is why the node returns full validation results for all
# transactions here but empty results in other cases. # transactions here but empty results in other cases.
tx_bad_sig_txid = tx_bad_sig.txid_hex tx_bad_sig_txid = tx_bad_sig.txid_hex
tx_bad_sig_wtxid = tx_bad_sig.getwtxid() tx_bad_sig_wtxid = tx_bad_sig.wtxid_hex
assert_equal(testres_bad_sig, self.independent_txns_testres + [{ assert_equal(testres_bad_sig, self.independent_txns_testres + [{
"txid": tx_bad_sig_txid, "txid": tx_bad_sig_txid,
"wtxid": tx_bad_sig_wtxid, "allowed": False, "wtxid": tx_bad_sig_wtxid, "allowed": False,
@@ -146,7 +146,7 @@ class RPCPackagesTest(BitcoinTestFramework):
self.log.info("Check that testmempoolaccept requires packages to be sorted by dependency") self.log.info("Check that testmempoolaccept requires packages to be sorted by dependency")
assert_equal(node.testmempoolaccept(rawtxs=chain_hex[::-1]), assert_equal(node.testmempoolaccept(rawtxs=chain_hex[::-1]),
[{"txid": tx.txid_hex, "wtxid": tx.getwtxid(), "package-error": "package-not-sorted"} for tx in chain_txns[::-1]]) [{"txid": tx.txid_hex, "wtxid": tx.wtxid_hex, "package-error": "package-not-sorted"} for tx in chain_txns[::-1]])
self.log.info("Testmempoolaccept a chain of 25 transactions") self.log.info("Testmempoolaccept a chain of 25 transactions")
testres_multiple = node.testmempoolaccept(rawtxs=chain_hex) testres_multiple = node.testmempoolaccept(rawtxs=chain_hex)
@@ -353,8 +353,8 @@ class RPCPackagesTest(BitcoinTestFramework):
assert_equal(submitpackage_result["package_msg"], "success") assert_equal(submitpackage_result["package_msg"], "success")
for package_txn in package_txns: for package_txn in package_txns:
tx = package_txn["tx"] tx = package_txn["tx"]
assert tx.getwtxid() in submitpackage_result["tx-results"] assert tx.wtxid_hex in submitpackage_result["tx-results"]
wtxid = tx.getwtxid() wtxid = tx.wtxid_hex
assert wtxid in submitpackage_result["tx-results"] assert wtxid in submitpackage_result["tx-results"]
tx_result = submitpackage_result["tx-results"][wtxid] tx_result = submitpackage_result["tx-results"][wtxid]
assert_equal(tx_result["txid"], tx.txid_hex) assert_equal(tx_result["txid"], tx.txid_hex)
@@ -368,7 +368,7 @@ class RPCPackagesTest(BitcoinTestFramework):
self.assert_equal_package_results(node, testmempoolaccept_result, submitpackage_result) self.assert_equal_package_results(node, testmempoolaccept_result, submitpackage_result)
# The node should announce each transaction. No guarantees for propagation. # The node should announce each transaction. No guarantees for propagation.
peer.wait_for_broadcast([tx["tx"].getwtxid() for tx in package_txns]) peer.wait_for_broadcast([tx["tx"].wtxid_hex for tx in package_txns])
self.generate(node, 1) self.generate(node, 1)
def test_submitpackage(self): def test_submitpackage(self):
@@ -410,9 +410,9 @@ class RPCPackagesTest(BitcoinTestFramework):
hex_partial_acceptance = [txs[0]["hex"], bad_child.serialize().hex()] hex_partial_acceptance = [txs[0]["hex"], bad_child.serialize().hex()]
res = node.submitpackage(hex_partial_acceptance) res = node.submitpackage(hex_partial_acceptance)
assert_equal(res["package_msg"], "transaction failed") assert_equal(res["package_msg"], "transaction failed")
first_wtxid = txs[0]["tx"].getwtxid() first_wtxid = txs[0]["tx"].wtxid_hex
assert "error" not in res["tx-results"][first_wtxid] assert "error" not in res["tx-results"][first_wtxid]
sec_wtxid = bad_child.getwtxid() sec_wtxid = bad_child.wtxid_hex
assert_equal(res["tx-results"][sec_wtxid]["error"], "version") assert_equal(res["tx-results"][sec_wtxid]["error"], "version")
peer.wait_for_broadcast([first_wtxid]) peer.wait_for_broadcast([first_wtxid])
@@ -496,7 +496,7 @@ class RPCPackagesTest(BitcoinTestFramework):
# Relax the restrictions for both and send it; parent gets through as own subpackage # Relax the restrictions for both and send it; parent gets through as own subpackage
pkg_result = node.submitpackage(chained_burn_hex, maxfeerate=minrate_btc_kvb_burn, maxburnamount=chained_txns_burn[1]["new_utxo"]["value"]) pkg_result = node.submitpackage(chained_burn_hex, maxfeerate=minrate_btc_kvb_burn, maxburnamount=chained_txns_burn[1]["new_utxo"]["value"])
assert "error" not in pkg_result["tx-results"][chained_txns_burn[0]["wtxid"]] assert "error" not in pkg_result["tx-results"][chained_txns_burn[0]["wtxid"]]
assert_equal(pkg_result["tx-results"][tx.getwtxid()]["error"], "scriptpubkey") assert_equal(pkg_result["tx-results"][tx.wtxid_hex]["error"], "scriptpubkey")
assert_equal(node.getrawmempool(), [chained_txns_burn[0]["txid"]]) assert_equal(node.getrawmempool(), [chained_txns_burn[0]["txid"]])
if __name__ == "__main__": if __name__ == "__main__":
@@ -104,5 +104,5 @@ def fill_mempool(test_framework, node, *, tx_sync_fun=None):
def tx_in_orphanage(node, tx: CTransaction) -> bool: def tx_in_orphanage(node, tx: CTransaction) -> bool:
"""Returns true if the transaction is in the orphanage.""" """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 return len(found) == 1
+2 -1
View File
@@ -657,7 +657,8 @@ class CTransaction:
def serialize(self): def serialize(self):
return self.serialize_with_witness() return self.serialize_with_witness()
def getwtxid(self): @property
def wtxid_hex(self):
"""Return wtxid (transaction hash with witness) as hex string.""" """Return wtxid (transaction hash with witness) as hex string."""
return hash256(self.serialize())[::-1].hex() return hash256(self.serialize())[::-1].hex()
+2 -2
View File
@@ -287,7 +287,7 @@ class MiniWallet:
return { return {
"sent_vout": 1, "sent_vout": 1,
"txid": txid, "txid": txid,
"wtxid": tx.getwtxid(), "wtxid": tx.wtxid_hex,
"hex": tx.serialize().hex(), "hex": tx.serialize().hex(),
"tx": tx, "tx": tx,
} }
@@ -352,7 +352,7 @@ class MiniWallet:
) for i in range(len(tx.vout))], ) for i in range(len(tx.vout))],
"fee": fee, "fee": fee,
"txid": txid, "txid": txid,
"wtxid": tx.getwtxid(), "wtxid": tx.wtxid_hex,
"hex": tx.serialize().hex(), "hex": tx.serialize().hex(),
"tx": tx, "tx": tx,
} }