forked from dtr-org/unit-e
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproposer_settings.py
More file actions
executable file
·38 lines (27 loc) · 1.5 KB
/
Copy pathproposer_settings.py
File metadata and controls
executable file
·38 lines (27 loc) · 1.5 KB
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
#!/usr/bin/env python3
# Copyright (c) 2018-2019 The Unit-e developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.util import assert_equal, wait_until
from test_framework.test_framework import UnitETestFramework
class ProposerSettingsTest(UnitETestFramework):
""" This test checks the node proposing status depending on the '-proposing' flag."""
def set_test_params(self):
self.num_nodes = 3
self.extra_args = [['-wallet=xanadu', '-proposing=0'], [], ['-proposing=1']]
self.setup_clean_chain = True
def run_test(self):
self.setup_stake_coins(*self.nodes)
# If we pass -proposing=0 then the node should not propose
status = self.nodes[0].proposerstatus()['wallets']
assert_equal(status[0]['status'], 'NOT_PROPOSING')
assert_equal(status[0]['wallet'], 'xanadu')
# If we don't pass -proposing then the node should not propose because of the default in regtest
assert_equal(self.nodes[1].proposerstatus()['wallets'][0]['status'], 'NOT_PROPOSING')
# Leave IBD
self.nodes[0].proposetoaddress(1, self.nodes[2].getnewaddress("", "legacy"))
# If we pass -proposing=1 then the node should propose
wait_until(lambda: self.nodes[2].proposerstatus()['wallets'][0]['status'] == "IS_PROPOSING", timeout=150)
print("Test succeeded.")
if __name__ == '__main__':
ProposerSettingsTest().main()