@@ -18,44 +18,45 @@ def set_test_params(self):
18
18
self .num_nodes = 4
19
19
20
20
def run_test (self ):
21
+ self .log .info ("Test getchaintips behavior with two chains of different length" )
21
22
tips = self .nodes [0 ].getchaintips ()
22
23
assert_equal (len (tips ), 1 )
23
24
assert_equal (tips [0 ]['branchlen' ], 0 )
24
25
assert_equal (tips [0 ]['height' ], 200 )
25
26
assert_equal (tips [0 ]['status' ], 'active' )
26
27
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." )
28
29
self .split_network ()
29
30
self .generate (self .nodes [0 ], 10 , sync_fun = lambda : self .sync_all (self .nodes [:2 ]))
30
31
self .generate (self .nodes [2 ], 20 , sync_fun = lambda : self .sync_all (self .nodes [2 :]))
31
32
32
- tips = self .nodes [1 ].getchaintips ()
33
- assert_equal (len (tips ), 1 )
33
+ tips = self .nodes [1 ].getchaintips ()
34
+ assert_equal (len (tips ), 1 )
34
35
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' )
38
39
39
- tips = self .nodes [3 ].getchaintips ()
40
- assert_equal (len (tips ), 1 )
40
+ tips = self .nodes [3 ].getchaintips ()
41
+ assert_equal (len (tips ), 1 )
41
42
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' )
45
46
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" )
47
48
# (at least at the nodes that previously had the short chain).
48
- self .join_network ()
49
+ self .join_network ()
49
50
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 )
53
54
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' )
56
57
tips [1 ]['branchlen' ] = 0
57
58
tips [1 ]['status' ] = 'active'
58
- assert_equal (tips [1 ], shortTip )
59
+ assert_equal (tips [1 ], shortTip )
59
60
60
61
if __name__ == '__main__' :
61
62
GetChainTipsTest (__file__ ).main ()
0 commit comments