@@ -127,7 +127,7 @@ def quickstart():
127
127
inquirer .List (
128
128
"connections" ,
129
129
message = click .style (
130
- "How many addnode connections would you like each node to have?" ,
130
+ "How many connections would you like each node to have?" ,
131
131
fg = "blue" ,
132
132
bold = True ,
133
133
),
@@ -137,7 +137,7 @@ def quickstart():
137
137
inquirer .List (
138
138
"version" ,
139
139
message = click .style (
140
- "Which version would you like nodes to be by default?" , fg = "blue" , bold = True
140
+ "Which version would you like nodes to run by default?" , fg = "blue" , bold = True
141
141
),
142
142
choices = SUPPORTED_TAGS ,
143
143
default = DEFAULT_TAG ,
@@ -360,13 +360,15 @@ def custom_graph(num_nodes: int, num_connections: int, version: str, datadir: Pa
360
360
datadir .mkdir (parents = False , exist_ok = False )
361
361
# Generate network.yaml
362
362
nodes = []
363
+ connections = set ()
363
364
364
365
for i in range (num_nodes ):
365
366
node = {"name" : f"tank-{ i :04d} " , "connect" : [], "image" : {"tag" : version }}
366
367
367
368
# Add round-robin connection
368
369
next_node = (i + 1 ) % num_nodes
369
370
node ["connect" ].append (f"tank-{ next_node :04d} " )
371
+ connections .add ((i , next_node ))
370
372
371
373
# Add random connections
372
374
available_nodes = list (range (num_nodes ))
@@ -376,8 +378,11 @@ def custom_graph(num_nodes: int, num_connections: int, version: str, datadir: Pa
376
378
377
379
for _ in range (min (num_connections - 1 , len (available_nodes ))):
378
380
random_node = random .choice (available_nodes )
379
- node ["connect" ].append (f"tank-{ random_node :04d} " )
380
- available_nodes .remove (random_node )
381
+ # Avoid circular loops of A -> B -> A
382
+ if (random_node , i ) not in connections :
383
+ node ["connect" ].append (f"tank-{ random_node :04d} " )
384
+ connections .add ((i , random_node ))
385
+ available_nodes .remove (random_node )
381
386
382
387
nodes .append (node )
383
388
0 commit comments