Electroneum
gen_block_miner_tx_has_out_to_alice Struct Reference

#include <block_validation.h>

Inheritance diagram for gen_block_miner_tx_has_out_to_alice:
Collaboration diagram for gen_block_miner_tx_has_out_to_alice:

Public Member Functions

bool generate (std::vector< test_event_entry > &events) const
 
- Public Member Functions inherited from gen_block_accepted_base< 2 >
 gen_block_accepted_base ()
 
bool check_block_accepted (cryptonote::core &c, size_t, 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 184 of file block_validation.h.

Member Function Documentation

◆ generate()

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

Definition at line 460 of file block_validation.cpp.

461 {
463 
464  GENERATE_ACCOUNT(alice);
465 
466  keypair txkey;
467  MAKE_MINER_TX_AND_KEY_MANUALLY(miner_tx, blk_0, &txkey);
468 
469  crypto::key_derivation derivation;
470  crypto::public_key out_eph_public_key;
471  crypto::generate_key_derivation(alice.get_keys().m_account_address.m_view_public_key, txkey.sec, derivation);
472  crypto::derive_public_key(derivation, 1, alice.get_keys().m_account_address.m_spend_public_key, out_eph_public_key);
473 
474  tx_out out_to_alice;
475  out_to_alice.amount = miner_tx.vout[0].amount / 2;
476  miner_tx.vout[0].amount -= out_to_alice.amount;
477  out_to_alice.target = txout_to_key(out_eph_public_key);
478  miner_tx.vout.push_back(out_to_alice);
479 
480  block blk_1;
481  generator.construct_block_manually(blk_1, blk_0, miner_account, test_generator::bf_miner_tx, 0, 0, 0, crypto::hash(), 0, miner_tx);
482  events.push_back(blk_1);
483 
484  DO_CALLBACK(events, "check_block_accepted");
485 
486  return true;
487 }
crypto::secret_key sec
POD_CLASS key_derivation
Definition: crypto.h:98
bool generate_key_derivation(const public_key &key1, const secret_key &key2, key_derivation &derivation)
Definition: crypto.h:272
#define MAKE_MINER_TX_AND_KEY_MANUALLY(TX, BLK, KEY)
Definition: chaingen.h:943
POD_CLASS public_key
Definition: crypto.h:76
bool derive_public_key(const key_derivation &derivation, std::size_t output_index, const public_key &base, public_key &derived_key)
Definition: crypto.h:275
POD_CLASS hash
Definition: hash.h:50
#define BLOCK_VALIDATION_INIT_GENERATE()
#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: