test: remove child_one/child_two (w)txid variables

This commit is contained in:
naiyoma
2025-07-30 13:31:41 +03:00
parent 7cfe790820
commit 3f5211cba8

View File

@@ -45,31 +45,27 @@ class MempoolWtxidTest(BitcoinTestFramework):
self.generate(node, 1) self.generate(node, 1)
peer_wtxid_relay = node.add_p2p_connection(P2PTxInvStore()) peer_wtxid_relay = node.add_p2p_connection(P2PTxInvStore())
child_one_wtxid = child_one.wtxid_hex
child_one_txid = child_one.txid_hex
child_two_wtxid = child_two.wtxid_hex
child_two_txid = child_two.txid_hex
assert_equal(child_one_txid, child_two_txid) assert_equal(child_one.txid_hex, child_two.txid_hex)
assert_not_equal(child_one_wtxid, child_two_wtxid) assert_not_equal(child_one.wtxid_hex, child_two.wtxid_hex)
self.log.info("Submit child_one to the mempool") self.log.info("Submit child_one to the mempool")
txid_submitted = node.sendrawtransaction(child_one.serialize().hex()) txid_submitted = node.sendrawtransaction(child_one.serialize().hex())
assert_equal(node.getmempoolentry(txid_submitted)['wtxid'], child_one_wtxid) assert_equal(node.getmempoolentry(txid_submitted)['wtxid'], child_one.wtxid_hex)
peer_wtxid_relay.wait_for_broadcast([child_one_wtxid]) peer_wtxid_relay.wait_for_broadcast([child_one.wtxid_hex])
assert_equal(node.getmempoolinfo()["unbroadcastcount"], 0) assert_equal(node.getmempoolinfo()["unbroadcastcount"], 0)
# testmempoolaccept reports the "already in mempool" error # testmempoolaccept reports the "already in mempool" error
assert_equal(node.testmempoolaccept([child_one.serialize().hex()]), [{ assert_equal(node.testmempoolaccept([child_one.serialize().hex()]), [{
"txid": child_one_txid, "txid": child_one.txid_hex,
"wtxid": child_one_wtxid, "wtxid": child_one.wtxid_hex,
"allowed": False, "allowed": False,
"reject-reason": "txn-already-in-mempool", "reject-reason": "txn-already-in-mempool",
"reject-details": "txn-already-in-mempool" "reject-details": "txn-already-in-mempool"
}]) }])
assert_equal(node.testmempoolaccept([child_two.serialize().hex()])[0], { assert_equal(node.testmempoolaccept([child_two.serialize().hex()])[0], {
"txid": child_two_txid, "txid": child_two.txid_hex,
"wtxid": child_two_wtxid, "wtxid": child_two.wtxid_hex,
"allowed": False, "allowed": False,
"reject-reason": "txn-same-nonwitness-data-in-mempool", "reject-reason": "txn-same-nonwitness-data-in-mempool",
"reject-details": "txn-same-nonwitness-data-in-mempool" "reject-details": "txn-same-nonwitness-data-in-mempool"
@@ -87,7 +83,7 @@ class MempoolWtxidTest(BitcoinTestFramework):
# The node should rebroadcast the transaction using the wtxid of the correct transaction # The node should rebroadcast the transaction using the wtxid of the correct transaction
# (child_one, which is in its mempool). # (child_one, which is in its mempool).
peer_wtxid_relay_2.wait_for_broadcast([child_one_wtxid]) peer_wtxid_relay_2.wait_for_broadcast([child_one.wtxid_hex])
assert_equal(node.getmempoolinfo()["unbroadcastcount"], 0) assert_equal(node.getmempoolinfo()["unbroadcastcount"], 0)
if __name__ == '__main__': if __name__ == '__main__':