示例#1
0
def bond_to_the_network(network: OneNodeNetwork, contract: str,
                        bond_amount: int):
    network.add_new_node_to_network()
    assert len(network.docker_nodes) == 2, "Total number of nodes should be 2."
    node0, node1 = network.docker_nodes
    block_hash = node1.bond(session_contract=contract, amount=bond_amount)
    return block_hash
def add_funded_account_to_network(network: OneNodeNetwork,
                                  account_number: int):
    node0 = network.docker_nodes[0]
    prev_number = len(network.docker_nodes)
    account = network.add_new_node_to_network(account=Account(account_number))
    assert (len(network.docker_nodes) == prev_number +
            1), f"Total number of nodes should be {prev_number + 1}."
    response = node0.d_client.transfer(
        amount=1000000000,
        private_key=GENESIS_ACCOUNT.private_key_docker_path,
        target_account=account.public_key,
    )
    assert "Success!" in response
    deploy_hash = response.split()[2]
    node0.wait_for_deploy_processed_and_get_block_hash(deploy_hash)
示例#3
0
def add_funded_account_to_network(network: OneNodeNetwork,
                                  account_number: int):
    node0 = network.docker_nodes[0]
    cli = CLI(node0)
    prev_number = len(network.docker_nodes)
    account = network.add_new_node_to_network(account=Account(account_number))
    assert (len(network.docker_nodes) == prev_number +
            1), f"Total number of nodes should be {prev_number + 1}."
    response = node0.d_client.transfer(
        amount=1000000000,
        private_key=GENESIS_ACCOUNT.private_key_docker_path,
        target_account=account.public_key,
    )
    assert "Success!" in response
    block_hash = cli("propose")
    for deployInfo in node0.p_client.showDeploys(block_hash):
        assert (deployInfo.is_error is
                False), f"Transfer Failed: {deployInfo.error_message}"
示例#4
0
def add_funded_account_to_network(network: OneNodeNetwork, account_number: int):
    node0 = network.docker_nodes[0]
    prev_number = len(network.docker_nodes)
    account = network.add_new_node_to_network(account=Account(account_number))
    assert (
        len(network.docker_nodes) == prev_number + 1
    ), f"Total number of nodes should be {prev_number + 1}."
    response = node0.d_client.transfer(
        amount=1000000000,
        private_key=GENESIS_ACCOUNT.private_key_docker_path,
        target_account=account.public_key,
    )
    assert "Success!" in response
    response = node0.d_client.propose()
    block_hash = extract_block_hash_from_propose_output(response)
    assert block_hash is not None
    r = node0.client.show_deploys(block_hash)[0]
    assert r.is_error is False, f"Transfer Failed: {r.error_message}"
    assert r.error_message == ""
示例#5
0
def one_node_network_fn(docker_client_fixture):
    with OneNodeNetwork(docker_client_fixture) as onn:
        onn.create_cl_network()
        yield onn