cleaning and o=improving

parent 1157e817
...@@ -34,7 +34,7 @@ class Network(): ...@@ -34,7 +34,7 @@ class Network():
w = randint(1, 51, 4) # 51 is excluded - range (1,50) w = randint(1, 51, 4) # 51 is excluded - range (1,50)
self.badaW = np.sum(w) self.badaW = np.sum(w)
i = 0 i = 0
with open('Nodes.dat', 'r') as f: with open('Nodes1.dat', 'r') as f:
reader = csv.reader(f) reader = csv.reader(f)
for row in reader: for row in reader:
node = row[0] # Node id node = row[0] # Node id
...@@ -44,7 +44,7 @@ class Network(): ...@@ -44,7 +44,7 @@ class Network():
# print(self.nodes.get('1')) #keys are strings # print(self.nodes.get('1')) #keys are strings
with open('Links.dat', 'r') as f: with open('Links1.dat', 'r') as f:
reader = csv.reader(f) reader = csv.reader(f)
for row in reader: for row in reader:
tup = row[0].split() tup = row[0].split()
......
...@@ -59,6 +59,7 @@ class OverlayNode(Node): ...@@ -59,6 +59,7 @@ class OverlayNode(Node):
# Todo something is wrong here not getting correct votes back # Todo something is wrong here not getting correct votes back
votes = Utility.verifySort(pk, sorthash, proof, seed, tou, role, self.network.pk_weight_map.get(pk), self.network.badaW) votes = Utility.verifySort(pk, sorthash, proof, seed, tou, role, self.network.pk_weight_map.get(pk), self.network.badaW)
print("why votes be zero") print("why votes be zero")
print(votes,"\t",value,"\t",sorthash)
return votes,value,sorthash return votes,value,sorthash
pass pass
...@@ -73,7 +74,6 @@ class OverlayNode(Node): ...@@ -73,7 +74,6 @@ class OverlayNode(Node):
# print(round, " # ",step ) # print(round, " # ",step )
if msg_round== round and msg_step==step : #check if message belong to current round and current step or not if msg_round== round and msg_step==step : #check if message belong to current round and current step or not
votes,value,sorthash = self.algo_processMsg(msg,tou) votes,value,sorthash = self.algo_processMsg(msg,tou)
print("votes : ",votes)
if msg_pk in voters or votes == 0: if msg_pk in voters or votes == 0:
print(self.id + " continuing") print(self.id + " continuing")
continue continue
......
...@@ -2,7 +2,6 @@ import hashlib ...@@ -2,7 +2,6 @@ import hashlib
from numpy.random import randint from numpy.random import randint
import sys import sys
import networkx as nx import networkx as nx
import matplotlib.pyplot as plt
from networkx.algorithms import community from networkx.algorithms import community
f = open("Nodes1.dat", "w") f = open("Nodes1.dat", "w")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment