5#include <boost/test/unit_test.hpp>
19 while (
a->nHeight > height) {
91 for (
size_t i{0}; i <
blocks.size(); ++i) {
98 for (
const auto& block :
blocks) {
104 for (
const auto& block :
blocks) {
148 std::vector<std::unique_ptr<CBlockIndex>>
block_index;
150 for (
int i = 0; i < 10; ++i) {
153 auto genesis = std::make_unique<CBlockIndex>();
154 genesis->nHeight = 0;
157 for (
int b = 0; b < 10000; ++b) {
158 auto new_index = std::make_unique<CBlockIndex>();
170 for (
int q = 0; q < 10000; ++q) {
177 for (
int q = 0; q < 10000; ++q) {
const CBlockIndex * LastCommonAncestor(const CBlockIndex *pa, const CBlockIndex *pb)
Find the last common ancestor two blocks have.
BOOST_AUTO_TEST_CASE(basic_tests)
The block chain is a tree shaped structure starting with the genesis block at the root,...
CBlockIndex * pprev
pointer to the index of the predecessor of this block
CBlockIndex * GetAncestor(int height)
Efficiently find an ancestor of this block.
int nHeight
height of the entry in the chain. The genesis block has height 0
An in-memory indexed chain of blocks.
const CBlockIndex * FindFork(const CBlockIndex &index) const
Find the last common block between this chain and a block index entry.
void SetTip(CBlockIndex &block)
Set/initialize a chain with a given tip.
I randrange(I range) noexcept
Generate a random integer in the range [0..range), with range > 0.
BOOST_FIXTURE_TEST_SUITE(cuckoocache_tests, BasicTestingSetup)
Test Suite for CuckooCache.
BOOST_AUTO_TEST_SUITE_END()
#define BOOST_CHECK_EQUAL(v1, v2)
#define BOOST_CHECK(expr)
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.