summaryrefslogtreecommitdiff
path: root/src/consensus
diff options
context:
space:
mode:
authorNils Gillmann <ng0@n0.is>2018-05-17 15:15:44 +0000
committerNils Gillmann <ng0@n0.is>2018-05-17 15:15:44 +0000
commit36a3e39e84cae138dc944755134c81103daca598 (patch)
treedaea923b694e74e660714225d6abb86a62e0e8aa /src/consensus
parent5f53f5bbf0df72a67bddfc4815a1da7301dd46db (diff)
follow-up
Signed-off-by: Nils Gillmann <ng0@n0.is>
Diffstat (limited to 'src/consensus')
-rw-r--r--src/consensus/consensus-simulation.py.in12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/consensus/consensus-simulation.py.in b/src/consensus/consensus-simulation.py.in
index 71a91302e..fbad9f678 100644
--- a/src/consensus/consensus-simulation.py.in
+++ b/src/consensus/consensus-simulation.py.in
@@ -21,7 +21,7 @@ from __future__ import absolute_import
from __future__ import print_function
import argparse
import random
-from math import ceil,log,floor
+from math import ceil, log, floor
def bsc(n):
@@ -57,7 +57,7 @@ def simulate(k, n, verbose):
arc = 1
while arc <= largest_arc:
if verbose:
- prin( "-- subround --")
+ print("-- subround --")
new_info = [x for x in info]
for peer_physical in xrange(n):
peer_logical = peers[peer_physical]
@@ -71,7 +71,7 @@ def simulate(k, n, verbose):
if peer_logical & arc == 0:
# we are outgoing
if verbose:
- print peer_physical, "connects to", partner_physical
+ print(peer_physical, "connects to", partner_physical)
peer_type = "outgoing"
if peer_logical < num_ghosts:
# we have a ghost, check if the peer who connects
@@ -86,7 +86,7 @@ def simulate(k, n, verbose):
if verbose > 1:
print("type of", str(peer_physical) + ":", peer_type)
info = new_info
- arc = arc << 1;
+ arc = arc << 1
rounds = rounds + 1
random.shuffle(peers)
return rounds
@@ -100,7 +100,7 @@ if __name__ == "__main__":
parser.add_argument('--verbose', '-v', action='count')
args = parser.parse_args()
- sum = 0.0;
- for n in xrange (0, args.r):
+ sum = 0.0
+ for n in xrange(0, args.r):
sum += simulate(args.k, args.n, args.verbose)
print(sum / args.r)