Fix various test suite bugs and create CC AC in our tests
This commit is contained in:
@@ -16,23 +16,38 @@ class CryptoConditionsTest (BitcoinTestFramework):
|
|||||||
|
|
||||||
def setup_chain(self):
|
def setup_chain(self):
|
||||||
print("Initializing CC test directory "+self.options.tmpdir)
|
print("Initializing CC test directory "+self.options.tmpdir)
|
||||||
initialize_chain_clean(self.options.tmpdir, 4)
|
self.num_nodes = 1
|
||||||
|
initialize_chain_clean(self.options.tmpdir, self.num_nodes)
|
||||||
|
|
||||||
def setup_nodes(self):
|
def setup_network(self, split = False):
|
||||||
return start_nodes(1, self.options.tmpdir)
|
print("Setting up network...")
|
||||||
|
self.pubkey = "RWPg8B91kfK5UtUN7z6s6TeV9cHSGtVY8D"
|
||||||
def setup_network(self, split=False):
|
self.privkey = "UqMgxk7ySPNQ4r9nKAFPjkXy6r5t898yhuNCjSZJLg3RAM4WW1m9"
|
||||||
self.nodes = start_nodes(1, self.options.tmpdir)
|
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir,
|
||||||
self.is_network_split=False
|
extra_args=[[
|
||||||
|
'-ac_name=REGTEST',
|
||||||
|
'-addressindex=1',
|
||||||
|
'-spentindex=1',
|
||||||
|
'-ac_supply=5555555',
|
||||||
|
'-ac_reward=10000000',
|
||||||
|
'-pubkey=02676d00110c2cd14ae24f95969e8598f7ccfaa675498b82654a5b5bd57fc1d8cf',
|
||||||
|
'-ac_cc=1'
|
||||||
|
]] * self.num_nodes
|
||||||
|
)
|
||||||
|
self.is_network_split = split
|
||||||
self.sync_all()
|
self.sync_all()
|
||||||
|
|
||||||
def run_test (self):
|
def run_test (self):
|
||||||
print "Mining blocks..."
|
print("Mining blocks...")
|
||||||
|
|
||||||
rpc = self.nodes[0]
|
rpc = self.nodes[0]
|
||||||
rpc.generate(4)
|
rpc.generate(4)
|
||||||
self.sync_all()
|
self.sync_all()
|
||||||
|
# this corresponds to -pubkey above
|
||||||
|
print("Importking pubkey")
|
||||||
|
rpc.importprivkey(privkey)
|
||||||
|
validate = rpc.validateaddress(self.pubkey)
|
||||||
|
|
||||||
|
# Begin actual CC tests
|
||||||
faucet = rpc.faucetaddress()
|
faucet = rpc.faucetaddress()
|
||||||
assert_equal(faucet['result'], 'success')
|
assert_equal(faucet['result'], 'success')
|
||||||
assert_equal(faucet['myaddress'][0], 'R')
|
assert_equal(faucet['myaddress'][0], 'R')
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
# Copyright (c) 2014 The Bitcoin Core developers
|
# Copyright (c) 2014 The Bitcoin Core developers
|
||||||
|
# Copyright (c) 2018 The SuperNET developers
|
||||||
# Distributed under the MIT software license, see the accompanying
|
# Distributed under the MIT software license, see the accompanying
|
||||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
@@ -78,6 +79,7 @@ def initialize_datadir(dirname, n):
|
|||||||
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");
|
||||||
f.write("txindex=1\n");
|
f.write("txindex=1\n");
|
||||||
|
f.write("server=1\n");
|
||||||
f.write("showmetrics=0\n");
|
f.write("showmetrics=0\n");
|
||||||
f.write("rpcuser=rt\n");
|
f.write("rpcuser=rt\n");
|
||||||
f.write("rpcpassword=rt\n");
|
f.write("rpcpassword=rt\n");
|
||||||
@@ -182,22 +184,22 @@ def _rpchost_to_args(rpchost):
|
|||||||
|
|
||||||
def start_node(i, dirname, extra_args=None, rpchost=None, timewait=None, binary=None):
|
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 komodod and return RPC connection to it
|
||||||
"""
|
"""
|
||||||
datadir = os.path.join(dirname, "node"+str(i))
|
datadir = os.path.join(dirname, "node"+str(i))
|
||||||
if binary is None:
|
if binary is None:
|
||||||
binary = os.getenv("BITCOIND", "bitcoind")
|
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)
|
||||||
bitcoind_processes[i] = subprocess.Popen(args)
|
bitcoind_processes[i] = subprocess.Popen(args)
|
||||||
devnull = open("/dev/null", "w+")
|
devnull = open("/dev/null", "w+")
|
||||||
if os.getenv("PYTHON_DEBUG", ""):
|
if os.getenv("PYTHON_DEBUG", ""):
|
||||||
print "start_node: bitcoind started, calling bitcoin-cli -rpcwait getblockcount"
|
print "start_node: komodod started, calling komodo-cli -rpcwait getblockcount"
|
||||||
subprocess.check_call([ os.getenv("BITCOINCLI", "bitcoin-cli"), "-datadir="+datadir] +
|
subprocess.check_call([ os.getenv("BITCOINCLI", "komodo-cli"), "-datadir="+datadir] +
|
||||||
_rpchost_to_args(rpchost) +
|
_rpchost_to_args(rpchost) +
|
||||||
["-rpcwait", "getblockcount"], stdout=devnull)
|
["-rpcwait", "getblockcount"], stdout=devnull)
|
||||||
if os.getenv("PYTHON_DEBUG", ""):
|
if os.getenv("PYTHON_DEBUG", ""):
|
||||||
print "start_node: calling bitcoin-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))
|
||||||
if timewait is not None:
|
if timewait is not None:
|
||||||
@@ -209,7 +211,7 @@ def start_node(i, dirname, extra_args=None, rpchost=None, timewait=None, binary=
|
|||||||
|
|
||||||
def start_nodes(num_nodes, dirname, extra_args=None, rpchost=None, binary=None):
|
def start_nodes(num_nodes, dirname, extra_args=None, rpchost=None, binary=None):
|
||||||
"""
|
"""
|
||||||
Start multiple bitcoinds, return RPC connections to them
|
Start multiple komodods, return RPC connections to them
|
||||||
"""
|
"""
|
||||||
if extra_args is None: extra_args = [ None for i in range(num_nodes) ]
|
if extra_args is None: extra_args = [ None for i in range(num_nodes) ]
|
||||||
if binary is None: binary = [ None for i in range(num_nodes) ]
|
if binary is None: binary = [ None for i in range(num_nodes) ]
|
||||||
|
|||||||
Reference in New Issue
Block a user