31
31
p2p_port ,
32
32
rpc_url ,
33
33
set_node_times ,
34
+ start_node ,
34
35
start_nodes ,
35
36
stop_node ,
36
37
stop_nodes ,
@@ -64,9 +65,18 @@ def setup_chain(self):
64
65
else :
65
66
self ._initialize_chain (self .options .tmpdir , self .num_nodes , self .options .cachedir )
66
67
68
+ def start_node (self , i , dirname , extra_args = None , rpchost = None , timewait = None , binary = None , stderr = None ):
69
+ return start_node (i , dirname , extra_args , rpchost , timewait , binary , stderr )
70
+
71
+ def start_nodes (self , num_nodes , dirname , extra_args = None , rpchost = None , timewait = None , binary = None ):
72
+ return start_nodes (num_nodes , dirname , extra_args , rpchost , timewait , binary )
73
+
67
74
def stop_node (self , num_node ):
68
75
stop_node (self .nodes [num_node ], num_node )
69
76
77
+ def stop_nodes (self ):
78
+ stop_nodes (self .nodes )
79
+
70
80
def setup_nodes (self ):
71
81
extra_args = None
72
82
if hasattr (self , "extra_args" ):
@@ -165,7 +175,7 @@ def main(self):
165
175
166
176
if not self .options .noshutdown :
167
177
self .log .info ("Stopping nodes" )
168
- stop_nodes ( self .nodes )
178
+ self .stop_nodes ( )
169
179
else :
170
180
self .log .info ("Note: bitcoinds were not stopped and may still be running" )
171
181
@@ -259,10 +269,10 @@ def _initialize_chain(self, test_dir, num_nodes, cachedir):
259
269
wait_for_bitcoind_start (bitcoind_processes [i ], rpc_url (i ), i )
260
270
self .log .debug ("initialize_chain: RPC successfully started" )
261
271
262
- rpcs = []
272
+ self . nodes = []
263
273
for i in range (MAX_NODES ):
264
274
try :
265
- rpcs .append (get_rpc_proxy (rpc_url (i ), i ))
275
+ self . nodes .append (get_rpc_proxy (rpc_url (i ), i ))
266
276
except :
267
277
self .log .exception ("Error connecting to node %d" % i )
268
278
sys .exit (1 )
@@ -279,14 +289,15 @@ def _initialize_chain(self, test_dir, num_nodes, cachedir):
279
289
for i in range (2 ):
280
290
for peer in range (4 ):
281
291
for j in range (25 ):
282
- set_node_times (rpcs , block_time )
283
- rpcs [peer ].generate (1 )
292
+ set_node_times (self . nodes , block_time )
293
+ self . nodes [peer ].generate (1 )
284
294
block_time += 10 * 60
285
295
# Must sync before next peer starts generating blocks
286
- sync_blocks (rpcs )
296
+ sync_blocks (self . nodes )
287
297
288
298
# Shut them down, and clean up cache directories:
289
- stop_nodes (rpcs )
299
+ self .stop_nodes ()
300
+ self .nodes = []
290
301
disable_mocktime ()
291
302
for i in range (MAX_NODES ):
292
303
os .remove (log_filename (cachedir , i , "debug.log" ))
@@ -330,7 +341,7 @@ def add_options(self, parser):
330
341
help = "bitcoind binary to use for reference nodes (if any)" )
331
342
332
343
def setup_network (self ):
333
- self .nodes = start_nodes (
344
+ self .nodes = self . start_nodes (
334
345
self .num_nodes , self .options .tmpdir ,
335
346
extra_args = [['-whitelist=127.0.0.1' ]] * self .num_nodes ,
336
347
binary = [self .options .testbinary ] +
0 commit comments