MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / stop_node

Method stop_node

test/functional/test_framework/test_node.py:464–482  ·  view source on GitHub ↗

Stop the node.

(self, expected_stderr='', *, wait=0, wait_until_stopped=True)

Source from the content-addressed store, hash-verified

462 return self.version is None or self.version >= ver
463
464 def stop_node(self, expected_stderr='', *, wait=0, wait_until_stopped=True):
465 """Stop the node."""
466 if not self.running:
467 return
468 assert self.rpc_connected, self._node_msg(
469 "Should only call stop_node() on a running node after wait_for_rpc_connection() succeeded. "
470 f"Did you forget to call the latter after start()? Not connected to process: {self.process.pid}")
471 self.log.debug("Stopping node")
472 # Do not use wait argument when testing older nodes, e.g. in wallet_backwards_compatibility.py
473 if self.version_is_at_least(180000):
474 self.stop(wait=wait)
475 else:
476 self.stop()
477
478 del self.p2ps[:]
479
480 assert (not expected_stderr) or wait_until_stopped # Must wait to check stderr
481 if wait_until_stopped:
482 self.wait_until_stopped(expected_stderr=expected_stderr)
483
484 def is_node_stopped(self, *, expected_stderr="", expected_ret_code=0):
485 """Checks whether the node has stopped.

Calls 4

_node_msgMethod · 0.95
version_is_at_leastMethod · 0.95
wait_until_stoppedMethod · 0.95
stopMethod · 0.45

Tested by

no test coverage detected