def test_improve_path():
    size = 100
    headers = make_headers(size)
    bcv = make_bcv(0)
    assert bcv.last_block_index() == -1
    for count in range(100):
        report = bcv.do_headers_improve_path([headers[count]])
        assert report == count
        assert bcv.last_block_index() == count
    # let's try to extend from 95
    headers = make_headers(10, headers[95])

    for count in range(96, 100):
        report = bcv.do_headers_improve_path(headers[0:count-95])
        assert report == False
    count = 100
    report = bcv.do_headers_improve_path(headers[0:count-95])
    assert report == 96

    report = bcv.do_headers_improve_path(headers[5:])
    assert report == 101
dataset/ETHPy150Open richardkiss/pycoinnet/tests/util/test_BlockChainView.py/test_improve_path/original