Electroneum
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:

Go to the source code of this file.

Macros

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

Enumerations

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

Functions

int main ()
 

Macro Definition Documentation

◆ IN_UNIT_TESTS

#define IN_UNIT_TESTS

Definition at line 29 of file block_weight.cpp.

◆ LONG_TERM_BLOCK_WEIGHT_WINDOW

#define LONG_TERM_BLOCK_WEIGHT_WINDOW   5000

Definition at line 38 of file block_weight.cpp.

◆ PREFIX

#define PREFIX (   hf_version)    PREFIX_WINDOW(hf_version, LONG_TERM_BLOCK_WEIGHT_WINDOW)

Definition at line 132 of file block_weight.cpp.

◆ PREFIX_WINDOW

#define PREFIX_WINDOW (   hf_version,
  window 
)
Value:
std::unique_ptr<cryptonote::Blockchain> bc; \
cryptonote::tx_memory_pool txpool(*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); \
}
#define LONG_TERM_BLOCK_WEIGHT_WINDOW
unsigned char uint8_t
Definition: stdint.h:124
unsigned __int64 uint64_t
Definition: stdint.h:136
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, bool ignore_bsig=false, bool fallback_to_pow=false)
Initialize the Blockchain state.
Definition: blockchain.cpp:334

Definition at line 112 of file block_weight.cpp.

Enumeration Type Documentation

◆ test_t

enum test_t
Enumerator
test_max 
test_lcg 
test_min 

Definition at line 40 of file block_weight.cpp.

41 {
42  test_max = 0,
43  test_lcg = 1,
44  test_min = 2,
45 };

Function Documentation

◆ main()

int main ( )

Definition at line 196 of file block_weight.cpp.

197 {
198  TRY_ENTRY();
202  return 0;
203  CATCH_ENTRY_L0("main", 1);
204 }
#define LONG_TERM_BLOCK_WEIGHT_WINDOW
#define TRY_ENTRY()
Definition: misc_log_ex.h:151
#define CATCH_ENTRY_L0(lacation, return_val)
Definition: misc_log_ex.h:165