Example #1
0
def test_block_locator_hashes():
    for size in [100, 500, 720, 1000]:
        headers = make_headers(size)
        nodes = [(i, headers[i].hash(), i) for i in range(size)]
        bcv = BlockChainView(nodes)
        blh = bcv.block_locator_hashes()
        tuples = [bcv.tuple_for_hash(h) for h in blh]
        indices = [t[0] for t in tuples]
        indices.sort()
        assert indices == sorted(bcv.key_index_generator())

        bcv.winnow()
        blh = bcv.block_locator_hashes()
        tuples = [bcv.tuple_for_hash(h) for h in blh]
        indices = [t[0] for t in tuples]
        indices.sort()
        assert indices == list(t[0] for t in bcv.node_tuples)
Example #2
0
def test_block_locator_hashes():
    for size in [100, 500, 720, 1000]:
        headers = make_headers(size)
        nodes = [(i, headers[i].hash(), i) for i in range(size)]
        bcv = BlockChainView(nodes)
        blh = bcv.block_locator_hashes()
        tuples = [bcv.tuple_for_hash(h) for h in blh]
        indices = [t[0] for t in tuples]
        indices.sort()
        assert indices == sorted(bcv.key_index_generator())

        bcv.winnow()
        blh = bcv.block_locator_hashes()
        tuples = [bcv.tuple_for_hash(h) for h in blh]
        indices = [t[0] for t in tuples]
        indices.sort()
        assert indices == list(t[0] for t in bcv.node_tuples)
Example #3
0
def test1():
    bcv = BlockChainView()
    assert bcv.last_block_index() == -1
    assert bcv.block_locator_hashes() == [b'\0' * 32]

    blocks = make_blocks(20)
Example #4
0
def test1():
    bcv = BlockChainView()
    assert bcv.last_block_index() == -1
    assert bcv.block_locator_hashes() == [b'\0' * 32]

    blocks = make_blocks(20)