def _test_getblockheader(self):
    node = self.nodes[0]
    assert_raises_rpc_error((- 5), 'Block not found', node.getblockheader, 'nonsense')
    besthash = node.getbestblockhash()
    secondbesthash = node.getblockhash(199)
    header = node.getblockheader(besthash)
    assert_equal(header['hash'], besthash)
    assert_equal(header['height'], 200)
    assert_equal(header['confirmations'], 1)
    assert_equal(header['previousblockhash'], secondbesthash)
    assert_is_hex_string(header['chainwork'])
    assert_equal(header['nTx'], 1)
    assert_is_hash_string(header['hash'])
    assert_is_hash_string(header['previousblockhash'])
    assert_is_hash_string(header['merkleroot'])
    assert_is_hash_string(header['bits'], length=None)
    assert isinstance(header['time'], int)
    assert isinstance(header['mediantime'], int)
    assert isinstance(header['nonce'], int)
    assert isinstance(header['version'], int)
    assert isinstance(int(header['versionHex'], 16), int)
    assert isinstance(header['difficulty'], Decimal)
def _test_getblockheader(self):
    node = self.nodes[0]
    assert_raises_rpc_error((- 5), 'Block not found', node.getblockheader, 'nonsense')
    besthash = node.getbestblockhash()
    secondbesthash = node.getblockhash(199)
    header = node.getblockheader(besthash)
    assert_equal(header['hash'], besthash)
    assert_equal(header['height'], 200)
    assert_equal(header['confirmations'], 1)
    assert_equal(header['previousblockhash'], secondbesthash)
    assert_is_hex_string(header['chainwork'])
    assert_equal(header['nTx'], 1)
    assert_is_hash_string(header['hash'])
    assert_is_hash_string(header['previousblockhash'])
    assert_is_hash_string(header['merkleroot'])
    assert_is_hash_string(header['bits'], length=None)
    assert isinstance(header['time'], int)
    assert isinstance(header['mediantime'], int)
    assert isinstance(header['nonce'], int)
    assert isinstance(header['version'], int)
    assert isinstance(int(header['versionHex'], 16), int)
    assert isinstance(header['difficulty'], Decimal)