diff options
Diffstat (limited to 'src/consensus/consensus-simulation.py.in')
-rw-r--r-- | src/consensus/consensus-simulation.py.in | 15 |
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): | |||
46 | 46 | ||
47 | def done_p(): | 47 | def done_p(): |
48 | for x in range(k, n): | 48 | for x in range(k, n): |
49 | if bsc(info[x]) < n-k: | 49 | if bsc(info[x]) < n - k: |
50 | return False | 50 | return False |
51 | return True | 51 | return True |
52 | |||
52 | rounds = 0 | 53 | rounds = 0 |
53 | while not done_p(): | 54 | while not done_p(): |
54 | if verbose: | 55 | if verbose: |
@@ -65,7 +66,10 @@ def simulate(k, n, verbose): | |||
65 | partner_physical = peers.index(partner_logical) | 66 | partner_physical = peers.index(partner_logical) |
66 | if peer_physical < k or partner_physical < k: | 67 | if peer_physical < k or partner_physical < k: |
67 | if verbose: | 68 | if verbose: |
68 | print("bad peer in connection", peer_physical, "--", partner_physical) | 69 | print( |
70 | "bad peer in connection", peer_physical, "--", | ||
71 | partner_physical | ||
72 | ) | ||
69 | continue | 73 | continue |
70 | if peer_logical & arc == 0: | 74 | if peer_logical & arc == 0: |
71 | # we are outgoing | 75 | # we are outgoing |
@@ -78,8 +82,11 @@ def simulate(k, n, verbose): | |||
78 | ghost_partner_logical = (peer_logical - arc) % n | 82 | ghost_partner_logical = (peer_logical - arc) % n |
79 | if ghost_partner_logical & arc == 0: | 83 | if ghost_partner_logical & arc == 0: |
80 | peer_type = peer_type + ", ghost incoming" | 84 | peer_type = peer_type + ", ghost incoming" |
81 | new_info[peer_physical] = new_info[peer_physical] | info[peer_physical] | info[partner_physical] | 85 | new_info[peer_physical] = new_info[peer_physical] | info[ |
82 | new_info[partner_physical] = new_info[partner_physical] | info[peer_physical] | info[partner_physical] | 86 | peer_physical] | info[partner_physical] |
87 | new_info[partner_physical | ||
88 | ] = new_info[partner_physical] | info[ | ||
89 | peer_physical] | info[partner_physical] | ||
83 | else: | 90 | else: |
84 | peer_type = "incoming" | 91 | peer_type = "incoming" |
85 | if verbose > 1: | 92 | if verbose > 1: |