summaryrefslogtreecommitdiff
path: root/src/consensus
diff options
context:
space:
mode:
authorng0 <ng0@n0.is>2019-10-12 18:16:07 +0000
committerng0 <ng0@n0.is>2019-10-12 18:16:07 +0000
commita5f5e7ed9b07b902af4438d76087e034abcba9b2 (patch)
tree6f376f93f1c785103d0b30f54311a0f61d2bdced /src/consensus
parent8e827de2a1db34dfe15f5f9da2850ca469b5ecc3 (diff)
format python
Diffstat (limited to 'src/consensus')
-rw-r--r--src/consensus/consensus-simulation.py.in15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/consensus/consensus-simulation.py.in b/src/consensus/consensus-simulation.py.in
index 39daf81c6..c6b97e63f 100644
--- a/src/consensus/consensus-simulation.py.in
+++ b/src/consensus/consensus-simulation.py.in
@@ -46,9 +46,10 @@ def simulate(k, n, verbose):
def done_p():
for x in range(k, n):
- if bsc(info[x]) < n-k:
+ if bsc(info[x]) < n - k:
return False
return True
+
rounds = 0
while not done_p():
if verbose:
@@ -65,7 +66,10 @@ def simulate(k, n, verbose):
partner_physical = peers.index(partner_logical)
if peer_physical < k or partner_physical < k:
if verbose:
- print("bad peer in connection", peer_physical, "--", partner_physical)
+ print(
+ "bad peer in connection", peer_physical, "--",
+ partner_physical
+ )
continue
if peer_logical & arc == 0:
# we are outgoing
@@ -78,8 +82,11 @@ def simulate(k, n, verbose):
ghost_partner_logical = (peer_logical - arc) % n
if ghost_partner_logical & arc == 0:
peer_type = peer_type + ", ghost incoming"
- new_info[peer_physical] = new_info[peer_physical] | info[peer_physical] | info[partner_physical]
- new_info[partner_physical] = new_info[partner_physical] | info[peer_physical] | info[partner_physical]
+ new_info[peer_physical] = new_info[peer_physical] | info[
+ peer_physical] | info[partner_physical]
+ new_info[partner_physical
+ ] = new_info[partner_physical] | info[
+ peer_physical] | info[partner_physical]
else:
peer_type = "incoming"
if verbose > 1: