@pytest.mark.asyncio
async def test_cc_spend_uncoloured(self, two_wallet_nodes):
    num_blocks = 3
    (full_nodes, wallets) = two_wallet_nodes
    full_node_api = full_nodes[0]
    full_node_server = full_node_api.server
    (wallet_node, server_2) = wallets[0]
    (wallet_node_2, server_3) = wallets[1]
    wallet = wallet_node.wallet_state_manager.main_wallet
    wallet2 = wallet_node_2.wallet_state_manager.main_wallet
    ph = (await wallet.get_new_puzzlehash())
    (await server_2.start_client(PeerInfo('localhost', uint16(full_node_server._port)), None))
    (await server_3.start_client(PeerInfo('localhost', uint16(full_node_server._port)), None))
    for i in range(1, num_blocks):
        (await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph)))
    funds = sum([(calculate_pool_reward(uint32(i)) + calculate_base_farmer_reward(uint32(i))) for i in range(1, (num_blocks - 1))])
    (await time_out_assert(15, wallet.get_confirmed_balance, funds))
    cc_wallet: CCWallet = (await CCWallet.create_new_cc(wallet_node.wallet_state_manager, wallet, uint64(100)))
    tx_queue: List[TransactionRecord] = (await wallet_node.wallet_state_manager.tx_store.get_not_sent())
    tx_record = tx_queue[0]
    (await time_out_assert(15, tx_in_pool, True, full_node_api.full_node.mempool_manager, tx_record.spend_bundle.name()))
    for i in range(1, num_blocks):
        (await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol((32 * b'0'))))
    (await time_out_assert(15, cc_wallet.get_confirmed_balance, 100))
    (await time_out_assert(15, cc_wallet.get_unconfirmed_balance, 100))
    assert (cc_wallet.cc_info.my_genesis_checker is not None)
    colour = cc_wallet.get_colour()
    cc_wallet_2: CCWallet = (await CCWallet.create_wallet_for_cc(wallet_node_2.wallet_state_manager, wallet2, colour))
    assert (cc_wallet.cc_info.my_genesis_checker == cc_wallet_2.cc_info.my_genesis_checker)
    cc_2_hash = (await cc_wallet_2.get_new_inner_hash())
    tx_record = (await cc_wallet.generate_signed_transaction([uint64(60)], [cc_2_hash]))
    (await wallet.wallet_state_manager.add_pending_transaction(tx_record))
    (await time_out_assert(15, tx_in_pool, True, full_node_api.full_node.mempool_manager, tx_record.spend_bundle.name()))
    for i in range(1, num_blocks):
        (await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol((32 * b'0'))))
    (await time_out_assert(15, cc_wallet.get_confirmed_balance, 40))
    (await time_out_assert(15, cc_wallet.get_unconfirmed_balance, 40))
    (await time_out_assert(15, cc_wallet_2.get_confirmed_balance, 60))
    (await time_out_assert(15, cc_wallet_2.get_unconfirmed_balance, 60))
    cc2_ph = (await cc_wallet_2.get_new_cc_puzzle_hash())
    tx_record = (await wallet.wallet_state_manager.main_wallet.generate_signed_transaction(10, cc2_ph, 0))
    (await wallet.wallet_state_manager.add_pending_transaction(tx_record))
    (await time_out_assert(15, tx_in_pool, True, full_node_api.full_node.mempool_manager, tx_record.spend_bundle.name()))
    for i in range(0, num_blocks):
        (await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol((32 * b'0'))))
    id = cc_wallet_2.id()
    wsm = cc_wallet_2.wallet_state_manager
    (await time_out_assert(15, wsm.get_confirmed_balance_for_wallet, 70, id))
    (await time_out_assert(15, cc_wallet_2.get_confirmed_balance, 60))
    (await time_out_assert(15, cc_wallet_2.get_unconfirmed_balance, 60))
@pytest.mark.asyncio
async def test_cc_spend_uncoloured(self, two_wallet_nodes):
    num_blocks = 3
    (full_nodes, wallets) = two_wallet_nodes
    full_node_api = full_nodes[0]
    full_node_server = full_node_api.server
    (wallet_node, server_2) = wallets[0]
    (wallet_node_2, server_3) = wallets[1]
    wallet = wallet_node.wallet_state_manager.main_wallet
    wallet2 = wallet_node_2.wallet_state_manager.main_wallet
    ph = (await wallet.get_new_puzzlehash())
    (await server_2.start_client(PeerInfo('localhost', uint16(full_node_server._port)), None))
    (await server_3.start_client(PeerInfo('localhost', uint16(full_node_server._port)), None))
    for i in range(1, num_blocks):
        (await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph)))
    funds = sum([(calculate_pool_reward(uint32(i)) + calculate_base_farmer_reward(uint32(i))) for i in range(1, (num_blocks - 1))])
    (await time_out_assert(15, wallet.get_confirmed_balance, funds))
    cc_wallet: CCWallet = (await CCWallet.create_new_cc(wallet_node.wallet_state_manager, wallet, uint64(100)))
    tx_queue: List[TransactionRecord] = (await wallet_node.wallet_state_manager.tx_store.get_not_sent())
    tx_record = tx_queue[0]
    (await time_out_assert(15, tx_in_pool, True, full_node_api.full_node.mempool_manager, tx_record.spend_bundle.name()))
    for i in range(1, num_blocks):
        (await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol((32 * b'0'))))
    (await time_out_assert(15, cc_wallet.get_confirmed_balance, 100))
    (await time_out_assert(15, cc_wallet.get_unconfirmed_balance, 100))
    assert (cc_wallet.cc_info.my_genesis_checker is not None)
    colour = cc_wallet.get_colour()
    cc_wallet_2: CCWallet = (await CCWallet.create_wallet_for_cc(wallet_node_2.wallet_state_manager, wallet2, colour))
    assert (cc_wallet.cc_info.my_genesis_checker == cc_wallet_2.cc_info.my_genesis_checker)
    cc_2_hash = (await cc_wallet_2.get_new_inner_hash())
    tx_record = (await cc_wallet.generate_signed_transaction([uint64(60)], [cc_2_hash]))
    (await wallet.wallet_state_manager.add_pending_transaction(tx_record))
    (await time_out_assert(15, tx_in_pool, True, full_node_api.full_node.mempool_manager, tx_record.spend_bundle.name()))
    for i in range(1, num_blocks):
        (await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol((32 * b'0'))))
    (await time_out_assert(15, cc_wallet.get_confirmed_balance, 40))
    (await time_out_assert(15, cc_wallet.get_unconfirmed_balance, 40))
    (await time_out_assert(15, cc_wallet_2.get_confirmed_balance, 60))
    (await time_out_assert(15, cc_wallet_2.get_unconfirmed_balance, 60))
    cc2_ph = (await cc_wallet_2.get_new_cc_puzzle_hash())
    tx_record = (await wallet.wallet_state_manager.main_wallet.generate_signed_transaction(10, cc2_ph, 0))
    (await wallet.wallet_state_manager.add_pending_transaction(tx_record))
    (await time_out_assert(15, tx_in_pool, True, full_node_api.full_node.mempool_manager, tx_record.spend_bundle.name()))
    for i in range(0, num_blocks):
        (await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol((32 * b'0'))))
    id = cc_wallet_2.id()
    wsm = cc_wallet_2.wallet_state_manager
    (await time_out_assert(15, wsm.get_confirmed_balance_for_wallet, 70, id))
    (await time_out_assert(15, cc_wallet_2.get_confirmed_balance, 60))
    (await time_out_assert(15, cc_wallet_2.get_unconfirmed_balance, 60))