Electroneum
Loading...
Searching...
No Matches
gen_tx_key_offest_points_to_foreign_key Struct Reference

#include <tx_validation.h>

Inheritance diagram for gen_tx_key_offest_points_to_foreign_key:
Collaboration diagram for gen_tx_key_offest_points_to_foreign_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 118 of file tx_validation.h.

Member Function Documentation

◆ generate()

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

Definition at line 408 of file tx_validation.cpp.

409{
410 uint64_t ts_start = 1338224400;
411
412 GENERATE_ACCOUNT(miner_account);
413 MAKE_GENESIS_BLOCK(events, blk_0, miner_account, ts_start);
414 MAKE_NEXT_BLOCK(events, blk_1, blk_0, miner_account);
415 REWIND_BLOCKS(events, blk_1r, blk_1, miner_account);
416 MAKE_ACCOUNT(events, alice_account);
417 MAKE_ACCOUNT(events, bob_account);
418 MAKE_TX_LIST_START(events, txs_0, miner_account, bob_account, MK_COINS(15) + 1, blk_1);
419 MAKE_TX_LIST(events, txs_0, miner_account, alice_account, MK_COINS(15) + 1, blk_1);
420 MAKE_NEXT_BLOCK_TX_LIST(events, blk_2, blk_1r, miner_account, txs_0);
421
422 std::vector<tx_source_entry> sources_bob;
423 std::vector<tx_destination_entry> destinations_bob;
424 fill_tx_sources_and_destinations(events, blk_2, bob_account, miner_account, MK_COINS(15) + 1 - TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, 0, sources_bob, destinations_bob);
425
426 std::vector<tx_source_entry> sources_alice;
427 std::vector<tx_destination_entry> destinations_alice;
428 fill_tx_sources_and_destinations(events, blk_2, alice_account, miner_account, MK_COINS(15) + 1 - TESTS_DEFAULT_FEE, TESTS_DEFAULT_FEE, 0, sources_alice, destinations_alice);
429
430 tx_builder builder;
431 builder.step1_init();
432 builder.step2_fill_inputs(bob_account.get_keys(), sources_bob);
433 txin_to_key& in_to_key = boost::get<txin_to_key>(builder.m_tx.vin.front());
434 in_to_key.key_offsets.front() = sources_alice.front().outputs.front().first;
435 builder.step3_fill_outputs(destinations_bob);
436 builder.step4_calc_hash();
437 builder.step5_sign(sources_bob);
438
439 DO_CALLBACK(events, "mark_invalid_tx");
440 events.push_back(builder.m_tx);
441
442 return true;
443}
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 REWIND_BLOCKS(VEC_EVENTS, BLK_NAME, PREV_BLOCK, MINER_ACC)
Definition chaingen.h:890
#define MAKE_TX_LIST_START(VEC_EVENTS, SET_NAME, FROM, TO, AMOUNT, HEAD)
Definition chaingen.h:935
#define MAKE_GENESIS_BLOCK(VEC_EVENTS, BLK_NAME, MINER_ACC, TS)
Definition chaingen.h:833
#define MAKE_NEXT_BLOCK_TX_LIST(VEC_EVENTS, BLK_NAME, PREV_BLOCK, MINER_ACC, TXLIST)
Definition chaingen.h:867
#define DO_CALLBACK(VEC_EVENTS, CB_NAME)
Definition chaingen.h:820
#define MAKE_TX_LIST(VEC_EVENTS, SET_NAME, FROM, TO, AMOUNT, HEAD)
Definition chaingen.h:933
#define MK_COINS(amount)
Definition chaingen.h:1060
#define TESTS_DEFAULT_FEE
Definition chaingen.h:1061
#define MAKE_ACCOUNT(VEC_EVENTS, account)
Definition chaingen.h:815
#define GENERATE_ACCOUNT(account)
Definition chaingen.h:801
unsigned __int64 uint64_t
Definition stdint.h:136
std::vector< uint64_t > key_offsets
Here is the call graph for this function:

The documentation for this struct was generated from the following files:
  • /home/abuild/rpmbuild/BUILD/electroneum-5.1.3.1-build/electroneum-5.1.3.1/tests/core_tests/tx_validation.h
  • /home/abuild/rpmbuild/BUILD/electroneum-5.1.3.1-build/electroneum-5.1.3.1/tests/core_tests/tx_validation.cpp