Electroneum
gen_tx_input_is_not_txin_to_key Struct Reference

#include <tx_validation.h>

Inheritance diagram for gen_tx_input_is_not_txin_to_key:
Collaboration diagram for gen_tx_input_is_not_txin_to_key:

Public Member Functions

bool generate (std::vector< test_event_entry > &events) const
 
- Public Member Functions inherited from get_tx_validation_base
 get_tx_validation_base ()
 
bool check_tx_verification_context (const cryptonote::tx_verification_context &tvc, bool tx_added, size_t event_idx, const cryptonote::transaction &)
 
bool check_block_verification_context (const cryptonote::block_verification_context &bvc, size_t event_idx, const cryptonote::block &)
 
bool mark_invalid_block (cryptonote::core &, size_t ev_index, const std::vector< test_event_entry > &)
 
bool mark_invalid_tx (cryptonote::core &, size_t ev_index, const std::vector< test_event_entry > &)
 
- 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 88 of file tx_validation.h.

Member Function Documentation

◆ generate()

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

Definition at line 252 of file tx_validation.cpp.

253 {
254  uint64_t ts_start = 1338224400;
255 
256  GENERATE_ACCOUNT(miner_account);
257  MAKE_GENESIS_BLOCK(events, blk_0, miner_account, ts_start);
258  REWIND_BLOCKS(events, blk_0r, blk_0, miner_account);
259 
260  MAKE_NEXT_BLOCK(events, blk_tmp, blk_0r, miner_account);
261  events.pop_back();
262 
263  DO_CALLBACK(events, "mark_invalid_tx");
264  events.push_back(blk_tmp.miner_tx);
265 
266  auto make_tx_with_input = [&](const txin_v& tx_input) -> transaction
267  {
268  std::vector<tx_source_entry> sources;
269  std::vector<tx_destination_entry> destinations;
270  fill_tx_sources_and_destinations(events, blk_0, miner_account, miner_account, MK_COINS(1), TESTS_DEFAULT_FEE, 0, sources, destinations);
271 
272  tx_builder builder;
273  builder.step1_init();
274  builder.m_tx.vin.push_back(tx_input);
275  builder.step3_fill_outputs(destinations);
276  return builder.m_tx;
277  };
278 
279  DO_CALLBACK(events, "mark_invalid_tx");
280  events.push_back(make_tx_with_input(txin_to_script()));
281 
282  DO_CALLBACK(events, "mark_invalid_tx");
283  events.push_back(make_tx_with_input(txin_to_scripthash()));
284 
285  return true;
286 }
boost::variant< txin_gen, txin_to_script, txin_to_scripthash, txin_to_key, txin_to_key_public > txin_v
void fill_tx_sources_and_destinations(const std::vector< test_event_entry > &events, const block &blk_head, const cryptonote::account_base &from, const cryptonote::account_public_address &to, uint64_t amount, uint64_t fee, size_t nmix, std::vector< tx_source_entry > &sources, std::vector< tx_destination_entry > &destinations)
Definition: chaingen.cpp:775
#define MAKE_NEXT_BLOCK(VEC_EVENTS, BLK_NAME, PREV_BLOCK, MINER_ACC)
Definition: chaingen.h:839
#define TESTS_DEFAULT_FEE
Definition: chaingen.h:1061
#define MAKE_GENESIS_BLOCK(VEC_EVENTS, BLK_NAME, MINER_ACC, TS)
Definition: chaingen.h:833
unsigned __int64 uint64_t
Definition: stdint.h:136
#define REWIND_BLOCKS(VEC_EVENTS, BLK_NAME, PREV_BLOCK, MINER_ACC)
Definition: chaingen.h:890
#define MK_COINS(amount)
Definition: chaingen.h:1060
#define GENERATE_ACCOUNT(account)
Definition: chaingen.h:801
#define DO_CALLBACK(VEC_EVENTS, CB_NAME)
Definition: chaingen.h:820
Here is the call graph for this function:

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