Skip to content

Commit d562df2

Browse files
committed
prettify _connected() output
1 parent d2b4103 commit d562df2

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/warnet/network.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,16 +88,15 @@ def _connected():
8888
for tank in tanks:
8989
# Get actual
9090
peerinfo = json.loads(_rpc(tank.metadata.name, "getpeerinfo", ""))
91-
manuals = 0
91+
actual = 0
9292
for peer in peerinfo:
9393
if peer["connection_type"] == "manual":
94-
manuals += 1
94+
actual += 1
95+
expected = int(tank.metadata.annotations["init_peers"])
96+
print(f"Tank {tank.metadata.name} peers expected: {expected}, actual: {actual}")
9597
# Even if more edges are specified, bitcoind only allows
9698
# 8 manual outbound connections
97-
98-
print("manual " + str(manuals))
99-
print(tank.metadata.annotations["init_peers"])
100-
if min(8, int(tank.metadata.annotations["init_peers"])) > manuals:
99+
if min(8, expected) > actual:
101100
print("Network not connected")
102101
return False
103102
print("Network connected")

0 commit comments

Comments
 (0)