|
30 | 30 | from test_framework.script import ( |
31 | 31 | CScript, |
32 | 32 | OP_CHECKSIG, |
33 | | - OP_DUP, |
34 | | - OP_EQUALVERIFY, |
35 | | - OP_HASH160, |
36 | 33 | OP_RETURN, |
37 | | - hash160, |
38 | 34 | ) |
| 35 | +from test_framework.script_util import key_to_p2pkh_script |
39 | 36 | from test_framework.test_framework import DashTestFramework |
40 | 37 | from test_framework.util import ( |
41 | 38 | assert_equal, |
@@ -66,8 +63,8 @@ def create_assetlock(self, coin, amount, pubkey): |
66 | 63 | tmp_amount = amount |
67 | 64 | if tmp_amount > COIN: |
68 | 65 | tmp_amount -= COIN |
69 | | - credit_outputs.append(CTxOut(COIN, CScript([OP_DUP, OP_HASH160, hash160(pubkey), OP_EQUALVERIFY, OP_CHECKSIG]))) |
70 | | - credit_outputs.append(CTxOut(tmp_amount, CScript([OP_DUP, OP_HASH160, hash160(pubkey), OP_EQUALVERIFY, OP_CHECKSIG]))) |
| 66 | + credit_outputs.append(CTxOut(COIN, key_to_p2pkh_script(pubkey))) |
| 67 | + credit_outputs.append(CTxOut(tmp_amount, key_to_p2pkh_script(pubkey))) |
71 | 68 |
|
72 | 69 | lockTx_payload = CAssetLockTx(1, credit_outputs) |
73 | 70 |
|
@@ -281,7 +278,11 @@ def test_asset_locks(self, node_wallet, node, pubkey): |
281 | 278 | self.check_mempool_result(tx=asset_lock_tx, result_expected={'allowed': True, 'fees': {'base': Decimal(str(tiny_amount / COIN))}}) |
282 | 279 | self.validate_credit_pool_balance(0) |
283 | 280 | txid_in_block = self.send_tx(asset_lock_tx) |
284 | | - assert "assetLockTx" in node.getrawtransaction(txid_in_block, 1) |
| 281 | + rpc_tx = node.getrawtransaction(txid_in_block, 1) |
| 282 | + assert_equal(len(rpc_tx["assetLockTx"]["creditOutputs"]), 2) |
| 283 | + assert_equal(rpc_tx["assetLockTx"]["creditOutputs"][0]["valueSat"] + rpc_tx["assetLockTx"]["creditOutputs"][1]["valueSat"], locked_1) |
| 284 | + assert_equal(rpc_tx["assetLockTx"]["creditOutputs"][0]["scriptPubKey"]["hex"], key_to_p2pkh_script(pubkey).hex()) |
| 285 | + assert_equal(rpc_tx["assetLockTx"]["creditOutputs"][1]["scriptPubKey"]["hex"], key_to_p2pkh_script(pubkey).hex()) |
285 | 286 | self.validate_credit_pool_balance(0) |
286 | 287 | node.generate(1) |
287 | 288 | assert_equal(self.get_credit_pool_balance(node=node), locked_1) |
|
0 commit comments