Changeset View
Changeset View
Standalone View
Standalone View
test/functional/getchaintips.py
#!/usr/bin/env python3 | #!/usr/bin/env python3 | ||||
# Copyright (c) 2014-2016 The Bitcoin Core developers | # Copyright (c) 2014-2016 The Bitcoin Core developers | ||||
# Distributed under the MIT software license, see the accompanying | # Distributed under the MIT software license, see the accompanying | ||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php. | # file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
# Exercise the getchaintips API. We introduce a network split, work | # Exercise the getchaintips API. We introduce a network split, work | ||||
# on chains of different lengths, and join the network together again. | # on chains of different lengths, and join the network together again. | ||||
# This gives us two tips, verify that it works. | # This gives us two tips, verify that it works. | ||||
from test_framework.test_framework import BitcoinTestFramework | from test_framework.test_framework import BitcoinTestFramework | ||||
from test_framework.util import assert_equal | from test_framework.util import assert_equal | ||||
class GetChainTipsTest (BitcoinTestFramework): | class GetChainTipsTest (BitcoinTestFramework): | ||||
def set_test_params(self): | def set_test_params(self): | ||||
self.num_nodes = 4 | self.num_nodes = 4 | ||||
self.extra_args = [["-noparkdeepreorg"], ["-noparkdeepreorg"], [], []] | |||||
def run_test(self): | def run_test(self): | ||||
tips = self.nodes[0].getchaintips() | tips = self.nodes[0].getchaintips() | ||||
assert_equal(len(tips), 1) | assert_equal(len(tips), 1) | ||||
assert_equal(tips[0]['branchlen'], 0) | assert_equal(tips[0]['branchlen'], 0) | ||||
assert_equal(tips[0]['height'], 200) | assert_equal(tips[0]['height'], 200) | ||||
assert_equal(tips[0]['status'], 'active') | assert_equal(tips[0]['status'], 'active') | ||||
Show All 37 Lines |