13#include <boost/test/unit_test.hpp>
15#define SKIPLIST_LENGTH 300000
38 for (
int i=0; i < 1000; i++) {
40 int to = m_rng.randrange(from + 1);
81 for (
int n=0; n<100; n++) {
82 int r = m_rng.randrange(150000);
91 for (
unsigned int i = 1; i < 12 && i < locator.
vHave.size() - 1; i++) {
96 unsigned int dist = 2;
97 for (
unsigned int i = 12; i < locator.
vHave.size() - 1; i++) {
108 for (
unsigned int i=0; i<
vBlocksMain.size(); i++) {
127 for (
unsigned int i=0; i<
vBlocksMain.size(); ++i) {
137 for (
unsigned int i=0; i<10000; ++i) {
150 std::list<CBlockIndex>
blocks;
151 for (
const unsigned int timeMax : {100, 100, 100, 200, 200, 200, 300, 300, 300}) {
156 blocks.back().BuildSkip();
228 { 0b0001011101101000 ,
229 0b0001011101100000 },
230 { 0b0001011101101001 ,
231 0b0001011101000001 },
232 { 0b0110101101011000 ,
233 0b0110101101010000 },
234 { 0b0110101101011001 ,
235 0b0110101101000001 },
278 for (
auto& [input, expected] :
TEST_DATA) {
arith_uint256 UintToArith256(const uint256 &a)
uint256 ArithToUint256(const arith_uint256 &a)
CBlockLocator GetLocator(const CBlockIndex *index)
Get a locator for a block index entry.
The block chain is a tree shaped structure starting with the genesis block at the root,...
int nHeight
height of the entry in the chain. The genesis block has height 0
An in-memory indexed chain of blocks.
void SetTip(CBlockIndex &block)
Set/initialize a chain with a given tip.
CBlockIndex * FindEarliestAtLeast(int64_t nTime, int height) const
Find the earliest block with timestamp equal or greater than the given time and height equal or great...
256-bit unsigned big integer.
uint64_t GetLow64() const
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)
BOOST_AUTO_TEST_CASE(skiplist_test)
Describes a place in the block chain to another node such that if the other node doesn't have the sam...
std::vector< uint256 > vHave
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.