From cf521c41f72c380cc8fc50cbd0d8836e9ebe3252 Mon Sep 17 00:00:00 2001 From: ng0 Date: Tue, 12 Feb 2019 11:06:05 +0000 Subject: [PATCH 1/1] util: futurize consensus/consensus-simulation Signed-off-by: ng0 --- src/consensus/consensus-simulation.py.in | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/consensus/consensus-simulation.py.in b/src/consensus/consensus-simulation.py.in index 38e29230a..161015d00 100644 --- a/src/consensus/consensus-simulation.py.in +++ b/src/consensus/consensus-simulation.py.in @@ -19,6 +19,10 @@ from __future__ import absolute_import from __future__ import print_function +from __future__ import division +from builtins import str +from builtins import range +from past.utils import old_div import argparse import random from math import ceil, log, floor @@ -39,18 +43,18 @@ def bsc(n): def simulate(k, n, verbose): assert k < n - largest_arc = int(2**ceil(log(n, 2))) / 2 + largest_arc = old_div(int(2**ceil(log(n, 2))), 2) num_ghosts = (2 * largest_arc) - n if verbose: print("we have", num_ghosts, "ghost peers") # n.b. all peers with idx