def run_test(self):
    tips = self.nodes[0].getchaintips()
    assert_equal(len(tips), 1)
    assert_equal(tips[0]['branchlen'], 0)
    assert_equal(tips[0]['height'], 200)
    assert_equal(tips[0]['status'], 'active')
    self.split_network()
    self.nodes[0].generate(10)
    self.nodes[2].generate(20)
    self.sync_all(self.nodes[:2])
    self.sync_all(self.nodes[2:])
    tips = self.nodes[1].getchaintips()
    assert_equal(len(tips), 1)
    shortTip = tips[0]
    assert_equal(shortTip['branchlen'], 0)
    assert_equal(shortTip['height'], 210)
    assert_equal(tips[0]['status'], 'active')
    tips = self.nodes[3].getchaintips()
    assert_equal(len(tips), 1)
    longTip = tips[0]
    assert_equal(longTip['branchlen'], 0)
    assert_equal(longTip['height'], 220)
    assert_equal(tips[0]['status'], 'active')
    self.join_network()
    tips = self.nodes[0].getchaintips()
    assert_equal(len(tips), 2)
    assert_equal(tips[0], longTip)
    assert_equal(tips[1]['branchlen'], 10)
    assert_equal(tips[1]['status'], 'valid-fork')
    tips[1]['branchlen'] = 0
    tips[1]['status'] = 'active'
    assert_equal(tips[1], shortTip)
def run_test(self):
    tips = self.nodes[0].getchaintips()
    assert_equal(len(tips), 1)
    assert_equal(tips[0]['branchlen'], 0)
    assert_equal(tips[0]['height'], 200)
    assert_equal(tips[0]['status'], 'active')
    self.split_network()
    self.nodes[0].generate(10)
    self.nodes[2].generate(20)
    self.sync_all(self.nodes[:2])
    self.sync_all(self.nodes[2:])
    tips = self.nodes[1].getchaintips()
    assert_equal(len(tips), 1)
    shortTip = tips[0]
    assert_equal(shortTip['branchlen'], 0)
    assert_equal(shortTip['height'], 210)
    assert_equal(tips[0]['status'], 'active')
    tips = self.nodes[3].getchaintips()
    assert_equal(len(tips), 1)
    longTip = tips[0]
    assert_equal(longTip['branchlen'], 0)
    assert_equal(longTip['height'], 220)
    assert_equal(tips[0]['status'], 'active')
    self.join_network()
    tips = self.nodes[0].getchaintips()
    assert_equal(len(tips), 2)
    assert_equal(tips[0], longTip)
    assert_equal(tips[1]['branchlen'], 10)
    assert_equal(tips[1]['status'], 'valid-fork')
    tips[1]['branchlen'] = 0
    tips[1]['status'] = 'active'
    assert_equal(tips[1], shortTip)