More debugging trying to make getblockcount work and not have komodod hang the test

This commit is contained in:
Jonathan "Duke" Leto
2018-08-07 09:22:40 +02:00
parent 32829f6d6f
commit 5ec4373ca4
2 changed files with 18 additions and 7 deletions

View File

@@ -7,7 +7,7 @@ from test_framework.test_framework import BitcoinTestFramework
from test_framework.authproxy import JSONRPCException
from test_framework.util import assert_equal, assert_greater_than, \
initialize_chain_clean, start_nodes, start_node, connect_nodes_bi, \
stop_nodes, sync_blocks, sync_mempools, wait_bitcoinds
stop_nodes, sync_blocks, sync_mempools, wait_bitcoinds, rpc_port
import time
from decimal import Decimal
@@ -25,6 +25,10 @@ class CryptoConditionsTest (BitcoinTestFramework):
self.privkey = "UqMgxk7ySPNQ4r9nKAFPjkXy6r5t898yhuNCjSZJLg3RAM4WW1m9"
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir,
extra_args=[[
'-regtest',
'-server=1',
'-rpcport=64368',
'-conf='+self.options.tmpdir+'/node0/REGTEST.conf',
'-ac_name=REGTEST',
'-addressindex=1',
'-spentindex=1',

View File

@@ -76,6 +76,7 @@ def initialize_datadir(dirname, n):
datadir = os.path.join(dirname, "node"+str(n))
if not os.path.isdir(datadir):
os.makedirs(datadir)
print("Writing to " + os.path.join(datadir,"komodo.conf"))
with open(os.path.join(datadir, "komodo.conf"), 'w') as f:
f.write("regtest=1\n");
f.write("txindex=1\n");
@@ -84,7 +85,9 @@ def initialize_datadir(dirname, n):
f.write("rpcuser=rt\n");
f.write("rpcpassword=rt\n");
f.write("port="+str(p2p_port(n))+"\n");
f.write("rpcport="+str(rpc_port(n))+"\n");
rpcport = str(rpc_port(n))
f.write("rpcport="+rpcport+"\n");
print "RPC port=" + rpcport
f.write("listenonion=0\n");
# TODO: maybe make these optional, defaulted to on for now
f.write("addressindex=1\n");
@@ -108,10 +111,12 @@ def initialize_chain(test_dir):
if i > 0:
args.append("-connect=127.0.0.1:"+str(p2p_port(0)))
bitcoind_processes[i] = subprocess.Popen(args)
cmd = os.getenv("BITCOINCLI", "komodo-cli")
cmd_args = cmd + " -datadir="+datadir + " -rpcwait getblockcount"
if os.getenv("PYTHON_DEBUG", ""):
print "initialize_chain: komodod started, calling komodo-cli -rpcwait getblockcount"
subprocess.check_call([ os.getenv("BITCOINCLI", "komodo-cli"), "-datadir="+datadir,
"-rpcwait", "getblockcount"], stdout=devnull)
print "initialize_chain: komodod started, calling: " + cmd_args
subprocess.check_call([ cmd, "-datadir="+datadir,
"-rpcwait", "getblockcount"]) #, stdout=devnull)
if os.getenv("PYTHON_DEBUG", ""):
print "initialize_chain: komodo-cli -rpcwait getblockcount completed"
devnull.close()
@@ -193,8 +198,10 @@ def start_node(i, dirname, extra_args=None, rpchost=None, timewait=None, binary=
if extra_args is not None: args.extend(extra_args)
bitcoind_processes[i] = subprocess.Popen(args)
devnull = open("/dev/null", "w+")
cmd = os.getenv("BITCOINCLI", "komodo-cli")
cmd_args = cmd + "-datadir="+datadir + " -rpcwait getblockcount"
if os.getenv("PYTHON_DEBUG", ""):
print "start_node: komodod started, calling komodo-cli -rpcwait getblockcount"
print "start_node: komodod started, calling : " + cmd_args
subprocess.check_call([ os.getenv("BITCOINCLI", "komodo-cli"), "-datadir="+datadir] +
_rpchost_to_args(rpchost) +
["-rpcwait", "getblockcount"], stdout=devnull)