@@ -4,7 +4,7 @@
|
|||||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
||||||
from test_framework.test_framework import BitcoinTestFramework
|
from test_framework.test_framework import CryptoconditionsTestFramework
|
||||||
from test_framework.authproxy import JSONRPCException
|
from test_framework.authproxy import JSONRPCException
|
||||||
from test_framework.util import assert_equal, assert_greater_than, \
|
from test_framework.util import assert_equal, assert_greater_than, \
|
||||||
initialize_chain_clean, initialize_chain, start_nodes, start_node, connect_nodes_bi, \
|
initialize_chain_clean, initialize_chain, start_nodes, start_node, connect_nodes_bi, \
|
||||||
@@ -12,71 +12,7 @@ from test_framework.util import assert_equal, assert_greater_than, \
|
|||||||
from cryptoconditions import assert_success, assert_error, generate_random_string
|
from cryptoconditions import assert_success, assert_error, generate_random_string
|
||||||
|
|
||||||
|
|
||||||
class CryptoconditionsChannelsTest(BitcoinTestFramework):
|
class CryptoconditionsChannelsTest(CryptoconditionsTestFramework):
|
||||||
|
|
||||||
def setup_chain(self):
|
|
||||||
print("Initializing CC test directory "+self.options.tmpdir)
|
|
||||||
self.num_nodes = 2
|
|
||||||
initialize_chain_clean(self.options.tmpdir, self.num_nodes)
|
|
||||||
|
|
||||||
def setup_network(self, split = False):
|
|
||||||
print("Setting up network...")
|
|
||||||
self.addr = "RWPg8B91kfK5UtUN7z6s6TeV9cHSGtVY8D"
|
|
||||||
self.pubkey = "02676d00110c2cd14ae24f95969e8598f7ccfaa675498b82654a5b5bd57fc1d8cf"
|
|
||||||
self.privkey = "UqMgxk7ySPNQ4r9nKAFPjkXy6r5t898yhuNCjSZJLg3RAM4WW1m9"
|
|
||||||
self.addr1 = "RXEXoa1nRmKhMbuZovpcYwQMsicwzccZBp"
|
|
||||||
self.pubkey1 = "024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff0"
|
|
||||||
self.privkey1 = "UtdydP56pGTFmawHzHr1wDrc4oUwCNW1ttX8Pc3KrvH3MA8P49Wi"
|
|
||||||
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir,
|
|
||||||
extra_args=[[
|
|
||||||
# always give -ac_name as first extra_arg and port as third
|
|
||||||
'-ac_name=REGTEST',
|
|
||||||
'-conf='+self.options.tmpdir+'/node0/REGTEST.conf',
|
|
||||||
'-port=64367',
|
|
||||||
'-rpcport=64368',
|
|
||||||
'-regtest',
|
|
||||||
'-addressindex=1',
|
|
||||||
'-spentindex=1',
|
|
||||||
'-ac_supply=5555555',
|
|
||||||
'-ac_reward=10000000000000',
|
|
||||||
'-pubkey=' + self.pubkey,
|
|
||||||
'-ac_cc=2',
|
|
||||||
'-whitelist=127.0.0.1',
|
|
||||||
'-debug',
|
|
||||||
'--daemon',
|
|
||||||
'-rpcuser=rt',
|
|
||||||
'-rpcpassword=rt'
|
|
||||||
],
|
|
||||||
['-ac_name=REGTEST',
|
|
||||||
'-conf='+self.options.tmpdir+'/node1/REGTEST.conf',
|
|
||||||
'-port=64365',
|
|
||||||
'-rpcport=64366',
|
|
||||||
'-regtest',
|
|
||||||
'-addressindex=1',
|
|
||||||
'-spentindex=1',
|
|
||||||
'-ac_supply=5555555',
|
|
||||||
'-ac_reward=10000000000000',
|
|
||||||
'-pubkey=' + self.pubkey1,
|
|
||||||
'-ac_cc=2',
|
|
||||||
'-whitelist=127.0.0.1',
|
|
||||||
'-debug',
|
|
||||||
'-addnode=127.0.0.1:64367',
|
|
||||||
'--daemon',
|
|
||||||
'-rpcuser=rt',
|
|
||||||
'-rpcpassword=rt']]
|
|
||||||
)
|
|
||||||
self.is_network_split = split
|
|
||||||
self.rpc = self.nodes[0]
|
|
||||||
self.rpc1 = self.nodes[1]
|
|
||||||
self.sync_all()
|
|
||||||
print("Done setting up network")
|
|
||||||
|
|
||||||
def send_and_mine(self, xtn, rpc_connection):
|
|
||||||
txid = rpc_connection.sendrawtransaction(xtn)
|
|
||||||
assert txid, 'got txid'
|
|
||||||
# we need the tx above to be confirmed in the next block
|
|
||||||
rpc_connection.generate(1)
|
|
||||||
return txid
|
|
||||||
|
|
||||||
def run_channels_tests(self):
|
def run_channels_tests(self):
|
||||||
|
|
||||||
|
|||||||
@@ -4,78 +4,15 @@
|
|||||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
||||||
from test_framework.test_framework import BitcoinTestFramework
|
from test_framework.test_framework import CryptoconditionsTestFramework
|
||||||
from test_framework.authproxy import JSONRPCException
|
from test_framework.authproxy import JSONRPCException
|
||||||
from test_framework.util import assert_equal, assert_greater_than, \
|
from test_framework.util import assert_equal, assert_greater_than, \
|
||||||
initialize_chain_clean, initialize_chain, start_nodes, start_node, connect_nodes_bi, \
|
initialize_chain_clean, initialize_chain, start_nodes, start_node, connect_nodes_bi, \
|
||||||
stop_nodes, sync_blocks, sync_mempools, wait_bitcoinds, rpc_port, assert_raises
|
stop_nodes, sync_blocks, sync_mempools, wait_bitcoinds, rpc_port, assert_raises
|
||||||
from cryptoconditions import assert_success, assert_error, generate_random_string
|
from cryptoconditions import assert_success, assert_error, generate_random_string
|
||||||
|
|
||||||
class CryptoconditionsDiceTest(BitcoinTestFramework):
|
|
||||||
|
|
||||||
def setup_chain(self):
|
class CryptoconditionsDiceTest(CryptoconditionsTestFramework):
|
||||||
print("Initializing CC test directory "+self.options.tmpdir)
|
|
||||||
self.num_nodes = 2
|
|
||||||
initialize_chain_clean(self.options.tmpdir, self.num_nodes)
|
|
||||||
|
|
||||||
def setup_network(self, split = False):
|
|
||||||
print("Setting up network...")
|
|
||||||
self.addr = "RWPg8B91kfK5UtUN7z6s6TeV9cHSGtVY8D"
|
|
||||||
self.pubkey = "02676d00110c2cd14ae24f95969e8598f7ccfaa675498b82654a5b5bd57fc1d8cf"
|
|
||||||
self.privkey = "UqMgxk7ySPNQ4r9nKAFPjkXy6r5t898yhuNCjSZJLg3RAM4WW1m9"
|
|
||||||
self.addr1 = "RXEXoa1nRmKhMbuZovpcYwQMsicwzccZBp"
|
|
||||||
self.pubkey1 = "024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff0"
|
|
||||||
self.privkey1 = "UtdydP56pGTFmawHzHr1wDrc4oUwCNW1ttX8Pc3KrvH3MA8P49Wi"
|
|
||||||
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir,
|
|
||||||
extra_args=[[
|
|
||||||
# always give -ac_name as first extra_arg and port as third
|
|
||||||
'-ac_name=REGTEST',
|
|
||||||
'-conf='+self.options.tmpdir+'/node0/REGTEST.conf',
|
|
||||||
'-port=64367',
|
|
||||||
'-rpcport=64368',
|
|
||||||
'-regtest',
|
|
||||||
'-addressindex=1',
|
|
||||||
'-spentindex=1',
|
|
||||||
'-ac_supply=5555555',
|
|
||||||
'-ac_reward=10000000000000',
|
|
||||||
'-pubkey=' + self.pubkey,
|
|
||||||
'-ac_cc=2',
|
|
||||||
'-whitelist=127.0.0.1',
|
|
||||||
'-debug',
|
|
||||||
'--daemon',
|
|
||||||
'-rpcuser=rt',
|
|
||||||
'-rpcpassword=rt'
|
|
||||||
],
|
|
||||||
['-ac_name=REGTEST',
|
|
||||||
'-conf='+self.options.tmpdir+'/node1/REGTEST.conf',
|
|
||||||
'-port=64365',
|
|
||||||
'-rpcport=64366',
|
|
||||||
'-regtest',
|
|
||||||
'-addressindex=1',
|
|
||||||
'-spentindex=1',
|
|
||||||
'-ac_supply=5555555',
|
|
||||||
'-ac_reward=10000000000000',
|
|
||||||
'-pubkey=' + self.pubkey1,
|
|
||||||
'-ac_cc=2',
|
|
||||||
'-whitelist=127.0.0.1',
|
|
||||||
'-debug',
|
|
||||||
'-addnode=127.0.0.1:64367',
|
|
||||||
'--daemon',
|
|
||||||
'-rpcuser=rt',
|
|
||||||
'-rpcpassword=rt']]
|
|
||||||
)
|
|
||||||
self.is_network_split = split
|
|
||||||
self.rpc = self.nodes[0]
|
|
||||||
self.rpc1 = self.nodes[1]
|
|
||||||
self.sync_all()
|
|
||||||
print("Done setting up network")
|
|
||||||
|
|
||||||
def send_and_mine(self, xtn, rpc_connection):
|
|
||||||
txid = rpc_connection.sendrawtransaction(xtn)
|
|
||||||
assert txid, 'got txid'
|
|
||||||
# we need the tx above to be confirmed in the next block
|
|
||||||
rpc_connection.generate(1)
|
|
||||||
return txid
|
|
||||||
|
|
||||||
def run_dice_tests(self):
|
def run_dice_tests(self):
|
||||||
rpc = self.nodes[0]
|
rpc = self.nodes[0]
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
||||||
from test_framework.test_framework import BitcoinTestFramework
|
from test_framework.test_framework import CryptoconditionsTestFramework
|
||||||
from test_framework.authproxy import JSONRPCException
|
from test_framework.authproxy import JSONRPCException
|
||||||
from test_framework.util import assert_equal, assert_greater_than, \
|
from test_framework.util import assert_equal, assert_greater_than, \
|
||||||
initialize_chain_clean, initialize_chain, start_nodes, start_node, connect_nodes_bi, \
|
initialize_chain_clean, initialize_chain, start_nodes, start_node, connect_nodes_bi, \
|
||||||
@@ -12,71 +12,7 @@ from test_framework.util import assert_equal, assert_greater_than, \
|
|||||||
from cryptoconditions import assert_success, assert_error, generate_random_string
|
from cryptoconditions import assert_success, assert_error, generate_random_string
|
||||||
|
|
||||||
|
|
||||||
class CryptoconditionsFaucetTest(BitcoinTestFramework):
|
class CryptoconditionsFaucetTest(CryptoconditionsTestFramework):
|
||||||
|
|
||||||
def setup_chain(self):
|
|
||||||
print("Initializing CC test directory "+self.options.tmpdir)
|
|
||||||
self.num_nodes = 2
|
|
||||||
initialize_chain_clean(self.options.tmpdir, self.num_nodes)
|
|
||||||
|
|
||||||
def setup_network(self, split = False):
|
|
||||||
print("Setting up network...")
|
|
||||||
self.addr = "RWPg8B91kfK5UtUN7z6s6TeV9cHSGtVY8D"
|
|
||||||
self.pubkey = "02676d00110c2cd14ae24f95969e8598f7ccfaa675498b82654a5b5bd57fc1d8cf"
|
|
||||||
self.privkey = "UqMgxk7ySPNQ4r9nKAFPjkXy6r5t898yhuNCjSZJLg3RAM4WW1m9"
|
|
||||||
self.addr1 = "RXEXoa1nRmKhMbuZovpcYwQMsicwzccZBp"
|
|
||||||
self.pubkey1 = "024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff0"
|
|
||||||
self.privkey1 = "UtdydP56pGTFmawHzHr1wDrc4oUwCNW1ttX8Pc3KrvH3MA8P49Wi"
|
|
||||||
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir,
|
|
||||||
extra_args=[[
|
|
||||||
# always give -ac_name as first extra_arg and port as third
|
|
||||||
'-ac_name=REGTEST',
|
|
||||||
'-conf='+self.options.tmpdir+'/node0/REGTEST.conf',
|
|
||||||
'-port=64367',
|
|
||||||
'-rpcport=64368',
|
|
||||||
'-regtest',
|
|
||||||
'-addressindex=1',
|
|
||||||
'-spentindex=1',
|
|
||||||
'-ac_supply=5555555',
|
|
||||||
'-ac_reward=10000000000000',
|
|
||||||
'-pubkey=' + self.pubkey,
|
|
||||||
'-ac_cc=2',
|
|
||||||
'-whitelist=127.0.0.1',
|
|
||||||
'-debug',
|
|
||||||
'--daemon',
|
|
||||||
'-rpcuser=rt',
|
|
||||||
'-rpcpassword=rt'
|
|
||||||
],
|
|
||||||
['-ac_name=REGTEST',
|
|
||||||
'-conf='+self.options.tmpdir+'/node1/REGTEST.conf',
|
|
||||||
'-port=64365',
|
|
||||||
'-rpcport=64366',
|
|
||||||
'-regtest',
|
|
||||||
'-addressindex=1',
|
|
||||||
'-spentindex=1',
|
|
||||||
'-ac_supply=5555555',
|
|
||||||
'-ac_reward=10000000000000',
|
|
||||||
'-pubkey=' + self.pubkey1,
|
|
||||||
'-ac_cc=2',
|
|
||||||
'-whitelist=127.0.0.1',
|
|
||||||
'-debug',
|
|
||||||
'-addnode=127.0.0.1:64367',
|
|
||||||
'--daemon',
|
|
||||||
'-rpcuser=rt',
|
|
||||||
'-rpcpassword=rt']]
|
|
||||||
)
|
|
||||||
self.is_network_split = split
|
|
||||||
self.rpc = self.nodes[0]
|
|
||||||
self.rpc1 = self.nodes[1]
|
|
||||||
self.sync_all()
|
|
||||||
print("Done setting up network")
|
|
||||||
|
|
||||||
def send_and_mine(self, xtn, rpc_connection):
|
|
||||||
txid = rpc_connection.sendrawtransaction(xtn)
|
|
||||||
assert txid, 'got txid'
|
|
||||||
# we need the tx above to be confirmed in the next block
|
|
||||||
rpc_connection.generate(1)
|
|
||||||
return txid
|
|
||||||
|
|
||||||
def run_faucet_tests(self):
|
def run_faucet_tests(self):
|
||||||
rpc = self.rpc
|
rpc = self.rpc
|
||||||
|
|||||||
@@ -4,80 +4,15 @@
|
|||||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
||||||
from test_framework.test_framework import BitcoinTestFramework
|
from test_framework.test_framework import CryptoconditionsTestFramework
|
||||||
from test_framework.authproxy import JSONRPCException
|
from test_framework.authproxy import JSONRPCException
|
||||||
from test_framework.util import assert_equal, assert_greater_than, \
|
from test_framework.util import assert_equal, assert_greater_than, \
|
||||||
initialize_chain_clean, initialize_chain, start_nodes, start_node, connect_nodes_bi, \
|
initialize_chain_clean, initialize_chain, start_nodes, start_node, connect_nodes_bi, \
|
||||||
stop_nodes, sync_blocks, sync_mempools, wait_bitcoinds, rpc_port, assert_raises
|
stop_nodes, sync_blocks, sync_mempools, wait_bitcoinds, rpc_port, assert_raises
|
||||||
from cryptoconditions import assert_success, assert_error, generate_random_string
|
from cryptoconditions import assert_success, assert_error, generate_random_string
|
||||||
import subprocess
|
|
||||||
|
|
||||||
class CryptoconditionsGatewaysTest(BitcoinTestFramework):
|
|
||||||
|
|
||||||
|
|
||||||
def setup_chain(self):
|
class CryptoconditionsGatewaysTest(CryptoconditionsTestFramework):
|
||||||
print("Initializing CC test directory "+self.options.tmpdir)
|
|
||||||
self.num_nodes = 2
|
|
||||||
initialize_chain_clean(self.options.tmpdir, self.num_nodes)
|
|
||||||
|
|
||||||
def setup_network(self, split = False):
|
|
||||||
print("Setting up network...")
|
|
||||||
self.addr = "RWPg8B91kfK5UtUN7z6s6TeV9cHSGtVY8D"
|
|
||||||
self.pubkey = "02676d00110c2cd14ae24f95969e8598f7ccfaa675498b82654a5b5bd57fc1d8cf"
|
|
||||||
self.privkey = "UqMgxk7ySPNQ4r9nKAFPjkXy6r5t898yhuNCjSZJLg3RAM4WW1m9"
|
|
||||||
self.addr1 = "RXEXoa1nRmKhMbuZovpcYwQMsicwzccZBp"
|
|
||||||
self.pubkey1 = "024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff0"
|
|
||||||
self.privkey1 = "UtdydP56pGTFmawHzHr1wDrc4oUwCNW1ttX8Pc3KrvH3MA8P49Wi"
|
|
||||||
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir,
|
|
||||||
extra_args=[[
|
|
||||||
# always give -ac_name as first extra_arg and port as third
|
|
||||||
'-ac_name=REGTEST',
|
|
||||||
'-conf='+self.options.tmpdir+'/node0/REGTEST.conf',
|
|
||||||
'-port=64367',
|
|
||||||
'-rpcport=64368',
|
|
||||||
'-regtest',
|
|
||||||
'-addressindex=1',
|
|
||||||
'-spentindex=1',
|
|
||||||
'-ac_supply=5555555',
|
|
||||||
'-ac_reward=10000000000000',
|
|
||||||
'-pubkey=' + self.pubkey,
|
|
||||||
'-ac_cc=2',
|
|
||||||
'-whitelist=127.0.0.1',
|
|
||||||
'-debug',
|
|
||||||
'--daemon',
|
|
||||||
'-rpcuser=rt',
|
|
||||||
'-rpcpassword=rt'
|
|
||||||
],
|
|
||||||
['-ac_name=REGTEST',
|
|
||||||
'-conf='+self.options.tmpdir+'/node1/REGTEST.conf',
|
|
||||||
'-port=64365',
|
|
||||||
'-rpcport=64366',
|
|
||||||
'-regtest',
|
|
||||||
'-addressindex=1',
|
|
||||||
'-spentindex=1',
|
|
||||||
'-ac_supply=5555555',
|
|
||||||
'-ac_reward=10000000000000',
|
|
||||||
'-pubkey=' + self.pubkey1,
|
|
||||||
'-ac_cc=2',
|
|
||||||
'-whitelist=127.0.0.1',
|
|
||||||
'-debug',
|
|
||||||
'-addnode=127.0.0.1:64367',
|
|
||||||
'--daemon',
|
|
||||||
'-rpcuser=rt',
|
|
||||||
'-rpcpassword=rt']]
|
|
||||||
)
|
|
||||||
self.is_network_split = split
|
|
||||||
self.rpc = self.nodes[0]
|
|
||||||
self.rpc1 = self.nodes[1]
|
|
||||||
self.sync_all()
|
|
||||||
print("Done setting up network")
|
|
||||||
|
|
||||||
def send_and_mine(self, xtn, rpc_connection):
|
|
||||||
txid = rpc_connection.sendrawtransaction(xtn)
|
|
||||||
assert txid, 'got txid'
|
|
||||||
# we need the tx above to be confirmed in the next block
|
|
||||||
rpc_connection.generate(1)
|
|
||||||
return txid
|
|
||||||
|
|
||||||
def run_gateways_tests(self):
|
def run_gateways_tests(self):
|
||||||
rpc = self.nodes[0]
|
rpc = self.nodes[0]
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
||||||
from test_framework.test_framework import BitcoinTestFramework
|
from test_framework.test_framework import CryptoconditionsTestFramework
|
||||||
from test_framework.authproxy import JSONRPCException
|
from test_framework.authproxy import JSONRPCException
|
||||||
from test_framework.util import assert_equal, assert_greater_than, \
|
from test_framework.util import assert_equal, assert_greater_than, \
|
||||||
initialize_chain_clean, initialize_chain, start_nodes, start_node, connect_nodes_bi, \
|
initialize_chain_clean, initialize_chain, start_nodes, start_node, connect_nodes_bi, \
|
||||||
@@ -12,72 +12,7 @@ from test_framework.util import assert_equal, assert_greater_than, \
|
|||||||
from cryptoconditions import assert_success, assert_error, generate_random_string
|
from cryptoconditions import assert_success, assert_error, generate_random_string
|
||||||
|
|
||||||
|
|
||||||
class CryptoconditionsOraclesTest(BitcoinTestFramework):
|
class CryptoconditionsOraclesTest(CryptoconditionsTestFramework):
|
||||||
|
|
||||||
|
|
||||||
def setup_chain(self):
|
|
||||||
print("Initializing CC test directory "+self.options.tmpdir)
|
|
||||||
self.num_nodes = 2
|
|
||||||
initialize_chain_clean(self.options.tmpdir, self.num_nodes)
|
|
||||||
|
|
||||||
def setup_network(self, split = False):
|
|
||||||
print("Setting up network...")
|
|
||||||
self.addr = "RWPg8B91kfK5UtUN7z6s6TeV9cHSGtVY8D"
|
|
||||||
self.pubkey = "02676d00110c2cd14ae24f95969e8598f7ccfaa675498b82654a5b5bd57fc1d8cf"
|
|
||||||
self.privkey = "UqMgxk7ySPNQ4r9nKAFPjkXy6r5t898yhuNCjSZJLg3RAM4WW1m9"
|
|
||||||
self.addr1 = "RXEXoa1nRmKhMbuZovpcYwQMsicwzccZBp"
|
|
||||||
self.pubkey1 = "024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff0"
|
|
||||||
self.privkey1 = "UtdydP56pGTFmawHzHr1wDrc4oUwCNW1ttX8Pc3KrvH3MA8P49Wi"
|
|
||||||
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir,
|
|
||||||
extra_args=[[
|
|
||||||
# always give -ac_name as first extra_arg and port as third
|
|
||||||
'-ac_name=REGTEST',
|
|
||||||
'-conf='+self.options.tmpdir+'/node0/REGTEST.conf',
|
|
||||||
'-port=64367',
|
|
||||||
'-rpcport=64368',
|
|
||||||
'-regtest',
|
|
||||||
'-addressindex=1',
|
|
||||||
'-spentindex=1',
|
|
||||||
'-ac_supply=5555555',
|
|
||||||
'-ac_reward=10000000000000',
|
|
||||||
'-pubkey=' + self.pubkey,
|
|
||||||
'-ac_cc=2',
|
|
||||||
'-whitelist=127.0.0.1',
|
|
||||||
'-debug',
|
|
||||||
'--daemon',
|
|
||||||
'-rpcuser=rt',
|
|
||||||
'-rpcpassword=rt'
|
|
||||||
],
|
|
||||||
['-ac_name=REGTEST',
|
|
||||||
'-conf='+self.options.tmpdir+'/node1/REGTEST.conf',
|
|
||||||
'-port=64365',
|
|
||||||
'-rpcport=64366',
|
|
||||||
'-regtest',
|
|
||||||
'-addressindex=1',
|
|
||||||
'-spentindex=1',
|
|
||||||
'-ac_supply=5555555',
|
|
||||||
'-ac_reward=10000000000000',
|
|
||||||
'-pubkey=' + self.pubkey1,
|
|
||||||
'-ac_cc=2',
|
|
||||||
'-whitelist=127.0.0.1',
|
|
||||||
'-debug',
|
|
||||||
'-addnode=127.0.0.1:64367',
|
|
||||||
'--daemon',
|
|
||||||
'-rpcuser=rt',
|
|
||||||
'-rpcpassword=rt']]
|
|
||||||
)
|
|
||||||
self.is_network_split = split
|
|
||||||
self.rpc = self.nodes[0]
|
|
||||||
self.rpc1 = self.nodes[1]
|
|
||||||
self.sync_all()
|
|
||||||
print("Done setting up network")
|
|
||||||
|
|
||||||
def send_and_mine(self, xtn, rpc_connection):
|
|
||||||
txid = rpc_connection.sendrawtransaction(xtn)
|
|
||||||
assert txid, 'got txid'
|
|
||||||
# we need the tx above to be confirmed in the next block
|
|
||||||
rpc_connection.generate(1)
|
|
||||||
return txid
|
|
||||||
|
|
||||||
def run_oracles_tests(self):
|
def run_oracles_tests(self):
|
||||||
rpc = self.nodes[0]
|
rpc = self.nodes[0]
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
||||||
from test_framework.test_framework import BitcoinTestFramework
|
from test_framework.test_framework import CryptoconditionsTestFramework
|
||||||
from test_framework.authproxy import JSONRPCException
|
from test_framework.authproxy import JSONRPCException
|
||||||
from test_framework.util import assert_equal, assert_greater_than, \
|
from test_framework.util import assert_equal, assert_greater_than, \
|
||||||
initialize_chain_clean, initialize_chain, start_nodes, start_node, connect_nodes_bi, \
|
initialize_chain_clean, initialize_chain, start_nodes, start_node, connect_nodes_bi, \
|
||||||
@@ -12,72 +12,7 @@ from test_framework.util import assert_equal, assert_greater_than, \
|
|||||||
from cryptoconditions import assert_success, assert_error, generate_random_string
|
from cryptoconditions import assert_success, assert_error, generate_random_string
|
||||||
|
|
||||||
|
|
||||||
class CryptoconditionsRewardsTest(BitcoinTestFramework):
|
class CryptoconditionsRewardsTest(CryptoconditionsTestFramework):
|
||||||
|
|
||||||
|
|
||||||
def setup_chain(self):
|
|
||||||
print("Initializing CC test directory "+self.options.tmpdir)
|
|
||||||
self.num_nodes = 2
|
|
||||||
initialize_chain_clean(self.options.tmpdir, self.num_nodes)
|
|
||||||
|
|
||||||
def setup_network(self, split = False):
|
|
||||||
print("Setting up network...")
|
|
||||||
self.addr = "RWPg8B91kfK5UtUN7z6s6TeV9cHSGtVY8D"
|
|
||||||
self.pubkey = "02676d00110c2cd14ae24f95969e8598f7ccfaa675498b82654a5b5bd57fc1d8cf"
|
|
||||||
self.privkey = "UqMgxk7ySPNQ4r9nKAFPjkXy6r5t898yhuNCjSZJLg3RAM4WW1m9"
|
|
||||||
self.addr1 = "RXEXoa1nRmKhMbuZovpcYwQMsicwzccZBp"
|
|
||||||
self.pubkey1 = "024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff0"
|
|
||||||
self.privkey1 = "UtdydP56pGTFmawHzHr1wDrc4oUwCNW1ttX8Pc3KrvH3MA8P49Wi"
|
|
||||||
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir,
|
|
||||||
extra_args=[[
|
|
||||||
# always give -ac_name as first extra_arg and port as third
|
|
||||||
'-ac_name=REGTEST',
|
|
||||||
'-conf='+self.options.tmpdir+'/node0/REGTEST.conf',
|
|
||||||
'-port=64367',
|
|
||||||
'-rpcport=64368',
|
|
||||||
'-regtest',
|
|
||||||
'-addressindex=1',
|
|
||||||
'-spentindex=1',
|
|
||||||
'-ac_supply=5555555',
|
|
||||||
'-ac_reward=10000000000000',
|
|
||||||
'-pubkey=' + self.pubkey,
|
|
||||||
'-ac_cc=2',
|
|
||||||
'-whitelist=127.0.0.1',
|
|
||||||
'-debug',
|
|
||||||
'--daemon',
|
|
||||||
'-rpcuser=rt',
|
|
||||||
'-rpcpassword=rt'
|
|
||||||
],
|
|
||||||
['-ac_name=REGTEST',
|
|
||||||
'-conf='+self.options.tmpdir+'/node1/REGTEST.conf',
|
|
||||||
'-port=64365',
|
|
||||||
'-rpcport=64366',
|
|
||||||
'-regtest',
|
|
||||||
'-addressindex=1',
|
|
||||||
'-spentindex=1',
|
|
||||||
'-ac_supply=5555555',
|
|
||||||
'-ac_reward=10000000000000',
|
|
||||||
'-pubkey=' + self.pubkey1,
|
|
||||||
'-ac_cc=2',
|
|
||||||
'-whitelist=127.0.0.1',
|
|
||||||
'-debug',
|
|
||||||
'-addnode=127.0.0.1:64367',
|
|
||||||
'--daemon',
|
|
||||||
'-rpcuser=rt',
|
|
||||||
'-rpcpassword=rt']]
|
|
||||||
)
|
|
||||||
self.is_network_split = split
|
|
||||||
self.rpc = self.nodes[0]
|
|
||||||
self.rpc1 = self.nodes[1]
|
|
||||||
self.sync_all()
|
|
||||||
print("Done setting up network")
|
|
||||||
|
|
||||||
def send_and_mine(self, xtn, rpc_connection):
|
|
||||||
txid = rpc_connection.sendrawtransaction(xtn)
|
|
||||||
assert txid, 'got txid'
|
|
||||||
# we need the tx above to be confirmed in the next block
|
|
||||||
rpc_connection.generate(1)
|
|
||||||
return txid
|
|
||||||
|
|
||||||
def run_rewards_tests(self):
|
def run_rewards_tests(self):
|
||||||
rpc = self.nodes[0]
|
rpc = self.nodes[0]
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
|
||||||
from test_framework.test_framework import BitcoinTestFramework
|
from test_framework.test_framework import CryptoconditionsTestFramework
|
||||||
from test_framework.authproxy import JSONRPCException
|
from test_framework.authproxy import JSONRPCException
|
||||||
from test_framework.util import assert_equal, assert_greater_than, \
|
from test_framework.util import assert_equal, assert_greater_than, \
|
||||||
initialize_chain_clean, initialize_chain, start_nodes, start_node, connect_nodes_bi, \
|
initialize_chain_clean, initialize_chain, start_nodes, start_node, connect_nodes_bi, \
|
||||||
@@ -12,72 +12,7 @@ from test_framework.util import assert_equal, assert_greater_than, \
|
|||||||
from cryptoconditions import assert_success, assert_error, generate_random_string
|
from cryptoconditions import assert_success, assert_error, generate_random_string
|
||||||
|
|
||||||
|
|
||||||
class CryptoconditionsTokenTest(BitcoinTestFramework):
|
class CryptoconditionsTokenTest(CryptoconditionsTestFramework):
|
||||||
|
|
||||||
|
|
||||||
def setup_chain(self):
|
|
||||||
print("Initializing CC test directory "+self.options.tmpdir)
|
|
||||||
self.num_nodes = 2
|
|
||||||
initialize_chain_clean(self.options.tmpdir, self.num_nodes)
|
|
||||||
|
|
||||||
def setup_network(self, split = False):
|
|
||||||
print("Setting up network...")
|
|
||||||
self.addr = "RWPg8B91kfK5UtUN7z6s6TeV9cHSGtVY8D"
|
|
||||||
self.pubkey = "02676d00110c2cd14ae24f95969e8598f7ccfaa675498b82654a5b5bd57fc1d8cf"
|
|
||||||
self.privkey = "UqMgxk7ySPNQ4r9nKAFPjkXy6r5t898yhuNCjSZJLg3RAM4WW1m9"
|
|
||||||
self.addr1 = "RXEXoa1nRmKhMbuZovpcYwQMsicwzccZBp"
|
|
||||||
self.pubkey1 = "024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff0"
|
|
||||||
self.privkey1 = "UtdydP56pGTFmawHzHr1wDrc4oUwCNW1ttX8Pc3KrvH3MA8P49Wi"
|
|
||||||
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir,
|
|
||||||
extra_args=[[
|
|
||||||
# always give -ac_name as first extra_arg and port as third
|
|
||||||
'-ac_name=REGTEST',
|
|
||||||
'-conf='+self.options.tmpdir+'/node0/REGTEST.conf',
|
|
||||||
'-port=64367',
|
|
||||||
'-rpcport=64368',
|
|
||||||
'-regtest',
|
|
||||||
'-addressindex=1',
|
|
||||||
'-spentindex=1',
|
|
||||||
'-ac_supply=5555555',
|
|
||||||
'-ac_reward=10000000000000',
|
|
||||||
'-pubkey=' + self.pubkey,
|
|
||||||
'-ac_cc=2',
|
|
||||||
'-whitelist=127.0.0.1',
|
|
||||||
'-debug',
|
|
||||||
'--daemon',
|
|
||||||
'-rpcuser=rt',
|
|
||||||
'-rpcpassword=rt'
|
|
||||||
],
|
|
||||||
['-ac_name=REGTEST',
|
|
||||||
'-conf='+self.options.tmpdir+'/node1/REGTEST.conf',
|
|
||||||
'-port=64365',
|
|
||||||
'-rpcport=64366',
|
|
||||||
'-regtest',
|
|
||||||
'-addressindex=1',
|
|
||||||
'-spentindex=1',
|
|
||||||
'-ac_supply=5555555',
|
|
||||||
'-ac_reward=10000000000000',
|
|
||||||
'-pubkey=' + self.pubkey1,
|
|
||||||
'-ac_cc=2',
|
|
||||||
'-whitelist=127.0.0.1',
|
|
||||||
'-debug',
|
|
||||||
'-addnode=127.0.0.1:64367',
|
|
||||||
'--daemon',
|
|
||||||
'-rpcuser=rt',
|
|
||||||
'-rpcpassword=rt']]
|
|
||||||
)
|
|
||||||
self.is_network_split = split
|
|
||||||
self.rpc = self.nodes[0]
|
|
||||||
self.rpc1 = self.nodes[1]
|
|
||||||
self.sync_all()
|
|
||||||
print("Done setting up network")
|
|
||||||
|
|
||||||
def send_and_mine(self, xtn, rpc_connection):
|
|
||||||
txid = rpc_connection.sendrawtransaction(xtn)
|
|
||||||
assert txid, 'got txid'
|
|
||||||
# we need the tx above to be confirmed in the next block
|
|
||||||
rpc_connection.generate(1)
|
|
||||||
return txid
|
|
||||||
|
|
||||||
def run_token_tests(self):
|
def run_token_tests(self):
|
||||||
rpc = self.nodes[0]
|
rpc = self.nodes[0]
|
||||||
|
|||||||
@@ -180,3 +180,72 @@ class ComparisonTestFramework(BitcoinTestFramework):
|
|||||||
extra_args=[['-debug', '-whitelist=127.0.0.1']] * self.num_nodes,
|
extra_args=[['-debug', '-whitelist=127.0.0.1']] * self.num_nodes,
|
||||||
binary=[self.options.testbinary] +
|
binary=[self.options.testbinary] +
|
||||||
[self.options.refbinary]*(self.num_nodes-1))
|
[self.options.refbinary]*(self.num_nodes-1))
|
||||||
|
|
||||||
|
|
||||||
|
class CryptoconditionsTestFramework(BitcoinTestFramework):
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self.num_nodes = 2
|
||||||
|
|
||||||
|
def setup_chain(self):
|
||||||
|
print("Initializing CC test directory "+self.options.tmpdir)
|
||||||
|
initialize_chain_clean(self.options.tmpdir, self.num_nodes)
|
||||||
|
|
||||||
|
def setup_network(self, split = False):
|
||||||
|
print("Setting up network...")
|
||||||
|
self.addr = "RWPg8B91kfK5UtUN7z6s6TeV9cHSGtVY8D"
|
||||||
|
self.pubkey = "02676d00110c2cd14ae24f95969e8598f7ccfaa675498b82654a5b5bd57fc1d8cf"
|
||||||
|
self.privkey = "UqMgxk7ySPNQ4r9nKAFPjkXy6r5t898yhuNCjSZJLg3RAM4WW1m9"
|
||||||
|
self.addr1 = "RXEXoa1nRmKhMbuZovpcYwQMsicwzccZBp"
|
||||||
|
self.pubkey1 = "024026d4ad4ecfc1f705a9b42ca64af6d2ad947509c085534a30b8861d756c6ff0"
|
||||||
|
self.privkey1 = "UtdydP56pGTFmawHzHr1wDrc4oUwCNW1ttX8Pc3KrvH3MA8P49Wi"
|
||||||
|
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir,
|
||||||
|
extra_args=[[
|
||||||
|
# always give -ac_name as first extra_arg and port as third
|
||||||
|
'-ac_name=REGTEST',
|
||||||
|
'-conf='+self.options.tmpdir+'/node0/REGTEST.conf',
|
||||||
|
'-port=64367',
|
||||||
|
'-rpcport=64368',
|
||||||
|
'-regtest',
|
||||||
|
'-addressindex=1',
|
||||||
|
'-spentindex=1',
|
||||||
|
'-ac_supply=5555555',
|
||||||
|
'-ac_reward=10000000000000',
|
||||||
|
'-pubkey=' + self.pubkey,
|
||||||
|
'-ac_cc=2',
|
||||||
|
'-whitelist=127.0.0.1',
|
||||||
|
'-debug',
|
||||||
|
'--daemon',
|
||||||
|
'-rpcuser=rt',
|
||||||
|
'-rpcpassword=rt'
|
||||||
|
],
|
||||||
|
['-ac_name=REGTEST',
|
||||||
|
'-conf='+self.options.tmpdir+'/node1/REGTEST.conf',
|
||||||
|
'-port=64365',
|
||||||
|
'-rpcport=64366',
|
||||||
|
'-regtest',
|
||||||
|
'-addressindex=1',
|
||||||
|
'-spentindex=1',
|
||||||
|
'-ac_supply=5555555',
|
||||||
|
'-ac_reward=10000000000000',
|
||||||
|
'-pubkey=' + self.pubkey1,
|
||||||
|
'-ac_cc=2',
|
||||||
|
'-whitelist=127.0.0.1',
|
||||||
|
'-debug',
|
||||||
|
'-addnode=127.0.0.1:64367',
|
||||||
|
'--daemon',
|
||||||
|
'-rpcuser=rt',
|
||||||
|
'-rpcpassword=rt']]
|
||||||
|
)
|
||||||
|
self.is_network_split = split
|
||||||
|
self.rpc = self.nodes[0]
|
||||||
|
self.rpc1 = self.nodes[1]
|
||||||
|
self.sync_all()
|
||||||
|
print("Done setting up network")
|
||||||
|
|
||||||
|
def send_and_mine(self, xtn, rpc_connection):
|
||||||
|
txid = rpc_connection.sendrawtransaction(xtn)
|
||||||
|
assert txid, 'got txid'
|
||||||
|
# we need the tx above to be confirmed in the next block
|
||||||
|
rpc_connection.generate(1)
|
||||||
|
return txid
|
||||||
|
|||||||
Reference in New Issue
Block a user