Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- bootstrap_node_list_recieved = [] #List of all nodes addresses recieved during the bootstrap peroid - Is a list so we can compare duplicatition probability etc
- average_getAdrr_no_node_response = 100 #Number or nodes typically sent when a node requests a getAddr message
- network_ip_node_size = 5000 # Number of IP addresses / nodes that have been seen on the network in the past 2 weeks
- #Move into calculations.py when ready
- #Number of nodes recieved (Bootstrap)
- def bootstrap_node_getAddr():
- #### TODO ####
- #Random generation of nodes (number represents a single node), from 1 to x for an average amount of nodes
- # node_list=[random.randrange(1,network_ip_node_size,1) for _ in range (average_getAdrr_no_node_response)]
- for i in range (average_getAdrr_no_node_response):
- bootstrap_node_list_recieved.append(random.randrange(1,network_ip_node_size,1))
- print 'bootstrap_node_getAddr: ', bootstrap_node_list_recieved
- # return bootstrap_node_list_recieved
- bootstrap_node_getAddr()
- Traceback (most recent call last):
- File "BootstrapBTC.py", line 117, in query_dns_servers
- bootstrap_node_getAddr()
- File "/home/richard/Dropbox/PhD/Simulator BTC - Ours/Calculations.py", line 33, in bootstrap_node_getAddr
- bootstrap_node_list_recieved.append(random.randrange(1,network_ip_node_size,1))
- AttributeError: 'builtin_function_or_method' object has no attribute 'randrange'
- The above exception was the direct cause of the following exception:
- Traceback (most recent call last):
- File "BootstrapBTC.py", line 90, in run
- yield self.env.process(query_dns_servers(env, self))
- AttributeError: 'builtin_function_or_method' object has no attribute 'randrange'
- The above exception was the direct cause of the following exception:
- Traceback (most recent call last):
- File "BootstrapBTC.py", line 178, in <module>
- env.run()
- File "/usr/local/lib/python2.7/dist-packages/simpy/core.py", line 137, in run
- self.step()
- File "/usr/local/lib/python2.7/dist-packages/simpy/core.py", line 229, in step
- raise exc
- AttributeError: 'builtin_function_or_method' object has no attribute 'randrange
- yield self.env.process(query_dns_servers(env, self))
- #Average respsonse time from a DNS server
- def DnsServerResponse(env, self):
- yield self.env.timeout(dns_average_response)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement