|
|
|
@ -375,28 +375,19 @@ def stop_node(node, i):
@@ -375,28 +375,19 @@ def stop_node(node, i):
|
|
|
|
|
node.stop() |
|
|
|
|
except http.client.CannotSendRequest as e: |
|
|
|
|
print("WARN: Unable to stop node: " + repr(e)) |
|
|
|
|
bitcoind_processes[i].wait(timeout=BITCOIND_PROC_WAIT_TIMEOUT) |
|
|
|
|
return_code = bitcoind_processes[i].wait(timeout=BITCOIND_PROC_WAIT_TIMEOUT) |
|
|
|
|
assert_equal(return_code, 0) |
|
|
|
|
del bitcoind_processes[i] |
|
|
|
|
|
|
|
|
|
def stop_nodes(nodes): |
|
|
|
|
for node in nodes: |
|
|
|
|
try: |
|
|
|
|
node.stop() |
|
|
|
|
except http.client.CannotSendRequest as e: |
|
|
|
|
print("WARN: Unable to stop node: " + repr(e)) |
|
|
|
|
del nodes[:] # Emptying array closes connections as a side effect |
|
|
|
|
wait_bitcoinds() |
|
|
|
|
for i, node in enumerate(nodes): |
|
|
|
|
stop_node(node, i) |
|
|
|
|
assert not bitcoind_processes.values() # All connections must be gone now |
|
|
|
|
|
|
|
|
|
def set_node_times(nodes, t): |
|
|
|
|
for node in nodes: |
|
|
|
|
node.setmocktime(t) |
|
|
|
|
|
|
|
|
|
def wait_bitcoinds(): |
|
|
|
|
# Wait for all bitcoinds to cleanly exit |
|
|
|
|
for bitcoind in bitcoind_processes.values(): |
|
|
|
|
bitcoind.wait(timeout=BITCOIND_PROC_WAIT_TIMEOUT) |
|
|
|
|
bitcoind_processes.clear() |
|
|
|
|
|
|
|
|
|
def connect_nodes(from_connection, node_num): |
|
|
|
|
ip_port = "127.0.0.1:"+str(p2p_port(node_num)) |
|
|
|
|
from_connection.addnode(ip_port, "onetry") |
|
|
|
|