Allow to pass redirect_stderr=True to initialize_chain and use in wallet-dump.py
Same as with start_node
This commit is contained in:
parent
d56ac5a747
commit
625252fb49
@ -240,7 +240,7 @@ def wait_for_bitcoind_start(process, url, i):
|
|||||||
raise # unknown JSON RPC exception
|
raise # unknown JSON RPC exception
|
||||||
time.sleep(0.25)
|
time.sleep(0.25)
|
||||||
|
|
||||||
def initialize_chain(test_dir, num_nodes, cachedir, extra_args=None):
|
def initialize_chain(test_dir, num_nodes, cachedir, extra_args=None, redirect_stderr=False):
|
||||||
"""
|
"""
|
||||||
Create a cache of a 200-block-long chain (with wallet) for MAX_NODES
|
Create a cache of a 200-block-long chain (with wallet) for MAX_NODES
|
||||||
Afterward, create num_nodes copies from the cache
|
Afterward, create num_nodes copies from the cache
|
||||||
@ -268,7 +268,10 @@ def initialize_chain(test_dir, num_nodes, cachedir, extra_args=None):
|
|||||||
args.append("-connect=127.0.0.1:"+str(p2p_port(0)))
|
args.append("-connect=127.0.0.1:"+str(p2p_port(0)))
|
||||||
if extra_args is not None:
|
if extra_args is not None:
|
||||||
args += extra_args
|
args += extra_args
|
||||||
bitcoind_processes[i] = subprocess.Popen(args)
|
stderr = None
|
||||||
|
if redirect_stderr:
|
||||||
|
stderr = sys.stdout
|
||||||
|
bitcoind_processes[i] = subprocess.Popen(args, stderr=stderr)
|
||||||
if os.getenv("PYTHON_DEBUG", ""):
|
if os.getenv("PYTHON_DEBUG", ""):
|
||||||
print("initialize_chain: dashd started, waiting for RPC to come up")
|
print("initialize_chain: dashd started, waiting for RPC to come up")
|
||||||
wait_for_bitcoind_start(bitcoind_processes[i], rpc_url(i), i)
|
wait_for_bitcoind_start(bitcoind_processes[i], rpc_url(i), i)
|
||||||
|
@ -57,14 +57,13 @@ class WalletDumpTest(BitcoinTestFramework):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.setup_clean_chain = False
|
self.setup_clean_chain = False
|
||||||
self.redirect_stderr = True
|
|
||||||
self.num_nodes = 1
|
self.num_nodes = 1
|
||||||
self.extra_args = [["-keypool=90", "-usehd=1"]]
|
self.extra_args = [["-keypool=90", "-usehd=1"]]
|
||||||
|
|
||||||
def setup_chain(self):
|
def setup_chain(self):
|
||||||
# TODO remove this when usehd=1 becomes the default
|
# TODO remove this when usehd=1 becomes the default
|
||||||
# use our own cache and -usehd=1 as extra arg as the default cache is run with -usehd=0
|
# use our own cache and -usehd=1 as extra arg as the default cache is run with -usehd=0
|
||||||
initialize_chain(self.options.tmpdir, self.num_nodes, self.options.cachedir + "/hd", ["-usehd=1"])
|
initialize_chain(self.options.tmpdir, self.num_nodes, self.options.cachedir + "/hd", ["-usehd=1"], redirect_stderr=True)
|
||||||
|
|
||||||
def setup_network(self, split=False):
|
def setup_network(self, split=False):
|
||||||
# Use 1 minute timeout because the initial getnewaddress RPC can take
|
# Use 1 minute timeout because the initial getnewaddress RPC can take
|
||||||
|
Loading…
Reference in New Issue
Block a user