From 3528faa71183c1002031e26cc4037f8ebbab071d Mon Sep 17 00:00:00 2001 From: "Jonathan \"Duke\" Leto" Date: Tue, 7 Aug 2018 20:51:12 +0200 Subject: [PATCH] Use correct rpc user/pass; this only works the second time its run, some kind of timing/caching issue --- qa/rpc-tests/cryptoconditions.py | 14 +++++++++----- qa/rpc-tests/test_framework/util.py | 13 ++++++++++--- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/qa/rpc-tests/cryptoconditions.py b/qa/rpc-tests/cryptoconditions.py index c9778fd3e..7dc8c2d07 100755 --- a/qa/rpc-tests/cryptoconditions.py +++ b/qa/rpc-tests/cryptoconditions.py @@ -25,10 +25,10 @@ class CryptoConditionsTest (BitcoinTestFramework): self.privkey = "UqMgxk7ySPNQ4r9nKAFPjkXy6r5t898yhuNCjSZJLg3RAM4WW1m9" self.nodes = start_nodes(self.num_nodes, self.options.tmpdir, extra_args=[[ - '-regtest', + '-conf='+self.options.tmpdir+'/node0/REGTEST.conf', # TODO: AC.conf instead of komodo.conf #'-conf='+self.options.tmpdir+'/node0/komodo.conf', - '-conf='+self.options.tmpdir+'/node0/REGTEST.conf', + '-regtest', '-port=64367', '-rpcport=64368', '-ac_name=REGTEST', @@ -38,8 +38,12 @@ class CryptoConditionsTest (BitcoinTestFramework): '-ac_reward=10000000', '-pubkey=02676d00110c2cd14ae24f95969e8598f7ccfaa675498b82654a5b5bd57fc1d8cf', '-ac_cc=1', + '-whitelist=127.0.0.1', + '-debug', '-daemon', - ]] * self.num_nodes + '-rpcuser=rt', + '-rpcpassword=rt' + ]] ) self.is_network_split = split self.sync_all() @@ -51,8 +55,8 @@ class CryptoConditionsTest (BitcoinTestFramework): rpc.generate(4) self.sync_all() # this corresponds to -pubkey above - print("Importking pubkey") - rpc.importprivkey(privkey) + print("Importing privkey") + rpc.importprivkey(self.privkey) validate = rpc.validateaddress(self.pubkey) # Begin actual CC tests diff --git a/qa/rpc-tests/test_framework/util.py b/qa/rpc-tests/test_framework/util.py index 16f9e813f..81a9b4633 100644 --- a/qa/rpc-tests/test_framework/util.py +++ b/qa/rpc-tests/test_framework/util.py @@ -76,6 +76,8 @@ def initialize_datadir(dirname, n): datadir = os.path.join(dirname, "node"+str(n)) if not os.path.isdir(datadir): os.makedirs(datadir) + # kmd AC's don't use this, they use the conf auto-created when the AC is created + # plus CLI arguments. This is for komodod tests 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"); @@ -102,6 +104,7 @@ def initialize_chain(test_dir): komodod and komodo-cli must be in search path. """ + print("initialize_chain") if not os.path.isdir(os.path.join("cache", "node0")): devnull = open("/dev/null", "w+") # Create cache directories, run komodods: @@ -199,13 +202,14 @@ def start_node(i, dirname, extra_args=None, rpchost=None, timewait=None, binary= binary = os.getenv("BITCOIND", "komodod") args = [ binary, "-datadir="+datadir, "-keypool=1", "-discover=0", "-rest" ] if extra_args is not None: args.extend(extra_args) + print("args=" + ' '.join(args)) bitcoind_processes[i] = subprocess.Popen(args) devnull = open("/dev/null", "w+") cmd = os.getenv("BITCOINCLI", "komodo-cli") print("cmd=" + cmd) - #TODO: - cmd_args = " -datadir="+datadir + " -rpcport=64368 -rpcwait -conf=" +datadir+"/komodo.conf getblockcount " + #TODO: this will only work on the regtest AC, and probably breaks non-CC tests + cmd_args = " -datadir="+datadir + " -rpcwait -conf=" +datadir+"/REGTEST.conf getblockcount " if os.getenv("PYTHON_DEBUG", ""): print "start_node: komodod started, calling : " + cmd + " " + cmd_args strcmd = cmd + " " + cmd_args @@ -218,11 +222,14 @@ def start_node(i, dirname, extra_args=None, rpchost=None, timewait=None, binary= if os.getenv("PYTHON_DEBUG", ""): print "start_node: calling komodo-cli -rpcwait getblockcount returned" devnull.close() - url = "http://rt:rt@%s:%d" % (rpchost or '127.0.0.1', rpc_port(i)) + #url = "http://rt:rt@%s:%d" % (rpchost or '127.0.0.1', rpc_port(i)) + url = "http://rt:rt@%s:%d" % (rpchost or '127.0.0.1', 64368) + print("connecting to " + url) if timewait is not None: proxy = AuthServiceProxy(url, timeout=timewait) else: proxy = AuthServiceProxy(url) + print("created proxy") proxy.url = url # store URL on proxy for info return proxy