diff options
author | Daniel Kraft <d@domob.eu> | 2014-08-03 18:12:19 +0200 |
---|---|---|
committer | Daniel Kraft <d@domob.eu> | 2014-08-03 18:12:19 +0200 |
commit | b33bd7a3be1cbcc8d255178307976b7762125b18 (patch) | |
tree | 7d1af753944e5813f0ef541efb0a28edf5a283e2 /qa | |
parent | 6278bd57c662e29b07df9db50c47095c0bb44a82 (diff) |
Implement "getchaintips" RPC command to monitor blockchain forks.
Port over https://github.com/chronokings/huntercoin/pull/19 from
Huntercoin: This implements a new RPC command "getchaintips" that can be
used to find all currently active chain heads. This is similar to the
-printblocktree startup option, but it can be used without restarting
just via the RPC interface on a running daemon.
Diffstat (limited to 'qa')
-rwxr-xr-x | qa/rpc-tests/getchaintips.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/qa/rpc-tests/getchaintips.py b/qa/rpc-tests/getchaintips.py new file mode 100755 index 0000000000..a83c499743 --- /dev/null +++ b/qa/rpc-tests/getchaintips.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python +# Copyright (c) 2014 The Bitcoin Core developers +# Distributed under the MIT/X11 software license, see the accompanying +# file COPYING or http://www.opensource.org/licenses/mit-license.php. + +# Exercise the getchaintips API. + +# Since the test framework does not generate orphan blocks, we can +# unfortunately not check for them! + +from test_framework import BitcoinTestFramework +from util import assert_equal + +class GetChainTipsTest (BitcoinTestFramework): + + def run_test (self, nodes): + res = nodes[0].getchaintips () + assert_equal (len (res), 1) + res = res[0] + assert_equal (res['branchlen'], 0) + assert_equal (res['height'], 200) + +if __name__ == '__main__': + GetChainTipsTest ().main () |