Пример #1
0
        # every node is a neighbor of the other for right now
        for i in range(0, len(nodes)):
            for j in range(0, len(nodes)):
                if i != j:
                    nodes[i].add_neighbor(nodes[j])

    tx_rate = TX_RATE if 'transaction_rate' not in params else params[
        'transaction_rate']

    # generate mock poisson dataset
    if params['dataset'] == 'poisson':
        tx_dataset = generate_tx_dataset.poisson(tx_rate, params['duration'],
                                                 0, c.nodes)
    elif params['dataset'] == 'deterministic':
        tx_dataset = generate_tx_dataset.deterministic(tx_rate,
                                                       params['duration'], 0,
                                                       c.nodes)

    # generate proposal events
    c.generate_proposals()
    # set transaction dataset
    c.set_transactions(tx_dataset)

    # create arrays to store proposals and transactions
    for node_id in range(0, num_nodes):
        nodes[node_id].create_arrays(len(tx_dataset))

    # run simulation
    c.run()