Skip to content

Commit ccd98ea

Browse files
committed
test: cleanup rpc_getchaintips.py
Remove whitespace that doesn't conform with pep8 and turn some comments into log messages.
1 parent f5149dd commit ccd98ea

File tree

1 file changed

+20
-19
lines changed

1 file changed

+20
-19
lines changed

test/functional/rpc_getchaintips.py

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,44 +18,45 @@ def set_test_params(self):
1818
self.num_nodes = 4
1919

2020
def run_test(self):
21+
self.log.info("Test getchaintips behavior with two chains of different length")
2122
tips = self.nodes[0].getchaintips()
2223
assert_equal(len(tips), 1)
2324
assert_equal(tips[0]['branchlen'], 0)
2425
assert_equal(tips[0]['height'], 200)
2526
assert_equal(tips[0]['status'], 'active')
2627

27-
# Split the network and build two chains of different lengths.
28+
self.log.info("Split the network and build two chains of different lengths.")
2829
self.split_network()
2930
self.generate(self.nodes[0], 10, sync_fun=lambda: self.sync_all(self.nodes[:2]))
3031
self.generate(self.nodes[2], 20, sync_fun=lambda: self.sync_all(self.nodes[2:]))
3132

32-
tips = self.nodes[1].getchaintips ()
33-
assert_equal (len (tips), 1)
33+
tips = self.nodes[1].getchaintips()
34+
assert_equal(len(tips), 1)
3435
shortTip = tips[0]
35-
assert_equal (shortTip['branchlen'], 0)
36-
assert_equal (shortTip['height'], 210)
37-
assert_equal (tips[0]['status'], 'active')
36+
assert_equal(shortTip['branchlen'], 0)
37+
assert_equal(shortTip['height'], 210)
38+
assert_equal(tips[0]['status'], 'active')
3839

39-
tips = self.nodes[3].getchaintips ()
40-
assert_equal (len (tips), 1)
40+
tips = self.nodes[3].getchaintips()
41+
assert_equal(len(tips), 1)
4142
longTip = tips[0]
42-
assert_equal (longTip['branchlen'], 0)
43-
assert_equal (longTip['height'], 220)
44-
assert_equal (tips[0]['status'], 'active')
43+
assert_equal(longTip['branchlen'], 0)
44+
assert_equal(longTip['height'], 220)
45+
assert_equal(tips[0]['status'], 'active')
4546

46-
# Join the network halves and check that we now have two tips
47+
self.log.info("Join the network halves and check that we now have two tips")
4748
# (at least at the nodes that previously had the short chain).
48-
self.join_network ()
49+
self.join_network()
4950

50-
tips = self.nodes[0].getchaintips ()
51-
assert_equal (len (tips), 2)
52-
assert_equal (tips[0], longTip)
51+
tips = self.nodes[0].getchaintips()
52+
assert_equal(len(tips), 2)
53+
assert_equal(tips[0], longTip)
5354

54-
assert_equal (tips[1]['branchlen'], 10)
55-
assert_equal (tips[1]['status'], 'valid-fork')
55+
assert_equal(tips[1]['branchlen'], 10)
56+
assert_equal(tips[1]['status'], 'valid-fork')
5657
tips[1]['branchlen'] = 0
5758
tips[1]['status'] = 'active'
58-
assert_equal (tips[1], shortTip)
59+
assert_equal(tips[1], shortTip)
5960

6061
if __name__ == '__main__':
6162
GetChainTipsTest(__file__).main()

0 commit comments

Comments
 (0)