test: check creditOutputs format

This commit is contained in:
UdjinM6 2024-08-24 00:51:14 +03:00
parent ba0e64505b
commit 3ed6246889
No known key found for this signature in database
GPG Key ID: 83592BD1400D58D9

View File

@ -36,6 +36,7 @@ from test_framework.script import (
OP_RETURN, OP_RETURN,
hash160, hash160,
) )
from test_framework.script_util import key_to_p2pkh_script
from test_framework.test_framework import DashTestFramework from test_framework.test_framework import DashTestFramework
from test_framework.util import ( from test_framework.util import (
assert_equal, assert_equal,
@ -283,7 +284,11 @@ class AssetLocksTest(DashTestFramework):
self.check_mempool_result(tx=asset_lock_tx, result_expected={'allowed': True, 'fees': {'base': Decimal(str(tiny_amount / COIN))}}) self.check_mempool_result(tx=asset_lock_tx, result_expected={'allowed': True, 'fees': {'base': Decimal(str(tiny_amount / COIN))}})
self.validate_credit_pool_balance(0) self.validate_credit_pool_balance(0)
txid_in_block = self.send_tx(asset_lock_tx) txid_in_block = self.send_tx(asset_lock_tx)
assert "assetLockTx" in node.getrawtransaction(txid_in_block, 1) rpc_tx = node.getrawtransaction(txid_in_block, 1)
assert_equal(len(rpc_tx["assetLockTx"]["creditOutputs"]), 2)
assert_equal(rpc_tx["assetLockTx"]["creditOutputs"][0]["valueSat"] + rpc_tx["assetLockTx"]["creditOutputs"][1]["valueSat"], locked_1)
assert_equal(rpc_tx["assetLockTx"]["creditOutputs"][0]["scriptPubKey"]["hex"], key_to_p2pkh_script(pubkey).hex())
assert_equal(rpc_tx["assetLockTx"]["creditOutputs"][1]["scriptPubKey"]["hex"], key_to_p2pkh_script(pubkey).hex())
self.validate_credit_pool_balance(0) self.validate_credit_pool_balance(0)
node.generate(1) node.generate(1)
assert_equal(self.get_credit_pool_balance(node=node), locked_1) assert_equal(self.get_credit_pool_balance(node=node), locked_1)