Monero
Loading...
Searching...
No Matches
block_weight.cpp File Reference
#include <stdio.h>
#include <math.h>
#include "cryptonote_core/blockchain.h"
#include "cryptonote_core/tx_pool.h"
#include "cryptonote_core/cryptonote_core.h"
#include "blockchain_db/testdb.h"
Include dependency graph for block_weight.cpp:

Macros

#define IN_UNIT_TESTS
#define LONG_TERM_BLOCK_WEIGHT_WINDOW   5000
#define PREFIX_WINDOW(hf_version, window)
#define PREFIX(hf_version)

Enumerations

enum  test_t { test_max = 0 , test_lcg = 1 , test_min = 2 }

Functions

static uint32_t lcg ()
static void test (test_t t, uint64_t blocks)
int main ()

Variables

static uint32_t lcg_seed = 0

Macro Definition Documentation

◆ IN_UNIT_TESTS

#define IN_UNIT_TESTS

◆ LONG_TERM_BLOCK_WEIGHT_WINDOW

#define LONG_TERM_BLOCK_WEIGHT_WINDOW   5000

◆ PREFIX

#define PREFIX ( hf_version)
Value:
#define LONG_TERM_BLOCK_WEIGHT_WINDOW
Definition block_weight.cpp:38
#define PREFIX_WINDOW(hf_version, window)
Definition block_weight.cpp:112

◆ PREFIX_WINDOW

#define PREFIX_WINDOW ( hf_version,
window )
Value:
std::unique_ptr<cryptonote::Blockchain> bc; \
bc.reset(new cryptonote::Blockchain(txpool)); \
struct get_test_options { \
const std::pair<uint8_t, uint64_t> hard_forks[3]; \
const cryptonote::test_options test_options = { \
hard_forks, \
window, \
}; \
get_test_options(): hard_forks{std::make_pair(1, (uint64_t)0), std::make_pair((uint8_t)hf_version, (uint64_t)LONG_TERM_BLOCK_WEIGHT_WINDOW), std::make_pair((uint8_t)0, (uint64_t)0)} {} \
} opts; \
cryptonote::Blockchain *blockchain = bc.get(); \
bool r = blockchain->init(new TestDB(), cryptonote::FAKECHAIN, true, &opts.test_options, 0, NULL); \
if (!r) \
{ \
fprintf(stderr, "Failed to init blockchain\n"); \
exit(1); \
}
Definition blockchain.h:103
bool init(BlockchainDB *db, const network_type nettype=MAINNET, bool offline=false, const cryptonote::test_options *test_options=NULL, difficulty_type fixed_difficulty=0, const GetCheckpointsCallback &get_checkpoints=nullptr)
Initialize the Blockchain state.
Definition blockchain.cpp:283
Transaction pool, handles transactions which are not part of a block.
Definition tx_pool.h:99
@ FAKECHAIN
Definition cryptonote_config.h:306
Definition enums.h:68
r
Definition testupnpigd.py:61
Definition txpool.py:1
if(!cryptonote::get_account_address_from_str_or_url(info, cryptonote::TESTNET, "9uVsvEryzpN8WH2t1WWhFFCG5tS8cBNdmJYNRuckLENFimfauV5pZKeS1P2CbxGkSDTUPHXWwiYE5ZGSXDAGbaZgDxobqDN"))
Definition signature.cpp:53
unsigned char uint8_t
Definition stdint.h:124
unsigned __int64 uint64_t
Definition stdint.h:136
Definition cryptonote_core.h:61
Definition chaingen.h:725

Enumeration Type Documentation

◆ test_t

enum test_t
Enumerator
test_max 
test_lcg 
test_min 

Function Documentation

◆ lcg()

uint32_t lcg ( )
static

◆ main()

int main ( void )

◆ test()

void test ( test_t t,
uint64_t blocks )
static

Variable Documentation

◆ lcg_seed

uint32_t lcg_seed = 0
static