-
Notifications
You must be signed in to change notification settings - Fork 1
/
link_nodes_x.py
60 lines (54 loc) · 2.55 KB
/
link_nodes_x.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import time
import json
from libs import actions, tools, loger, check
log = loger.create_loger(__name__)
if __name__ == '__main__':
log.info('Start ' + __name__)
wait = tools.read_config('test')['wait_tx_status']
conf = tools.read_config('nodes')
url = conf[0]['url']
pr_key1 = conf[0]['private_key']
pr_key2 = conf[1]['private_key']
pr_key3 = conf[2]['private_key']
data = actions.login(url, pr_key1, 0)
token1 = data['jwtToken']
actions.imp_app('system', url, pr_key1, token1, data['account'])
actions.imp_app('lang_res', url, pr_key1, token1, data['account'])
actions.imp_app('conditions', url, pr_key1, token1, data['account'])
actions.imp_app('companies_registry', url, pr_key1, token1, data['account'])
full_nodes = json.dumps([{'tcp_address': conf[0]['tcp_address'],
'api_address': conf[0]['api_address'],
'key_id': conf[0]['keyID'],
'public_key': conf[0]['pubKey']}, {'tcp_address': conf[1]['tcp_address'],
'api_address': conf[1]['api_address'],
'key_id': conf[1]['keyID'],
'public_key': conf[1]['pubKey']}, {'tcp_address': conf[2]['tcp_address'],
'api_address': conf[2]['api_address'],
'key_id': conf[2]['keyID'],
'public_key': conf[2]['pubKey']}])
print("Strt update full_nodes")
data = {'Name': 'full_nodes', 'Value': full_nodes}
res = actions.call_contract(url, pr_key1, 'UpdateSysParam', data, token1)
if check.is_tx_in_block(url, wait, {'hash': res}, token1):
log.info('Nodes successfully linked')
else:
log.error('Nodes is not linked')
exit(1)
data = {'Name': 'max_block_generation_time', 'Value': '10000'}
res = actions.call_contract(url, pr_key1, 'UpdateSysParam', data, token1)
check.is_tx_in_block(url, wait, {'hash': res}, token1)
call_dep = actions.call_contract(url, pr_key1, 'Deploy',
{}, token1)
if check.is_tx_in_block(url, wait, {'hash': call_dep}, token1):
log.info('X_reg successfully deployed')
else:
log.error('X_reg is not deployed')
exit(1)
data = {'Name': 'max_block_generation_time', 'Value': '2000'}
res = actions.call_contract(url, pr_key1, 'UpdateSysParam', data, token1)
if check.is_tx_in_block(url, wait, {'hash': res}, token1):
log.info('Limits are returned')
exit(0)
else:
log.error('Limits arent returned')
exit(1)