aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNils Gillmann <ng0@n0.is>2018-05-19 17:21:42 +0000
committerNils Gillmann <ng0@n0.is>2018-05-19 17:21:42 +0000
commit26d49c72e190013e99fdec3bd8f065e522b582ae (patch)
tree67f62ff71e3cbc38f9ccb2359a9e114942d84d71
parentf3890127696c24740fc94056b93d9918e0cbc006 (diff)
downloadgnunet-26d49c72e190013e99fdec3bd8f065e522b582ae.tar.gz
gnunet-26d49c72e190013e99fdec3bd8f065e522b582ae.zip
src/consensus/consensus-simulation: Use past.builtins for xrange
Signed-off-by: Nils Gillmann <ng0@n0.is>
-rw-r--r--README4
-rw-r--r--src/consensus/consensus-simulation.py.in3
2 files changed, 5 insertions, 2 deletions
diff --git a/README b/README
index f52fca444..80a87d274 100644
--- a/README
+++ b/README
@@ -264,8 +264,8 @@ $ make
264$ make install 264$ make install
265$ make check 265$ make check
266 266
267Some of the testcases require python >= 2.6 and pexpect to be 267Some of the testcases require python >= 2.6 (+ the python module "futures")
268installed. If any testcases fail to pass on your system, run 268and pexpect to be installed. If any testcases fail to pass on your system, run
269"contrib/scripts/report.sh" (in the repository) or "gnunet-bugreport" 269"contrib/scripts/report.sh" (in the repository) or "gnunet-bugreport"
270when you already have GNUnet installed and report the output together with 270when you already have GNUnet installed and report the output together with
271information about the failing testcase to the Mantis bugtracking 271information about the failing testcase to the Mantis bugtracking
diff --git a/src/consensus/consensus-simulation.py.in b/src/consensus/consensus-simulation.py.in
index 12bef871d..6629ffaa8 100644
--- a/src/consensus/consensus-simulation.py.in
+++ b/src/consensus/consensus-simulation.py.in
@@ -22,6 +22,7 @@ from __future__ import print_function
22import argparse 22import argparse
23import random 23import random
24from math import ceil, log, floor 24from math import ceil, log, floor
25from past.builtins import xrange
25 26
26 27
27def bsc(n): 28def bsc(n):
@@ -44,6 +45,8 @@ def simulate(k, n, verbose):
44 print("we have", num_ghosts, "ghost peers") 45 print("we have", num_ghosts, "ghost peers")
45 # n.b. all peers with idx<k are evil 46 # n.b. all peers with idx<k are evil
46 peers = range(n) 47 peers = range(n)
48 # py2-3 compatible, backwards.
49 # refer to http://python-future.org/compatible_idioms.html#xrange
47 info = [1 << x for x in xrange(n)] 50 info = [1 << x for x in xrange(n)]
48 51
49 def done_p(): 52 def done_p():