def transaction_prop(tx):
     # Fill each pending list. This is for transaction propogation
     for node in p.NODES:
         if tx.sender != node.id:
             # transaction propogation delay in seconds
             tx.timestamp[1] = tx.timestamp[1] + Network.tx_prop_delay()
             node.all_transactions.append(tx)
 def transaction_prop(tx):
     # Fill each pending list. This is for transaction propogation
     for i in p.NODES:
         if tx.sender != i.id:
             t= tx
             t.timestamp[1] = t.timestamp[1] + Network.tx_prop_delay() # transaction propogation delay in seconds
             i.transactionsPool.append(t)
 def propagate_block(block):
     for recipient in p.NODES:
         if recipient.id != block.miner:
             blockDelay = Network.block_prop_delay(
             )  # draw block propagation delay from a distribution !! or you can assign 0 to ignore block propagation delay
             Scheduler.receive_block_event(recipient, block, blockDelay)
Example #4
0
fileName = 'AllResults'
startTime = timeit.default_timer()

ResultLog = Log(fileName)

minimumValue = 0
maximumValue = 8
sizeOfLinkBundles = 7

solutions = []
iterationNumber = 0

print("Starting...")

Net = Network(folderName="Topologia1")
allPossibilities = list(map(list, product(range(minimumValue, maximumValue + 1), repeat=sizeOfLinkBundles)))

for individual in allPossibilities:
    print("Iteration Number: " + str(iterationNumber) + "\tpercentage: " + str(round(float(iterationNumber/len(allPossibilities) * 100), 2)))

    result = evaluateNetwork(Net, individual)
    if not result[1] >= 1.1:

        ResultLog.log(result)
    iterationNumber += 1

ResultLog.save()

stopTime = timeit.default_timer()