83
qa/pull-tester/cc-tests.sh
Executable file
83
qa/pull-tester/cc-tests.sh
Executable file
@@ -0,0 +1,83 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e -o pipefail
|
||||||
|
|
||||||
|
CURDIR=$(cd $(dirname "$0"); pwd)
|
||||||
|
# Get BUILDDIR and REAL_BITCOIND
|
||||||
|
. "${CURDIR}/tests-config.sh"
|
||||||
|
|
||||||
|
export BITCOINCLI=${BUILDDIR}/qa/pull-tester/run-bitcoin-cli
|
||||||
|
export BITCOIND=${REAL_BITCOIND}
|
||||||
|
|
||||||
|
#Run the tests
|
||||||
|
# FAUCET test should be permanently first!!!
|
||||||
|
|
||||||
|
testScripts=(
|
||||||
|
'cryptoconditions_faucet.py'
|
||||||
|
'cryptoconditions_channels.py'
|
||||||
|
'cryptoconditions_dice.py'
|
||||||
|
'cryptoconditions_oracles.py'
|
||||||
|
'cryptoconditions_rewards.py'
|
||||||
|
'cryptoconditions_token.py'
|
||||||
|
'cryptoconditions_gateways.py'
|
||||||
|
);
|
||||||
|
|
||||||
|
extArg="-extended"
|
||||||
|
passOn=${@#$extArg}
|
||||||
|
|
||||||
|
successCount=0
|
||||||
|
declare -a failures
|
||||||
|
|
||||||
|
function runTestScript
|
||||||
|
{
|
||||||
|
local testName="$1"
|
||||||
|
shift
|
||||||
|
|
||||||
|
echo -e "=== Running testscript ${testName} ==="
|
||||||
|
|
||||||
|
if eval "$@"
|
||||||
|
then
|
||||||
|
successCount=$(expr $successCount + 1)
|
||||||
|
echo "--- Success: ${testName} ---"
|
||||||
|
else
|
||||||
|
failures[${#failures[@]}]="$testName"
|
||||||
|
echo "!!! FAIL: ${testName} !!!"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ "x${ENABLE_BITCOIND}${ENABLE_UTILS}${ENABLE_WALLET}" = "x111" ]; then
|
||||||
|
for (( i = 0; i < ${#testScripts[@]}; i++ ))
|
||||||
|
do
|
||||||
|
if [ -z "$1" ] || [ "${1:0:1}" == "-" ] || [ "$1" == "${testScripts[$i]}" ] || [ "$1.py" == "${testScripts[$i]}" ]
|
||||||
|
then
|
||||||
|
runTestScript \
|
||||||
|
"${testScripts[$i]}" \
|
||||||
|
"${BUILDDIR}/qa/rpc-tests/${testScripts[$i]}" \
|
||||||
|
--srcdir "${BUILDDIR}/src" ${passOn}
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
for (( i = 0; i < ${#testScriptsExt[@]}; i++ ))
|
||||||
|
do
|
||||||
|
if [ "$1" == $extArg ] || [ "$1" == "${testScriptsExt[$i]}" ] || [ "$1.py" == "${testScriptsExt[$i]}" ]
|
||||||
|
then
|
||||||
|
runTestScript \
|
||||||
|
"${testScriptsExt[$i]}" \
|
||||||
|
"${BUILDDIR}/qa/rpc-tests/${testScriptsExt[$i]}" \
|
||||||
|
--srcdir "${BUILDDIR}/src" ${passOn}
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo -e "\n\nTests completed: $(expr $successCount + ${#failures[@]})"
|
||||||
|
echo "successes $successCount; failures: ${#failures[@]}"
|
||||||
|
|
||||||
|
if [ ${#failures[@]} -gt 0 ]
|
||||||
|
then
|
||||||
|
echo -e "\nFailing tests: ${failures[*]}"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "No rpc tests to run. Wallet, utils, and bitcoind must all be enabled"
|
||||||
|
fi
|
||||||
@@ -13,14 +13,6 @@ export BITCOIND=${REAL_BITCOIND}
|
|||||||
testScripts=(
|
testScripts=(
|
||||||
'ac_private.py'
|
'ac_private.py'
|
||||||
'verushash.py'
|
'verushash.py'
|
||||||
'cryptoconditions.py'
|
|
||||||
'cryptoconditions_channels.py'
|
|
||||||
'cryptoconditions_dice.py'
|
|
||||||
'cryptoconditions_faucet.py'
|
|
||||||
'cryptoconditions_gateways.py'
|
|
||||||
'cryptoconditions_oracles.py'
|
|
||||||
'cryptoconditions_rewards.py'
|
|
||||||
'cryptoconditions_token.py'
|
|
||||||
'paymentdisclosure.py'
|
'paymentdisclosure.py'
|
||||||
'prioritisetransaction.py'
|
'prioritisetransaction.py'
|
||||||
'wallet_treestate.py'
|
'wallet_treestate.py'
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ You can run a single test by calling `qa/pull-tester/rpc-tests.sh <testname>`.
|
|||||||
|
|
||||||
Run all possible tests with `qa/pull-tester/rpc-tests.sh -extended`.
|
Run all possible tests with `qa/pull-tester/rpc-tests.sh -extended`.
|
||||||
|
|
||||||
|
Also it's possible to run CryptoConditions tests only by `qa/pull-tester/cc-tests.sh --noshutdown --tracerpc`
|
||||||
|
|
||||||
Possible options:
|
Possible options:
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -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):
|
||||||
|
|
||||||
@@ -159,7 +95,8 @@ class CryptoconditionsChannelsTest(BitcoinTestFramework):
|
|||||||
rpc = self.nodes[0]
|
rpc = self.nodes[0]
|
||||||
rpc1 = self.nodes[1]
|
rpc1 = self.nodes[1]
|
||||||
# utxos from block 1 become mature in block 101
|
# utxos from block 1 become mature in block 101
|
||||||
rpc.generate(101)
|
if not self.options.noshutdown:
|
||||||
|
rpc.generate(101)
|
||||||
self.sync_all()
|
self.sync_all()
|
||||||
rpc.getinfo()
|
rpc.getinfo()
|
||||||
rpc1.getinfo()
|
rpc1.getinfo()
|
||||||
|
|||||||
@@ -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]
|
||||||
@@ -244,7 +181,8 @@ class CryptoconditionsDiceTest(BitcoinTestFramework):
|
|||||||
rpc = self.nodes[0]
|
rpc = self.nodes[0]
|
||||||
rpc1 = self.nodes[1]
|
rpc1 = self.nodes[1]
|
||||||
# utxos from block 1 become mature in block 101
|
# utxos from block 1 become mature in block 101
|
||||||
rpc.generate(101)
|
if not self.options.noshutdown:
|
||||||
|
rpc.generate(101)
|
||||||
self.sync_all()
|
self.sync_all()
|
||||||
rpc.getinfo()
|
rpc.getinfo()
|
||||||
rpc1.getinfo()
|
rpc1.getinfo()
|
||||||
|
|||||||
@@ -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,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 CryptoconditionsGatewaysTest(BitcoinTestFramework):
|
class CryptoconditionsGatewaysTest(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_gateways_tests(self):
|
def run_gateways_tests(self):
|
||||||
rpc = self.nodes[0]
|
rpc = self.nodes[0]
|
||||||
@@ -137,12 +72,14 @@ class CryptoconditionsGatewaysTest(BitcoinTestFramework):
|
|||||||
result = rpc.gatewayslist()
|
result = rpc.gatewayslist()
|
||||||
assert_equal(result[0], bind_txid)
|
assert_equal(result[0], bind_txid)
|
||||||
|
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
print("Mining blocks...")
|
print("Mining blocks...")
|
||||||
rpc = self.nodes[0]
|
rpc = self.nodes[0]
|
||||||
rpc1 = self.nodes[1]
|
rpc1 = self.nodes[1]
|
||||||
# utxos from block 1 become mature in block 101
|
# utxos from block 1 become mature in block 101
|
||||||
rpc.generate(101)
|
if not self.options.noshutdown:
|
||||||
|
rpc.generate(101)
|
||||||
self.sync_all()
|
self.sync_all()
|
||||||
rpc.getinfo()
|
rpc.getinfo()
|
||||||
rpc1.getinfo()
|
rpc1.getinfo()
|
||||||
|
|||||||
@@ -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]
|
||||||
@@ -269,8 +204,6 @@ class CryptoconditionsOraclesTest(BitcoinTestFramework):
|
|||||||
oraclesdata_Ihh = self.send_and_mine(result["hex"], rpc)
|
oraclesdata_Ihh = self.send_and_mine(result["hex"], rpc)
|
||||||
result = rpc.oraclessamples(globals()["oracle_{}".format("Ihh")], oraclesdata_Ihh, "1")
|
result = rpc.oraclessamples(globals()["oracle_{}".format("Ihh")], oraclesdata_Ihh, "1")
|
||||||
assert_equal("[u'0']", str(result["samples"][0]), "Data match")
|
assert_equal("[u'0']", str(result["samples"][0]), "Data match")
|
||||||
assert_equal("[u'00000000ffffffff00000000ffffffff00000000ffffffff00000000ffffffff']", str(result["samples"][1]), "Data match")
|
|
||||||
assert_equal("[u'00000000ffffffff00000000ffffffff00000000ffffffff00000000ffffffff']", str(result["samples"][2]), "Data match")
|
|
||||||
|
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
@@ -278,7 +211,8 @@ class CryptoconditionsOraclesTest(BitcoinTestFramework):
|
|||||||
rpc = self.nodes[0]
|
rpc = self.nodes[0]
|
||||||
rpc1 = self.nodes[1]
|
rpc1 = self.nodes[1]
|
||||||
# utxos from block 1 become mature in block 101
|
# utxos from block 1 become mature in block 101
|
||||||
rpc.generate(101)
|
if not self.options.noshutdown:
|
||||||
|
rpc.generate(101)
|
||||||
self.sync_all()
|
self.sync_all()
|
||||||
rpc.getinfo()
|
rpc.getinfo()
|
||||||
rpc1.getinfo()
|
rpc1.getinfo()
|
||||||
|
|||||||
@@ -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]
|
||||||
@@ -194,7 +129,8 @@ class CryptoconditionsRewardsTest(BitcoinTestFramework):
|
|||||||
rpc = self.nodes[0]
|
rpc = self.nodes[0]
|
||||||
rpc1 = self.nodes[1]
|
rpc1 = self.nodes[1]
|
||||||
# utxos from block 1 become mature in block 101
|
# utxos from block 1 become mature in block 101
|
||||||
rpc.generate(101)
|
if not self.options.noshutdown:
|
||||||
|
rpc.generate(101)
|
||||||
self.sync_all()
|
self.sync_all()
|
||||||
rpc.getinfo()
|
rpc.getinfo()
|
||||||
rpc1.getinfo()
|
rpc1.getinfo()
|
||||||
|
|||||||
@@ -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]
|
||||||
@@ -274,7 +209,8 @@ class CryptoconditionsTokenTest(BitcoinTestFramework):
|
|||||||
rpc = self.nodes[0]
|
rpc = self.nodes[0]
|
||||||
rpc1 = self.nodes[1]
|
rpc1 = self.nodes[1]
|
||||||
# utxos from block 1 become mature in block 101
|
# utxos from block 1 become mature in block 101
|
||||||
rpc.generate(101)
|
if not self.options.noshutdown:
|
||||||
|
rpc.generate(101)
|
||||||
self.sync_all()
|
self.sync_all()
|
||||||
rpc.getinfo()
|
rpc.getinfo()
|
||||||
rpc1.getinfo()
|
rpc1.getinfo()
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ echo $pubkey
|
|||||||
~/VerusCoin/src/komodod -pubkey=$pubkey -ac_name=VRSC -ac_algo=verushash -ac_cc=1 -ac_veruspos=50 -ac_supply=0 -ac_eras=3 -ac_reward=0,38400000000,2400000000 -ac_halving=1,43200,1051920 -ac_decay=100000000,0,0 -ac_end=10080,226080,0 -ac_timelockgte=19200000000 -ac_timeunlockfrom=129600 -ac_timeunlockto=1180800 -addnode=185.25.48.236 -addnode=185.64.105.111 &
|
~/VerusCoin/src/komodod -pubkey=$pubkey -ac_name=VRSC -ac_algo=verushash -ac_cc=1 -ac_veruspos=50 -ac_supply=0 -ac_eras=3 -ac_reward=0,38400000000,2400000000 -ac_halving=1,43200,1051920 -ac_decay=100000000,0,0 -ac_end=10080,226080,0 -ac_timelockgte=19200000000 -ac_timeunlockfrom=129600 -ac_timeunlockto=1180800 -addnode=185.25.48.236 -addnode=185.64.105.111 &
|
||||||
./komodod -pubkey=$pubkey -ac_name=SEC -ac_cc=333 -ac_supply=1000000000 -addnode=185.148.145.43 &
|
./komodod -pubkey=$pubkey -ac_name=SEC -ac_cc=333 -ac_supply=1000000000 -addnode=185.148.145.43 &
|
||||||
./komodod -pubkey=$pubkey -ac_name=CCL -ac_supply=200000000 -ac_end=1 -ac_cc=2 -addressindex=1 -spentindex=1 -addnode=142.93.136.89 -addnode=195.201.22.89 &
|
./komodod -pubkey=$pubkey -ac_name=CCL -ac_supply=200000000 -ac_end=1 -ac_cc=2 -addressindex=1 -spentindex=1 -addnode=142.93.136.89 -addnode=195.201.22.89 &
|
||||||
./komodod -pubkey=$pubkey -ac_name=PIRATE -ac_supply=0 -ac_reward=25600000000 -ac_halving=77777 -ac_private=1 -addnode=136.243.102.225 &
|
./komodod -pubkey=$pubkey -ac_name=PIRATE -ac_supply=0 -ac_reward=25600000000 -ac_halving=77777 -ac_private=1 -addnode=178.63.77.56 &
|
||||||
./komodod -pubkey=$pubkey -ac_name=MGNX -ac_supply=12465003 -ac_staked=90 -ac_reward=2000000000 -ac_halving=525960 -ac_cc=2 -ac_end=2629800 -addnode=142.93.27.180 &
|
./komodod -pubkey=$pubkey -ac_name=MGNX -ac_supply=12465003 -ac_staked=90 -ac_reward=2000000000 -ac_halving=525960 -ac_cc=2 -ac_end=2629800 -addnode=142.93.27.180 &
|
||||||
./komodod -pubkey=$pubkey -ac_name=PGT -ac_supply=10000000 -ac_end=1 -addnode=190.114.254.104 &
|
./komodod -pubkey=$pubkey -ac_name=PGT -ac_supply=10000000 -ac_end=1 -addnode=190.114.254.104 &
|
||||||
./komodod -pubkey=$pubkey -ac_name=KMDICE -ac_supply=10500000 -ac_reward=2500000000 -ac_halving=210000 -ac_cc=2 -addressindex=1 -spentindex=1 -addnode=144.76.217.232 &
|
./komodod -pubkey=$pubkey -ac_name=KMDICE -ac_supply=10500000 -ac_reward=2500000000 -ac_halving=210000 -ac_cc=2 -addressindex=1 -spentindex=1 -addnode=144.76.217.232 &
|
||||||
|
|||||||
@@ -670,6 +670,7 @@ int64_t find_onetime_amount(char *coinstr,char *coinaddr)
|
|||||||
coinaddr[0] = 0;
|
coinaddr[0] = 0;
|
||||||
if ( (array= get_listunspent(coinstr,"")) != 0 )
|
if ( (array= get_listunspent(coinstr,"")) != 0 )
|
||||||
{
|
{
|
||||||
|
//printf("got listunspent.(%s)\n",jprint(array,0));
|
||||||
if ( (n= cJSON_GetArraySize(array)) > 0 )
|
if ( (n= cJSON_GetArraySize(array)) > 0 )
|
||||||
{
|
{
|
||||||
for (i=0; i<n; i++)
|
for (i=0; i<n; i++)
|
||||||
@@ -734,6 +735,7 @@ int32_t z_sendmany(char *opidstr,char *coinstr,char *acname,char *srcaddr,char *
|
|||||||
cJSON *retjson; char *retstr,params[1024],addr[128];
|
cJSON *retjson; char *retstr,params[1024],addr[128];
|
||||||
sprintf(params,"'[{\"address\":\"%s\",\"amount\":%.8f}]'",destaddr,dstr(amount));
|
sprintf(params,"'[{\"address\":\"%s\",\"amount\":%.8f}]'",destaddr,dstr(amount));
|
||||||
sprintf(addr,"\"%s\"",srcaddr);
|
sprintf(addr,"\"%s\"",srcaddr);
|
||||||
|
printf("z_sendmany from.(%s) -> %s\n",srcaddr,params);
|
||||||
if ( (retjson= get_komodocli(coinstr,&retstr,acname,"z_sendmany",addr,params,"","")) != 0 )
|
if ( (retjson= get_komodocli(coinstr,&retstr,acname,"z_sendmany",addr,params,"","")) != 0 )
|
||||||
{
|
{
|
||||||
printf("unexpected json z_sendmany.(%s)\n",jprint(retjson,0));
|
printf("unexpected json z_sendmany.(%s)\n",jprint(retjson,0));
|
||||||
@@ -906,7 +908,7 @@ int32_t main(int32_t argc,char **argv)
|
|||||||
zsaddr = clonestr(argv[2]);
|
zsaddr = clonestr(argv[2]);
|
||||||
printf("%s: %s %s\n",REFCOIN_CLI,coinstr,zsaddr);
|
printf("%s: %s %s\n",REFCOIN_CLI,coinstr,zsaddr);
|
||||||
uint32_t lastopid; char coinaddr[64],zcaddr[128],opidstr[128]; int32_t finished; int64_t amount,stdamount,txfee;
|
uint32_t lastopid; char coinaddr[64],zcaddr[128],opidstr[128]; int32_t finished; int64_t amount,stdamount,txfee;
|
||||||
stdamount = 1000 * SATOSHIDEN;
|
//stdamount = 500 * SATOSHIDEN;
|
||||||
txfee = 10000;
|
txfee = 10000;
|
||||||
again:
|
again:
|
||||||
printf("start processing zmigrate\n");
|
printf("start processing zmigrate\n");
|
||||||
@@ -916,7 +918,7 @@ again:
|
|||||||
{
|
{
|
||||||
if ( have_pending_opid(coinstr,0) != 0 )
|
if ( have_pending_opid(coinstr,0) != 0 )
|
||||||
{
|
{
|
||||||
sleep(60);
|
sleep(10);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ( (amount= find_onetime_amount(coinstr,coinaddr)) > txfee )
|
if ( (amount= find_onetime_amount(coinstr,coinaddr)) > txfee )
|
||||||
@@ -930,6 +932,18 @@ again:
|
|||||||
if ( (amount= find_sprout_amount(coinstr,zcaddr)) > txfee )
|
if ( (amount= find_sprout_amount(coinstr,zcaddr)) > txfee )
|
||||||
{
|
{
|
||||||
// generate taddr, send max of 10000.0001
|
// generate taddr, send max of 10000.0001
|
||||||
|
static int64_t lastamount,lastamount2,lastamount3,lastamount4;
|
||||||
|
stdamount = 500 * SATOSHIDEN;
|
||||||
|
if ( amount == lastamount && amount == lastamount2 )
|
||||||
|
{
|
||||||
|
stdamount /= 10;
|
||||||
|
if ( amount == lastamount3 && amount == lastamount4 )
|
||||||
|
stdamount /= 5;
|
||||||
|
}
|
||||||
|
lastamount4 = lastamount3;
|
||||||
|
lastamount3 = lastamount2;
|
||||||
|
lastamount2 = lastamount;
|
||||||
|
lastamount = amount;
|
||||||
if ( amount > stdamount+txfee )
|
if ( amount > stdamount+txfee )
|
||||||
amount = stdamount + txfee;
|
amount = stdamount + txfee;
|
||||||
if ( getnewaddress(coinaddr,coinstr,"") == 0 )
|
if ( getnewaddress(coinaddr,coinstr,"") == 0 )
|
||||||
@@ -937,7 +951,7 @@ again:
|
|||||||
z_sendmany(opidstr,coinstr,"",zcaddr,coinaddr,amount-txfee);
|
z_sendmany(opidstr,coinstr,"",zcaddr,coinaddr,amount-txfee);
|
||||||
lastopid = (uint32_t)time(NULL);
|
lastopid = (uint32_t)time(NULL);
|
||||||
} else printf("couldnt getnewaddress!\n");
|
} else printf("couldnt getnewaddress!\n");
|
||||||
sleep(30);
|
sleep(3);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ( time(NULL) > lastopid+600 )
|
if ( time(NULL) > lastopid+600 )
|
||||||
|
|||||||
@@ -1538,7 +1538,7 @@ uint16_t komodo_port(char *symbol,uint64_t supply,uint32_t *magicp,uint8_t *extr
|
|||||||
printf("ports\n");
|
printf("ports\n");
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
char *iguanafmtstr = (char *)"curl --url \"http://127.0.0.1:7776\" --data \"{\\\"conf\\\":\\\"%s.conf\\\",\\\"path\\\":\\\"${HOME#\"/\"}/.komodo/%s\\\",\\\"unitval\\\":\\\"20\\\",\\\"zcash\\\":1,\\\"RELAY\\\":-1,\\\"VALIDATE\\\":0,\\\"prefetchlag\\\":-1,\\\"poll\\\":100,\\\"active\\\":1,\\\"agent\\\":\\\"iguana\\\",\\\"method\\\":\\\"addcoin\\\",\\\"startpend\\\":4,\\\"endpend\\\":4,\\\"services\\\":129,\\\"maxpeers\\\":8,\\\"newcoin\\\":\\\"%s\\\",\\\"name\\\":\\\"%s\\\",\\\"hasheaders\\\":1,\\\"useaddmultisig\\\":0,\\\"netmagic\\\":\\\"%s\\\",\\\"p2p\\\":%u,\\\"rpc\\\":%u,\\\"pubval\\\":60,\\\"p2shval\\\":85,\\\"wifval\\\":188,\\\"txfee_satoshis\\\":\\\"10000\\\",\\\"isPoS\\\":0,\\\"minoutput\\\":10000,\\\"minconfirms\\\":2,\\\"genesishash\\\":\\\"027e3758c3a65b12aa1046462b486d0a63bfa1beae327897f56c5cfb7daaae71\\\",\\\"protover\\\":170002,\\\"genesisblock\\\":\\\"0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a000000000000000000000000000000000000000000000000000000000000000029ab5f490f0f0f200b00000000000000000000000000000000000000000000000000000000000000fd4005000d5ba7cda5d473947263bf194285317179d2b0d307119c2e7cc4bd8ac456f0774bd52b0cd9249be9d40718b6397a4c7bbd8f2b3272fed2823cd2af4bd1632200ba4bf796727d6347b225f670f292343274cc35099466f5fb5f0cd1c105121b28213d15db2ed7bdba490b4cedc69742a57b7c25af24485e523aadbb77a0144fc76f79ef73bd8530d42b9f3b9bed1c135ad1fe152923fafe98f95f76f1615e64c4abb1137f4c31b218ba2782bc15534788dda2cc08a0ee2987c8b27ff41bd4e31cd5fb5643dfe862c9a02ca9f90c8c51a6671d681d04ad47e4b53b1518d4befafefe8cadfb912f3d03051b1efbf1dfe37b56e93a741d8dfd80d576ca250bee55fab1311fc7b3255977558cdda6f7d6f875306e43a14413facdaed2f46093e0ef1e8f8a963e1632dcbeebd8e49fd16b57d49b08f9762de89157c65233f60c8e38a1f503a48c555f8ec45dedecd574a37601323c27be597b956343107f8bd80f3a925afaf30811df83c402116bb9c1e5231c70fff899a7c82f73c902ba54da53cc459b7bf1113db65cc8f6914d3618560ea69abd13658fa7b6af92d374d6eca9529f8bd565166e4fcbf2a8dfb3c9b69539d4d2ee2e9321b85b331925df195915f2757637c2805e1d4131e1ad9ef9bc1bb1c732d8dba4738716d351ab30c996c8657bab39567ee3b29c6d054b711495c0d52e1cd5d8e55b4f0f0325b97369280755b46a02afd54be4ddd9f77c22272b8bbb17ff5118fedbae2564524e797bd28b5f74f7079d532ccc059807989f94d267f47e724b3f1ecfe00ec9e6541c961080d8891251b84b4480bc292f6a180bea089fef5bbda56e1e41390d7c0e85ba0ef530f7177413481a226465a36ef6afe1e2bca69d2078712b3912bba1a99b1fbff0d355d6ffe726d2bb6fbc103c4ac5756e5bee6e47e17424ebcbf1b63d8cb90ce2e40198b4f4198689daea254307e52a25562f4c1455340f0ffeb10f9d8e914775e37d0edca019fb1b9c6ef81255ed86bc51c5391e0591480f66e2d88c5f4fd7277697968656a9b113ab97f874fdd5f2465e5559533e01ba13ef4a8f7a21d02c30c8ded68e8c54603ab9c8084ef6d9eb4e92c75b078539e2ae786ebab6dab73a09e0aa9ac575bcefb29e930ae656e58bcb513f7e3c17e079dce4f05b5dbc18c2a872b22509740ebe6a3903e00ad1abc55076441862643f93606e3dc35e8d9f2caef3ee6be14d513b2e062b21d0061de3bd56881713a1a5c17f5ace05e1ec09da53f99442df175a49bd154aa96e4949decd52fed79ccf7ccbce32941419c314e374e4a396ac553e17b5340336a1a25c22f9e42a243ba5404450b650acfc826a6e432971ace776e15719515e1634ceb9a4a35061b668c74998d3dfb5827f6238ec015377e6f9c94f38108768cf6e5c8b132e0303fb5a200368f845ad9d46343035a6ff94031df8d8309415bb3f6cd5ede9c135fdabcc030599858d803c0f85be7661c88984d88faa3d26fb0e9aac0056a53f1b5d0baed713c853c4a2726869a0a124a8a5bbc0fc0ef80c8ae4cb53636aa02503b86a1eb9836fcc259823e2692d921d88e1ffc1e6cb2bde43939ceb3f32a611686f539f8f7c9f0bf00381f743607d40960f06d347d1cd8ac8a51969c25e37150efdf7aa4c2037a2fd0516fb444525ab157a0ed0a7412b2fa69b217fe397263153782c0f64351fbdf2678fa0dc8569912dcd8e3ccad38f34f23bbbce14c6a26ac24911b308b82c7e43062d180baeac4ba7153858365c72c63dcf5f6a5b08070b730adb017aeae925b7d0439979e2679f45ed2f25a7edcfd2fb77a8794630285ccb0a071f5cce410b46dbf9750b0354aae8b65574501cc69efb5b6a43444074fee116641bb29da56c2b4a7f456991fc92b2\\\",\\\"debug\\\":0,\\\"seedipaddr\\\":\\\"%s\\\"}\"";
|
char *iguanafmtstr = (char *)"curl --url \"http://127.0.0.1:7776\" --data \"{\\\"conf\\\":\\\"%s.conf\\\",\\\"path\\\":\\\"${HOME#\"/\"}/.komodo/%s\\\",\\\"unitval\\\":\\\"20\\\",\\\"zcash\\\":1,\\\"RELAY\\\":-1,\\\"VALIDATE\\\":0,\\\"prefetchlag\\\":-1,\\\"poll\\\":100,\\\"active\\\":1,\\\"sapling\\\":1,\\\"agent\\\":\\\"iguana\\\",\\\"method\\\":\\\"addcoin\\\",\\\"startpend\\\":4,\\\"endpend\\\":4,\\\"services\\\":129,\\\"maxpeers\\\":8,\\\"newcoin\\\":\\\"%s\\\",\\\"name\\\":\\\"%s\\\",\\\"hasheaders\\\":1,\\\"useaddmultisig\\\":0,\\\"netmagic\\\":\\\"%s\\\",\\\"p2p\\\":%u,\\\"rpc\\\":%u,\\\"pubval\\\":60,\\\"p2shval\\\":85,\\\"wifval\\\":188,\\\"txfee_satoshis\\\":\\\"10000\\\",\\\"isPoS\\\":0,\\\"minoutput\\\":10000,\\\"minconfirms\\\":2,\\\"genesishash\\\":\\\"027e3758c3a65b12aa1046462b486d0a63bfa1beae327897f56c5cfb7daaae71\\\",\\\"protover\\\":170002,\\\"genesisblock\\\":\\\"0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a000000000000000000000000000000000000000000000000000000000000000029ab5f490f0f0f200b00000000000000000000000000000000000000000000000000000000000000fd4005000d5ba7cda5d473947263bf194285317179d2b0d307119c2e7cc4bd8ac456f0774bd52b0cd9249be9d40718b6397a4c7bbd8f2b3272fed2823cd2af4bd1632200ba4bf796727d6347b225f670f292343274cc35099466f5fb5f0cd1c105121b28213d15db2ed7bdba490b4cedc69742a57b7c25af24485e523aadbb77a0144fc76f79ef73bd8530d42b9f3b9bed1c135ad1fe152923fafe98f95f76f1615e64c4abb1137f4c31b218ba2782bc15534788dda2cc08a0ee2987c8b27ff41bd4e31cd5fb5643dfe862c9a02ca9f90c8c51a6671d681d04ad47e4b53b1518d4befafefe8cadfb912f3d03051b1efbf1dfe37b56e93a741d8dfd80d576ca250bee55fab1311fc7b3255977558cdda6f7d6f875306e43a14413facdaed2f46093e0ef1e8f8a963e1632dcbeebd8e49fd16b57d49b08f9762de89157c65233f60c8e38a1f503a48c555f8ec45dedecd574a37601323c27be597b956343107f8bd80f3a925afaf30811df83c402116bb9c1e5231c70fff899a7c82f73c902ba54da53cc459b7bf1113db65cc8f6914d3618560ea69abd13658fa7b6af92d374d6eca9529f8bd565166e4fcbf2a8dfb3c9b69539d4d2ee2e9321b85b331925df195915f2757637c2805e1d4131e1ad9ef9bc1bb1c732d8dba4738716d351ab30c996c8657bab39567ee3b29c6d054b711495c0d52e1cd5d8e55b4f0f0325b97369280755b46a02afd54be4ddd9f77c22272b8bbb17ff5118fedbae2564524e797bd28b5f74f7079d532ccc059807989f94d267f47e724b3f1ecfe00ec9e6541c961080d8891251b84b4480bc292f6a180bea089fef5bbda56e1e41390d7c0e85ba0ef530f7177413481a226465a36ef6afe1e2bca69d2078712b3912bba1a99b1fbff0d355d6ffe726d2bb6fbc103c4ac5756e5bee6e47e17424ebcbf1b63d8cb90ce2e40198b4f4198689daea254307e52a25562f4c1455340f0ffeb10f9d8e914775e37d0edca019fb1b9c6ef81255ed86bc51c5391e0591480f66e2d88c5f4fd7277697968656a9b113ab97f874fdd5f2465e5559533e01ba13ef4a8f7a21d02c30c8ded68e8c54603ab9c8084ef6d9eb4e92c75b078539e2ae786ebab6dab73a09e0aa9ac575bcefb29e930ae656e58bcb513f7e3c17e079dce4f05b5dbc18c2a872b22509740ebe6a3903e00ad1abc55076441862643f93606e3dc35e8d9f2caef3ee6be14d513b2e062b21d0061de3bd56881713a1a5c17f5ace05e1ec09da53f99442df175a49bd154aa96e4949decd52fed79ccf7ccbce32941419c314e374e4a396ac553e17b5340336a1a25c22f9e42a243ba5404450b650acfc826a6e432971ace776e15719515e1634ceb9a4a35061b668c74998d3dfb5827f6238ec015377e6f9c94f38108768cf6e5c8b132e0303fb5a200368f845ad9d46343035a6ff94031df8d8309415bb3f6cd5ede9c135fdabcc030599858d803c0f85be7661c88984d88faa3d26fb0e9aac0056a53f1b5d0baed713c853c4a2726869a0a124a8a5bbc0fc0ef80c8ae4cb53636aa02503b86a1eb9836fcc259823e2692d921d88e1ffc1e6cb2bde43939ceb3f32a611686f539f8f7c9f0bf00381f743607d40960f06d347d1cd8ac8a51969c25e37150efdf7aa4c2037a2fd0516fb444525ab157a0ed0a7412b2fa69b217fe397263153782c0f64351fbdf2678fa0dc8569912dcd8e3ccad38f34f23bbbce14c6a26ac24911b308b82c7e43062d180baeac4ba7153858365c72c63dcf5f6a5b08070b730adb017aeae925b7d0439979e2679f45ed2f25a7edcfd2fb77a8794630285ccb0a071f5cce410b46dbf9750b0354aae8b65574501cc69efb5b6a43444074fee116641bb29da56c2b4a7f456991fc92b2\\\",\\\"debug\\\":0,\\\"seedipaddr\\\":\\\"%s\\\"}\"";
|
||||||
|
|
||||||
|
|
||||||
int32_t komodo_whoami(char *pubkeystr,int32_t height,uint32_t timestamp)
|
int32_t komodo_whoami(char *pubkeystr,int32_t height,uint32_t timestamp)
|
||||||
|
|||||||
48
src/main.cpp
48
src/main.cpp
@@ -1020,10 +1020,9 @@ bool ContextualCheckTransaction(
|
|||||||
|
|
||||||
// If Sprout rules apply, reject transactions which are intended for Overwinter and beyond
|
// If Sprout rules apply, reject transactions which are intended for Overwinter and beyond
|
||||||
if (isSprout && tx.fOverwintered) {
|
if (isSprout && tx.fOverwintered) {
|
||||||
return state.DoS(isInitBlockDownload() ? 0 : dosLevel,
|
int32_t ht = Params().GetConsensus().vUpgrades[Consensus::UPGRADE_OVERWINTER].nActivationHeight;
|
||||||
error("ContextualCheckTransaction(): ht.%d activates.%d dosLevel.%d overwinter is not active yet",
|
return state.DoS((ht < 0 || nHeight < ht) ? 0 : dosLevel,error("ContextualCheckTransaction(): ht.%d activates.%d dosLevel.%d overwinter is not active yet",nHeight, Params().GetConsensus().vUpgrades[Consensus::UPGRADE_OVERWINTER].nActivationHeight, dosLevel),REJECT_INVALID, "tx-overwinter-not-active");
|
||||||
nHeight, Params().GetConsensus().vUpgrades[Consensus::UPGRADE_OVERWINTER].nActivationHeight, dosLevel),
|
//return state.DoS(isInitBlockDownload() ? 0 : dosLevel,error("ContextualCheckTransaction(): ht.%d activates.%d dosLevel.%d overwinter is not active yet",nHeight, Params().GetConsensus().vUpgrades[Consensus::UPGRADE_OVERWINTER].nActivationHeight, dosLevel),REJECT_INVALID, "tx-overwinter-not-active");
|
||||||
REJECT_INVALID, "tx-overwinter-not-active");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (saplingActive) {
|
if (saplingActive) {
|
||||||
@@ -1080,8 +1079,8 @@ bool ContextualCheckTransaction(
|
|||||||
if (overwinterActive) {
|
if (overwinterActive) {
|
||||||
// Reject transactions intended for Sprout
|
// Reject transactions intended for Sprout
|
||||||
if (!tx.fOverwintered) {
|
if (!tx.fOverwintered) {
|
||||||
return state.DoS(dosLevel, error("ContextualCheckTransaction: overwinter is active"),
|
int32_t ht = Params().GetConsensus().vUpgrades[Consensus::UPGRADE_OVERWINTER].nActivationHeight;
|
||||||
REJECT_INVALID, "tx-overwinter-active");
|
return state.DoS((ht < 0 || nHeight < ht) ? 0 : dosLevel, error("ContextualCheckTransaction: overwinter is active"),REJECT_INVALID, "tx-overwinter-active");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check that all transactions are unexpired
|
// Check that all transactions are unexpired
|
||||||
@@ -1447,7 +1446,7 @@ bool CheckTransactionWithoutProofVerification(uint32_t tiptime,const CTransactio
|
|||||||
{
|
{
|
||||||
static uint32_t counter;
|
static uint32_t counter;
|
||||||
if ( counter++ < 10 )
|
if ( counter++ < 10 )
|
||||||
fprintf(stderr,"found taddr in private chain: z_z.%d z_t.%d t_z.%d\n",z_z,z_t,t_z);
|
fprintf(stderr,"found taddr in private chain: z_z.%d z_t.%d t_z.%d vinsize.%d\n",z_z,z_t,t_z,(int32_t)tx.vin.size());
|
||||||
if ( z_t == 0 || z_z != 0 || t_z != 0 || tx.vin.size() != 0 )
|
if ( z_t == 0 || z_z != 0 || t_z != 0 || tx.vin.size() != 0 )
|
||||||
return state.DoS(100, error("CheckTransaction(): this is a private chain, only sprout -> taddr allowed until deadline"),REJECT_INVALID, "bad-txns-acprivacy-chain");
|
return state.DoS(100, error("CheckTransaction(): this is a private chain, only sprout -> taddr allowed until deadline"),REJECT_INVALID, "bad-txns-acprivacy-chain");
|
||||||
}
|
}
|
||||||
@@ -3879,9 +3878,7 @@ int32_t komodo_activate_sapling(CBlockIndex *pindex)
|
|||||||
}
|
}
|
||||||
if ( activation != 0 )
|
if ( activation != 0 )
|
||||||
{
|
{
|
||||||
//#if KOMODO_SAPLING_ACTIVATION != 1544832000
|
|
||||||
komodo_setactivation(activation);
|
komodo_setactivation(activation);
|
||||||
//#endif
|
|
||||||
fprintf(stderr,"%s sapling activation at %d\n",ASSETCHAINS_SYMBOL,activation);
|
fprintf(stderr,"%s sapling activation at %d\n",ASSETCHAINS_SYMBOL,activation);
|
||||||
ASSETCHAINS_SAPLING = activation;
|
ASSETCHAINS_SAPLING = activation;
|
||||||
}
|
}
|
||||||
@@ -4680,7 +4677,8 @@ bool CheckBlock(int32_t *futureblockp,int32_t height,CBlockIndex *pindex,const C
|
|||||||
int32_t i,j,rejects=0,lastrejects=0;
|
int32_t i,j,rejects=0,lastrejects=0;
|
||||||
//fprintf(stderr,"put block's tx into mempool\n");
|
//fprintf(stderr,"put block's tx into mempool\n");
|
||||||
// Copy all non Z-txs in mempool to temporary mempool because there can be tx in local mempool that make the block invalid.
|
// Copy all non Z-txs in mempool to temporary mempool because there can be tx in local mempool that make the block invalid.
|
||||||
LOCK(mempool.cs);
|
LOCK2(cs_main,mempool.cs);
|
||||||
|
//fprintf(stderr, "starting... mempoolsize.%ld\n",mempool.size());
|
||||||
list<CTransaction> transactionsToRemove;
|
list<CTransaction> transactionsToRemove;
|
||||||
BOOST_FOREACH(const CTxMemPoolEntry& e, mempool.mapTx) {
|
BOOST_FOREACH(const CTxMemPoolEntry& e, mempool.mapTx) {
|
||||||
const CTransaction &tx = e.GetTx();
|
const CTransaction &tx = e.GetTx();
|
||||||
@@ -4698,6 +4696,7 @@ bool CheckBlock(int32_t *futureblockp,int32_t height,CBlockIndex *pindex,const C
|
|||||||
// CC validation shouldnt (cant) depend on the state of mempool!
|
// CC validation shouldnt (cant) depend on the state of mempool!
|
||||||
while ( 1 )
|
while ( 1 )
|
||||||
{
|
{
|
||||||
|
list<CTransaction> removed;
|
||||||
for (i=0; i<block.vtx.size(); i++)
|
for (i=0; i<block.vtx.size(); i++)
|
||||||
{
|
{
|
||||||
CValidationState state;
|
CValidationState state;
|
||||||
@@ -4717,7 +4716,10 @@ bool CheckBlock(int32_t *futureblockp,int32_t height,CBlockIndex *pindex,const C
|
|||||||
ptx = &sTx;
|
ptx = &sTx;
|
||||||
} else rejects++;
|
} else rejects++;
|
||||||
}
|
}
|
||||||
|
// here we remove any txs in the temp mempool that were included in the block.
|
||||||
|
tmpmempool.remove(tx, removed, false);
|
||||||
}
|
}
|
||||||
|
//fprintf(stderr, "removed.%ld\n",removed.size());
|
||||||
if ( rejects == 0 || rejects == lastrejects )
|
if ( rejects == 0 || rejects == lastrejects )
|
||||||
{
|
{
|
||||||
if ( 0 && lastrejects != 0 )
|
if ( 0 && lastrejects != 0 )
|
||||||
@@ -4764,29 +4766,15 @@ bool CheckBlock(int32_t *futureblockp,int32_t height,CBlockIndex *pindex,const C
|
|||||||
if ( ASSETCHAINS_CC != 0 )
|
if ( ASSETCHAINS_CC != 0 )
|
||||||
{
|
{
|
||||||
// here we add back all txs from the temp mempool to the main mempool.
|
// here we add back all txs from the temp mempool to the main mempool.
|
||||||
// which removes any tx locally that were invalid after the block arrives.
|
BOOST_FOREACH(const CTxMemPoolEntry& e, tmpmempool.mapTx)
|
||||||
int numadded,numiters = 0;
|
|
||||||
CValidationState state; bool fMissingInputs,fOverrideFees = false;
|
|
||||||
list<CTransaction> removed;
|
|
||||||
LOCK(mempool.cs);
|
|
||||||
while ( 1 )
|
|
||||||
{
|
{
|
||||||
numiters++;
|
const CTransaction &tx = e.GetTx();
|
||||||
numadded = 0;
|
const uint256 &hash = tx.GetHash();
|
||||||
BOOST_FOREACH(const CTxMemPoolEntry& e, tmpmempool.mapTx)
|
if ( tx.vjoinsplit.size() == 0 ) {
|
||||||
{
|
mempool.addUnchecked(hash,e,true);
|
||||||
CTransaction tx = e.GetTx();
|
|
||||||
if (AcceptToMemoryPool(mempool, state, tx, false, &fMissingInputs, !fOverrideFees) == true )
|
|
||||||
{
|
|
||||||
numadded++;
|
|
||||||
tmpmempool.remove(tx, removed, false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if ( numadded == 0 )
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
if ( 0 && numadded > 0 )
|
//fprintf(stderr, "finished adding back. mempoolsize.%ld\n",mempool.size());
|
||||||
fprintf(stderr, "CC mempool add: numiters.%d numadded.%d remains.%d\n",numiters,numadded,(int32_t)tmpmempool.size());
|
|
||||||
// empty the temp mempool for next time.
|
// empty the temp mempool for next time.
|
||||||
tmpmempool.clear();
|
tmpmempool.clear();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user