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

#include <tx_validation.h>

Inheritance diagram for gen_tx_key_image_not_derive_from_tx_key:
Collaboration diagram for gen_tx_key_image_not_derive_from_tx_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 133 of file tx_validation.h.

Member Function Documentation

◆ generate()

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

Definition at line 505 of file tx_validation.cpp.

506{
507 uint64_t ts_start = 1338224400;
508
509 GENERATE_ACCOUNT(miner_account);
510 MAKE_GENESIS_BLOCK(events, blk_0, miner_account, ts_start);
511 REWIND_BLOCKS(events, blk_0r, blk_0, miner_account);
512
513 std::vector<tx_source_entry> sources;
514 std::vector<tx_destination_entry> destinations;
515 fill_tx_sources_and_destinations(events, blk_0, miner_account, miner_account, MK_COINS(1), TESTS_DEFAULT_FEE, 0, sources, destinations);
516
517 tx_builder builder;
518 builder.step1_init();
519 builder.step2_fill_inputs(miner_account.get_keys(), sources);
520
521 txin_to_key& in_to_key = boost::get<txin_to_key>(builder.m_tx.vin.front());
522 keypair kp = keypair::generate(hw::get_device("default"));
523 key_image another_ki;
524 crypto::generate_key_image(kp.pub, kp.sec, another_ki);
525 in_to_key.k_image = another_ki;
526
527 builder.step3_fill_outputs(destinations);
528 builder.step4_calc_hash();
529
530 // Tx with invalid key image can't be subscribed, so create empty signature
531 builder.m_tx.signatures.resize(1);
532 builder.m_tx.signatures[0].resize(1);
533 builder.m_tx.signatures[0][0] = boost::value_initialized<crypto::signature>();
534
535 DO_CALLBACK(events, "mark_invalid_tx");
536 events.push_back(builder.m_tx);
537
538 return true;
539}
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 REWIND_BLOCKS(VEC_EVENTS, BLK_NAME, PREV_BLOCK, MINER_ACC)
Definition chaingen.h:890
#define MAKE_GENESIS_BLOCK(VEC_EVENTS, BLK_NAME, MINER_ACC, TS)
Definition chaingen.h:833
#define DO_CALLBACK(VEC_EVENTS, CB_NAME)
Definition chaingen.h:820
#define MK_COINS(amount)
Definition chaingen.h:1060
#define TESTS_DEFAULT_FEE
Definition chaingen.h:1061
#define GENERATE_ACCOUNT(account)
Definition chaingen.h:801
std::vector< std::vector< crypto::signature > > signatures
std::vector< std::string > keypair
POD_CLASS key_image
Definition crypto.h:105
void generate_key_image(const public_key &pub, const secret_key &sec, key_image &image)
Definition crypto.h:324
device & get_device(const std::string &device_descriptor)
Definition device.cpp:95
unsigned __int64 uint64_t
Definition stdint.h:136
crypto::secret_key sec
crypto::public_key pub
crypto::key_image k_image
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