Electroneum
one_block Class Reference

#include <chaingen_tests_list.h>

Inheritance diagram for one_block:
Collaboration diagram for one_block:

Public Member Functions

 one_block ()
 
bool generate (std::vector< test_event_entry > &events)
 
bool verify_1 (cryptonote::core &c, size_t ev_index, const std::vector< test_event_entry > &events)
 
- Public Member Functions inherited from test_chain_unit_base
void register_callback (const std::string &cb_name, verify_callback cb)
 
bool verify (const std::string &cb_name, cryptonote::core &c, size_t ev_index, const std::vector< test_event_entry > &events)
 
bool check_block_verification_context (const cryptonote::block_verification_context &bvc, size_t event_idx, const cryptonote::block &)
 
bool check_tx_verification_context (const cryptonote::tx_verification_context &tvc, bool, size_t, const cryptonote::transaction &)
 
bool check_tx_verification_context_array (const std::vector< cryptonote::tx_verification_context > &tvcs, size_t, size_t, const std::vector< cryptonote::transaction > &)
 

Additional Inherited Members

- Public Types inherited from test_chain_unit_base
typedef boost::function< bool(cryptonote::core &c, size_t ev_index, const std::vector< test_event_entry > &events)> verify_callback
 
typedef std::map< std::string, verify_callbackcallbacks_map
 

Detailed Description

Definition at line 59 of file chaingen_tests_list.h.

Constructor & Destructor Documentation

◆ one_block()

one_block::one_block ( )

Definition at line 53 of file chaingen001.cpp.

54 {
56 }
#define REGISTER_CALLBACK(CB_NAME, CLBACK)
Definition: chaingen.h:827
bool verify_1(cryptonote::core &c, size_t ev_index, const std::vector< test_event_entry > &events)
Definition: chaingen001.cpp:69
Here is the call graph for this function:

Member Function Documentation

◆ generate()

bool one_block::generate ( std::vector< test_event_entry > &  events)

Definition at line 58 of file chaingen001.cpp.

59 {
60  uint64_t ts_start = 1338224400;
61 
62  MAKE_GENESIS_BLOCK(events, blk_0, alice, ts_start);
63  MAKE_ACCOUNT(events, alice);
64  DO_CALLBACK(events, "verify_1");
65 
66  return true;
67 }
#define MAKE_GENESIS_BLOCK(VEC_EVENTS, BLK_NAME, MINER_ACC, TS)
Definition: chaingen.h:833
unsigned __int64 uint64_t
Definition: stdint.h:136
#define MAKE_ACCOUNT(VEC_EVENTS, account)
Definition: chaingen.h:815
#define DO_CALLBACK(VEC_EVENTS, CB_NAME)
Definition: chaingen.h:820

◆ verify_1()

bool one_block::verify_1 ( cryptonote::core c,
size_t  ev_index,
const std::vector< test_event_entry > &  events 
)

Definition at line 69 of file chaingen001.cpp.

70 {
71  DEFINE_TESTS_ERROR_CONTEXT("one_block::verify_1");
72 
73  alice = boost::get<cryptonote::account_base>(events[1]);
74 
75  // check balances
76  //std::vector<const cryptonote::block*> chain;
77  //map_hash2tx_t mtx;
78  //CHECK_TEST_CONDITION(find_block_chain(events, chain, mtx, get_block_hash(boost::get<cryptonote::block>(events[1]))));
79  //CHECK_TEST_CONDITION(get_block_reward(0) == get_balance(alice, events, chain, mtx));
80 
81  // check height
82  std::vector<cryptonote::block> blocks;
83  std::list<crypto::public_key> outs;
84  bool r = c.get_blocks(0, 100, blocks);
85  //c.get_outs(100, outs);
87  CHECK_TEST_CONDITION(blocks.size() == 1);
88  //CHECK_TEST_CONDITION(outs.size() == blocks.size());
90  CHECK_TEST_CONDITION(blocks.back() == boost::get<cryptonote::block>(events[0]));
91 
92  return true;
93 }
#define CHECK_TEST_CONDITION(cond)
Definition: chaingen.h:1057
bool get_blocks(uint64_t start_offset, size_t count, std::vector< std::pair< cryptonote::blobdata, block >> &blocks, std::vector< cryptonote::blobdata > &txs) const
#define DEFINE_TESTS_ERROR_CONTEXT(text)
Definition: chaingen.h:1056
size_t get_blockchain_total_transactions() const
gets the total number of transactions on the main chain
Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following files: