Use correct rpc user/pass; this only works the second time its run, some kind of timing/caching issue
This commit is contained in:
@@ -25,10 +25,10 @@ class CryptoConditionsTest (BitcoinTestFramework):
|
|||||||
self.privkey = "UqMgxk7ySPNQ4r9nKAFPjkXy6r5t898yhuNCjSZJLg3RAM4WW1m9"
|
self.privkey = "UqMgxk7ySPNQ4r9nKAFPjkXy6r5t898yhuNCjSZJLg3RAM4WW1m9"
|
||||||
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir,
|
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir,
|
||||||
extra_args=[[
|
extra_args=[[
|
||||||
'-regtest',
|
'-conf='+self.options.tmpdir+'/node0/REGTEST.conf',
|
||||||
# TODO: AC.conf instead of komodo.conf
|
# TODO: AC.conf instead of komodo.conf
|
||||||
#'-conf='+self.options.tmpdir+'/node0/komodo.conf',
|
#'-conf='+self.options.tmpdir+'/node0/komodo.conf',
|
||||||
'-conf='+self.options.tmpdir+'/node0/REGTEST.conf',
|
'-regtest',
|
||||||
'-port=64367',
|
'-port=64367',
|
||||||
'-rpcport=64368',
|
'-rpcport=64368',
|
||||||
'-ac_name=REGTEST',
|
'-ac_name=REGTEST',
|
||||||
@@ -38,8 +38,12 @@ class CryptoConditionsTest (BitcoinTestFramework):
|
|||||||
'-ac_reward=10000000',
|
'-ac_reward=10000000',
|
||||||
'-pubkey=02676d00110c2cd14ae24f95969e8598f7ccfaa675498b82654a5b5bd57fc1d8cf',
|
'-pubkey=02676d00110c2cd14ae24f95969e8598f7ccfaa675498b82654a5b5bd57fc1d8cf',
|
||||||
'-ac_cc=1',
|
'-ac_cc=1',
|
||||||
|
'-whitelist=127.0.0.1',
|
||||||
|
'-debug',
|
||||||
'-daemon',
|
'-daemon',
|
||||||
]] * self.num_nodes
|
'-rpcuser=rt',
|
||||||
|
'-rpcpassword=rt'
|
||||||
|
]]
|
||||||
)
|
)
|
||||||
self.is_network_split = split
|
self.is_network_split = split
|
||||||
self.sync_all()
|
self.sync_all()
|
||||||
@@ -51,8 +55,8 @@ class CryptoConditionsTest (BitcoinTestFramework):
|
|||||||
rpc.generate(4)
|
rpc.generate(4)
|
||||||
self.sync_all()
|
self.sync_all()
|
||||||
# this corresponds to -pubkey above
|
# this corresponds to -pubkey above
|
||||||
print("Importking pubkey")
|
print("Importing privkey")
|
||||||
rpc.importprivkey(privkey)
|
rpc.importprivkey(self.privkey)
|
||||||
validate = rpc.validateaddress(self.pubkey)
|
validate = rpc.validateaddress(self.pubkey)
|
||||||
|
|
||||||
# Begin actual CC tests
|
# Begin actual CC tests
|
||||||
|
|||||||
@@ -76,6 +76,8 @@ def initialize_datadir(dirname, n):
|
|||||||
datadir = os.path.join(dirname, "node"+str(n))
|
datadir = os.path.join(dirname, "node"+str(n))
|
||||||
if not os.path.isdir(datadir):
|
if not os.path.isdir(datadir):
|
||||||
os.makedirs(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"))
|
print("Writing to " + os.path.join(datadir,"komodo.conf"))
|
||||||
with open(os.path.join(datadir, "komodo.conf"), 'w') as f:
|
with open(os.path.join(datadir, "komodo.conf"), 'w') as f:
|
||||||
f.write("regtest=1\n");
|
f.write("regtest=1\n");
|
||||||
@@ -102,6 +104,7 @@ def initialize_chain(test_dir):
|
|||||||
komodod and komodo-cli must be in search path.
|
komodod and komodo-cli must be in search path.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
print("initialize_chain")
|
||||||
if not os.path.isdir(os.path.join("cache", "node0")):
|
if not os.path.isdir(os.path.join("cache", "node0")):
|
||||||
devnull = open("/dev/null", "w+")
|
devnull = open("/dev/null", "w+")
|
||||||
# Create cache directories, run komodods:
|
# 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")
|
binary = os.getenv("BITCOIND", "komodod")
|
||||||
args = [ binary, "-datadir="+datadir, "-keypool=1", "-discover=0", "-rest" ]
|
args = [ binary, "-datadir="+datadir, "-keypool=1", "-discover=0", "-rest" ]
|
||||||
if extra_args is not None: args.extend(extra_args)
|
if extra_args is not None: args.extend(extra_args)
|
||||||
|
print("args=" + ' '.join(args))
|
||||||
bitcoind_processes[i] = subprocess.Popen(args)
|
bitcoind_processes[i] = subprocess.Popen(args)
|
||||||
devnull = open("/dev/null", "w+")
|
devnull = open("/dev/null", "w+")
|
||||||
|
|
||||||
cmd = os.getenv("BITCOINCLI", "komodo-cli")
|
cmd = os.getenv("BITCOINCLI", "komodo-cli")
|
||||||
print("cmd=" + cmd)
|
print("cmd=" + cmd)
|
||||||
#TODO:
|
#TODO: this will only work on the regtest AC, and probably breaks non-CC tests
|
||||||
cmd_args = " -datadir="+datadir + " -rpcport=64368 -rpcwait -conf=" +datadir+"/komodo.conf getblockcount "
|
cmd_args = " -datadir="+datadir + " -rpcwait -conf=" +datadir+"/REGTEST.conf getblockcount "
|
||||||
if os.getenv("PYTHON_DEBUG", ""):
|
if os.getenv("PYTHON_DEBUG", ""):
|
||||||
print "start_node: komodod started, calling : " + cmd + " " + cmd_args
|
print "start_node: komodod started, calling : " + cmd + " " + cmd_args
|
||||||
strcmd = 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", ""):
|
if os.getenv("PYTHON_DEBUG", ""):
|
||||||
print "start_node: calling komodo-cli -rpcwait getblockcount returned"
|
print "start_node: calling komodo-cli -rpcwait getblockcount returned"
|
||||||
devnull.close()
|
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:
|
if timewait is not None:
|
||||||
proxy = AuthServiceProxy(url, timeout=timewait)
|
proxy = AuthServiceProxy(url, timeout=timewait)
|
||||||
else:
|
else:
|
||||||
proxy = AuthServiceProxy(url)
|
proxy = AuthServiceProxy(url)
|
||||||
|
print("created proxy")
|
||||||
proxy.url = url # store URL on proxy for info
|
proxy.url = url # store URL on proxy for info
|
||||||
return proxy
|
return proxy
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user