Changeset View
Changeset View
Standalone View
Standalone View
test/functional/test_framework/test_framework.py
Show First 20 Lines • Show All 416 Lines • ▼ Show 20 Lines | def _initialize_chain(self): | ||||
for i in range(MAX_NODES): | for i in range(MAX_NODES): | ||||
if os.path.isdir(os.path.join(self.options.cachedir, "node" + str(i))): | if os.path.isdir(os.path.join(self.options.cachedir, "node" + str(i))): | ||||
shutil.rmtree(os.path.join( | shutil.rmtree(os.path.join( | ||||
self.options.cachedir, "node" + str(i))) | self.options.cachedir, "node" + str(i))) | ||||
# Create cache directories, run bitcoinds: | # Create cache directories, run bitcoinds: | ||||
for i in range(MAX_NODES): | for i in range(MAX_NODES): | ||||
datadir = initialize_datadir(self.options.cachedir, i) | datadir = initialize_datadir(self.options.cachedir, i) | ||||
args = [os.getenv("BITCOIND", "bitcoind"), "-server", | |||||
"-keypool=1", "-datadir=" + datadir, "-discover=0"] | |||||
if i > 0: | |||||
args.append("-connect=127.0.0.1:" + str(p2p_port(0))) | |||||
self.nodes.append(TestNode(i, self.options.cachedir, extra_args=[], host=None, rpc_port=rpc_port(i), p2p_port=p2p_port(i), | self.nodes.append(TestNode(i, self.options.cachedir, extra_args=[], host=None, rpc_port=rpc_port(i), p2p_port=p2p_port(i), | ||||
timewait=None, binary=None, stderr=None, mocktime=self.mocktime, coverage_dir=None)) | timewait=None, binary=None, stderr=None, mocktime=self.mocktime, coverage_dir=None)) | ||||
self.nodes[i].args = args | self.nodes[i].clear_default_args() | ||||
self.nodes[i].extend_default_args([ | |||||
"-server", "-keypool=1", "-datadir=" + datadir, | |||||
"-discover=0"]) | |||||
if i > 0: | |||||
self.nodes[i].extend_default_args( | |||||
["-connect=127.0.0.1:" + str(p2p_port(0))]) | |||||
self.start_node(i) | self.start_node(i) | ||||
# Wait for RPC connections to be ready | # Wait for RPC connections to be ready | ||||
for node in self.nodes: | for node in self.nodes: | ||||
node.wait_for_rpc_connection() | node.wait_for_rpc_connection() | ||||
# Create a 200-block-long chain; each of the 4 first nodes | # Create a 200-block-long chain; each of the 4 first nodes | ||||
# gets 25 mature blocks and 25 immature. | # gets 25 mature blocks and 25 immature. | ||||
▲ Show 20 Lines • Show All 77 Lines • Show Last 20 Lines |