Skip to content

Commit 8eb9741

Browse files
committed
Mine oracles creation in separate blocks
better mine method exception handling
1 parent ba5b78a commit 8eb9741

File tree

6 files changed

+23
-27
lines changed

6 files changed

+23
-27
lines changed

qa/pytest_komodo/basic/pytest_util.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import time
22
import jsonschema
33
import os
4-
if os.name == 'posix':
4+
try:
55
from slickrpc import Proxy
66
from slickrpc.exc import RpcException as RPCError
7-
else:
7+
from pycurl import error as HttpError
8+
except ImportError:
89
from bitcoinrpc.authproxy import AuthServiceProxy as Proxy
910
from bitcoinrpc.authproxy import JSONRPCException as RPCError
11+
from http.client import HTTPException as HttpError
1012

1113

1214
def create_proxy(node_params_dictionary):
@@ -54,7 +56,7 @@ def enable_mining(proxy):
5456
try:
5557
proxy.setgenerate(True, threads_count)
5658
break
57-
except RPCError as e:
59+
except (RPCError, HttpError) as e:
5860
print(e, " Waiting chain startup\n")
5961
time.sleep(10)
6062
tries += 1

qa/pytest_komodo/cc_modules/test_channels.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def test_channels(test_params):
115115
assert result == 200000
116116

117117
result = rpc1.validateaddress(raw_transaction["vout"][3]["scriptPubKey"]["addresses"][0])["ismine"]
118-
assert result == True
118+
assert result
119119

120120
# have to check that second node have coins to cover txfee at least
121121
rpc.sendtoaddress(rpc1.getnewaddress(), 1)
@@ -163,7 +163,7 @@ def test_channels(test_params):
163163
assert result == 700000
164164

165165
result = rpc.validateaddress(raw_transaction["vout"][2]["scriptPubKey"]["addresses"][0])["ismine"]
166-
assert result == True
166+
assert result
167167

168168
# creating and draining channel (10 payment by 100000 satoshies in total to fit full capacity)
169169
new_channel_hex1 = rpc.channelsopen(pubkey1, "10", "100000")
@@ -218,8 +218,8 @@ def test_channels(test_params):
218218
# try:
219219
# rpc1.channelsinfo(channel2_txid)["Transactions"][1]["Secret"]
220220
# except Exception:
221-
# secret_not_revealed = True
222-
# assert secret_not_revealed == True
221+
# secret_not_revealed
222+
# assert secret_not_revealed
223223
#
224224
# # trying to initiate payment from second node with revealed secret
225225
# assert rpc1.getinfo()["connections"] == 0

qa/pytest_komodo/cc_modules/test_rewards.py

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
import pytest
77
import json
8-
98
from util import assert_success, assert_error, check_if_mined, send_and_mine,\
109
rpc_connect, wait_some_blocks, generate_random_string, komodo_teardown
1110

qa/pytest_komodo/cc_modules/util.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import pytest
22
import time
33
import sys
4-
import os
54
from random import choice
65
from string import ascii_uppercase
7-
if os.name == 'posix':
6+
try:
87
from slickrpc import Proxy
9-
else:
8+
except ImportError:
109
from bitcoinrpc.authproxy import AuthServiceProxy as Proxy
1110

1211

qa/pytest_komodo/chainconfig.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"rpc_user": "test",
55
"rpcpassword": "test",
66
"rpcallowip": "0.0.0.0/0",
7-
"rpcport": "7000",
7+
"rpcport": 7000,
8+
"port": 6000,
89
"rpcbind": "0.0.0.0",
910
"ac_reward": "100000000000",
1011
"ac_supply": "10000000000",

qa/pytest_komodo/chainstart.py

+10-15
Original file line numberDiff line numberDiff line change
@@ -99,25 +99,20 @@ def main():
9999
cl_args = [ac_params.get('binary_path'),
100100
'-ac_name=' + aschain,
101101
'-conf=' + confpath,
102-
'-rpcport=' + str(7000 + i),
103-
'-port=' + str(6000 + i),
104102
'-datadir=' + datapath,
105103
'-pubkey=' + env_params.get('test_pubkey')[i],
106104
]
107-
if i > 0:
108-
cl_args.append('-addnode=127.0.0.1:6000')
109-
if ac_params.get('ac_reward'):
110-
cl_args.append('-ac_reward=' + ac_params.get('ac_reward'))
105+
if i == 0:
106+
for key in ac_params.keys():
107+
cl_args.append('-' + key + '=' + str(ac_params.get(key)))
111108
else:
112-
cl_args.append('-ac_reward=100000000000')
113-
if ac_params.get('ac_supply'):
114-
cl_args.append('-ac_supply=' + ac_params.get('ac_supply'))
115-
else:
116-
cl_args.append('-ac_supply=10000000000')
117-
if ac_params.get('ac_cc'):
118-
cl_args.append('-ac_cc=' + ac_params.get('ac_cc'))
119-
else:
120-
cl_args.append('-ac_cc=2')
109+
cl_args.append('-addnode=127.0.0.1:' + str(ac_params.get('port')))
110+
for key in ac_params.keys():
111+
if isinstance(ac_params.get(key), int):
112+
data = ac_params.get(key) + 1
113+
cl_args.append('-' + key + '=' + str(data))
114+
else:
115+
cl_args.append('-' + key + '=' + str(ac_params.get(key)))
121116
cl_args.extend(ac_params.get('daemon_params'))
122117
print(cl_args)
123118
if os.name == "posix":

0 commit comments

Comments
 (0)