Electroneum
test_chain_unit_base Class Reference

#include <chaingen.h>

Inheritance diagram for test_chain_unit_base:

Public Types

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
 

Public Member Functions

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 > &)
 

Detailed Description

Definition at line 165 of file chaingen.h.

Member Typedef Documentation

◆ callbacks_map

typedef std::map<std::string, verify_callback> test_chain_unit_base::callbacks_map

Definition at line 169 of file chaingen.h.

◆ verify_callback

typedef boost::function<bool (cryptonote::core& c, size_t ev_index, const std::vector<test_event_entry> &events)> test_chain_unit_base::verify_callback

Definition at line 168 of file chaingen.h.

Member Function Documentation

◆ check_block_verification_context()

bool test_chain_unit_base::check_block_verification_context ( const cryptonote::block_verification_context bvc,
size_t  event_idx,
const cryptonote::block  
)

Definition at line 1153 of file chaingen.cpp.

1154 {
1155  return !bvc.m_verification_failed;
1156 }

◆ check_tx_verification_context()

bool test_chain_unit_base::check_tx_verification_context ( const cryptonote::tx_verification_context tvc,
bool  ,
size_t  ,
const cryptonote::transaction  
)

Definition at line 1158 of file chaingen.cpp.

1159 {
1160  return !tvc.m_verification_failed;
1161 }

◆ check_tx_verification_context_array()

bool test_chain_unit_base::check_tx_verification_context_array ( const std::vector< cryptonote::tx_verification_context > &  tvcs,
size_t  ,
size_t  ,
const std::vector< cryptonote::transaction > &   
)

Definition at line 1163 of file chaingen.cpp.

1164 {
1165  for (const cryptonote::tx_verification_context &tvc: tvcs)
1166  if (tvc.m_verification_failed)
1167  return false;
1168  return true;
1169 }

◆ register_callback()

void test_chain_unit_base::register_callback ( const std::string &  cb_name,
verify_callback  cb 
)

Definition at line 1138 of file chaingen.cpp.

1139 {
1140  m_callbacks[cb_name] = cb;
1141 }

◆ verify()

bool test_chain_unit_base::verify ( const std::string &  cb_name,
cryptonote::core c,
size_t  ev_index,
const std::vector< test_event_entry > &  events 
)

Definition at line 1142 of file chaingen.cpp.

1143 {
1144  auto cb_it = m_callbacks.find(cb_name);
1145  if(cb_it == m_callbacks.end())
1146  {
1147  LOG_ERROR("Failed to find callback " << cb_name);
1148  return false;
1149  }
1150  return cb_it->second(c, ev_index, events);
1151 }
#define LOG_ERROR(x)
Definition: misc_log_ex.h:98

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