Changeset View
Changeset View
Standalone View
Standalone View
test/functional/setup_scripts/chronik-client_token_alp.py
Show First 20 Lines • Show All 302 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
make_conform_to_ctor(block) | make_conform_to_ctor(block) | ||||
block.hashMerkleRoot = block.calc_merkle_root() | block.hashMerkleRoot = block.calc_merkle_root() | ||||
block.solve() | block.solve() | ||||
peer.send_blocks_and_test([block], node) | peer.send_blocks_and_test([block], node) | ||||
assert_equal(node.getblockcount(), 102) | assert_equal(node.getblockcount(), 102) | ||||
yield True | yield True | ||||
self.log.info("Step 7: Send another ALP tx in the mempool") | self.log.info("Step 7: Send another ALP tx in the mempool") | ||||
# Another ALP Send tx | # Another ALP Genesis tx with non-utf8 genesis info | ||||
alp_send_two_tx = CTransaction() | # we confirm this does not crash chronik-client token info endpoint | ||||
alp_send_two_tx.vin = [ | alp_nonutf8_genesis_tx = CTransaction() | ||||
alp_nonutf8_genesis_tx.vin = [ | |||||
CTxIn( | CTxIn( | ||||
COutPoint(int(another_alp_genesis_tx_txid, 16), 4), | COutPoint(int(another_alp_genesis_tx_txid, 16), 4), | ||||
SCRIPTSIG_OP_TRUE, | SCRIPTSIG_OP_TRUE, | ||||
), | ), | ||||
CTxIn( | CTxIn( | ||||
COutPoint(int(alp_send_tx_txid, 16), 2), | COutPoint(int(alp_send_tx_txid, 16), 2), | ||||
SCRIPTSIG_OP_TRUE, | SCRIPTSIG_OP_TRUE, | ||||
), | ), | ||||
] | ] | ||||
alp_send_two_tx.vout = [ | # Genesis with nonstandard token ticker and name to test how the client handles this | ||||
# token_name and token_url fields from coinbase of block 833028 | |||||
alp_nonutf8_genesis_tx.vout = [ | |||||
alp_opreturn( | alp_opreturn( | ||||
alp_send( | alp_genesis( | ||||
token_id=alp_genesis_tx_txid, | token_ticker=b"TEST", | ||||
output_amounts=[10, 1], | token_name=bytes.fromhex("0304b60c048de8d9650881002834d6490000"), | ||||
url=bytes.fromhex( | |||||
"00fabe6d6d6f5486f62c703086014607f5bed91d093b092a8faf5ac882a0ccf462682a22f002" | |||||
), | ), | ||||
data=b"Token Data", | |||||
auth_pubkey=b"Token Pubkey", | |||||
decimals=4, | |||||
mint_amounts=[10, 20, 30, 0], | |||||
num_batons=2, | |||||
) | |||||
), | ), | ||||
CTxOut(10000, P2SH_OP_TRUE), | |||||
CTxOut(546, P2SH_OP_TRUE), | |||||
CTxOut(546, P2SH_OP_TRUE), | |||||
CTxOut(coinvalue - 300000, P2SH_OP_TRUE), | CTxOut(coinvalue - 300000, P2SH_OP_TRUE), | ||||
CTxOut(5000, P2SH_OP_TRUE), | |||||
CTxOut(546, P2SH_OP_TRUE), | CTxOut(546, P2SH_OP_TRUE), | ||||
] | ] | ||||
alp_send_two_tx_txid = node.sendrawtransaction( | alp_nonutf8_genesis_tx_txid = node.sendrawtransaction( | ||||
alp_send_two_tx.serialize().hex() | alp_nonutf8_genesis_tx.serialize().hex() | ||||
) | ) | ||||
send_ipc_message({"alp_send_two_txid": alp_send_two_tx_txid}) | send_ipc_message({"alp_nonutf8_genesis_txid": alp_nonutf8_genesis_tx_txid}) | ||||
# Another ALP Mint tx | # Another ALP Mint tx | ||||
alp_mint_two_tx = CTransaction() | alp_mint_two_tx = CTransaction() | ||||
alp_mint_two_tx.vin = [ | alp_mint_two_tx.vin = [ | ||||
CTxIn( | CTxIn( | ||||
COutPoint(int(alp_send_two_tx_txid, 16), 1), | COutPoint(int(alp_nonutf8_genesis_tx_txid, 16), 4), | ||||
SCRIPTSIG_OP_TRUE, | SCRIPTSIG_OP_TRUE, | ||||
), | ), | ||||
CTxIn( | CTxIn( | ||||
COutPoint(int(alp_mint_tx_txid, 16), 3), | COutPoint(int(alp_mint_tx_txid, 16), 3), | ||||
SCRIPTSIG_OP_TRUE, | SCRIPTSIG_OP_TRUE, | ||||
), | ), | ||||
] | ] | ||||
alp_mint_two_tx.vout = [ | alp_mint_two_tx.vout = [ | ||||
Show All 26 Lines |