|
|
@ -89,7 +89,7 @@ def initialize_chain(test_dir): |
|
|
|
""" |
|
|
|
Create (or copy from cache) a 200-block-long chain and |
|
|
|
4 wallets. |
|
|
|
bitcoind and bitcoin-cli must be in search path. |
|
|
|
hushd and hush-cli must be in search path. |
|
|
|
""" |
|
|
|
|
|
|
|
if not os.path.isdir(os.path.join("cache", "node0")): |
|
|
@ -97,16 +97,16 @@ def initialize_chain(test_dir): |
|
|
|
# Create cache directories, run bitcoinds: |
|
|
|
for i in range(4): |
|
|
|
datadir=initialize_datadir("cache", i) |
|
|
|
args = [ os.getenv("BITCOIND", "bitcoind"), "-keypool=1", "-datadir="+datadir, "-discover=0" ] |
|
|
|
args = [ os.getenv("BITCOIND", "hushd"), "-keypool=1", "-datadir="+datadir, "-discover=0" ] |
|
|
|
if i > 0: |
|
|
|
args.append("-connect=127.0.0.1:"+str(p2p_port(0))) |
|
|
|
bitcoind_processes[i] = subprocess.Popen(args) |
|
|
|
if os.getenv("PYTHON_DEBUG", ""): |
|
|
|
print "initialize_chain: bitcoind started, calling bitcoin-cli -rpcwait getblockcount" |
|
|
|
subprocess.check_call([ os.getenv("BITCOINCLI", "bitcoin-cli"), "-datadir="+datadir, |
|
|
|
print "initialize_chain: hushd started, calling hush-cli -rpcwait getblockcount" |
|
|
|
subprocess.check_call([ os.getenv("BITCOINCLI", "hush-cli"), "-datadir="+datadir, |
|
|
|
"-rpcwait", "getblockcount"], stdout=devnull) |
|
|
|
if os.getenv("PYTHON_DEBUG", ""): |
|
|
|
print "initialize_chain: bitcoin-cli -rpcwait getblockcount completed" |
|
|
|
print "initialize_chain: hush-cli -rpcwait getblockcount completed" |
|
|
|
devnull.close() |
|
|
|
rpcs = [] |
|
|
|
for i in range(4): |
|
|
@ -177,7 +177,7 @@ def _rpchost_to_args(rpchost): |
|
|
|
|
|
|
|
def start_node(i, dirname, extra_args=None, rpchost=None, timewait=None, binary=None): |
|
|
|
""" |
|
|
|
Start a bitcoind and return RPC connection to it |
|
|
|
Start a hushd and return RPC connection to it |
|
|
|
""" |
|
|
|
datadir = os.path.join(dirname, "node"+str(i)) |
|
|
|
if binary is None: |
|
|
@ -187,12 +187,12 @@ def start_node(i, dirname, extra_args=None, rpchost=None, timewait=None, binary= |
|
|
|
bitcoind_processes[i] = subprocess.Popen(args) |
|
|
|
devnull = open("/dev/null", "w+") |
|
|
|
if os.getenv("PYTHON_DEBUG", ""): |
|
|
|
print "start_node: bitcoind started, calling bitcoin-cli -rpcwait getblockcount" |
|
|
|
subprocess.check_call([ os.getenv("BITCOINCLI", "bitcoin-cli"), "-datadir="+datadir] + |
|
|
|
print "start_node: hushd started, calling hush-cli -rpcwait getblockcount" |
|
|
|
subprocess.check_call([ os.getenv("BITCOINCLI", "hush-cli"), "-datadir="+datadir] + |
|
|
|
_rpchost_to_args(rpchost) + |
|
|
|
["-rpcwait", "getblockcount"], stdout=devnull) |
|
|
|
if os.getenv("PYTHON_DEBUG", ""): |
|
|
|
print "start_node: calling bitcoin-cli -rpcwait getblockcount returned" |
|
|
|
print "start_node: calling hush-cli -rpcwait getblockcount returned" |
|
|
|
devnull.close() |
|
|
|
url = "http://rt:rt@%s:%d" % (rpchost or '127.0.0.1', rpc_port(i)) |
|
|
|
if timewait is not None: |
|
|
|