47 std::vector<std::unique_ptr<CBlockIndex>> block_index;
49 for (
int i = 0; i < 10; ++i) {
52 auto genesis = std::make_unique<CBlockIndex>();
54 block_index.push_back(std::move(genesis));
56 for (
int b = 0; b < 10000; ++b) {
57 auto new_index = std::make_unique<CBlockIndex>();
60 new_index->pprev = block_index.back().get();
62 new_index->pprev = block_index[ctx.
randrange(block_index.size())].get();
64 new_index->nHeight = new_index->pprev->nHeight + 1;
65 new_index->BuildSkip();
66 block_index.push_back(std::move(new_index));
69 for (
int q = 0; q < 10000; ++q) {
73 BOOST_CHECK(result == NaiveGetAncestor(block, height));
76 for (
int q = 0; q < 10000; ++q) {
80 BOOST_CHECK(result == NaiveLastCommonAncestor(block1, block2));