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

#include <block_validation.h>

Inheritance diagram for gen_block_is_too_big:
Collaboration diagram for gen_block_is_too_big:

Public Member Functions

bool generate (std::vector< test_event_entry > &events) const
Public Member Functions inherited from gen_block_verification_base< 1 >
 gen_block_verification_base ()
bool check_block_verification_context (const cryptonote::block_verification_context &bvc, size_t event_idx, const cryptonote::block &)
bool check_block_purged (cryptonote::core &c, size_t ev_index, const std::vector< test_event_entry > &events)
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 194 of file block_validation.h.

Member Function Documentation

◆ generate()

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

Definition at line 505 of file block_validation.cpp.

506{
508
509 // Creating a huge miner_tx, it will have a lot of outs
510 MAKE_MINER_TX_MANUALLY(miner_tx, blk_0);
511 static const size_t tx_out_count = CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V1 / 2;
512 uint64_t amount = get_outs_etn_amount(miner_tx);
513 uint64_t portion = amount / tx_out_count;
514 uint64_t remainder = amount % tx_out_count;
515 txout_target_v target = miner_tx.vout[0].target;
516 miner_tx.vout.clear();
517 for (size_t i = 0; i < tx_out_count; ++i)
518 {
519 tx_out o;
520 o.amount = portion;
521 o.target = target;
522 miner_tx.vout.push_back(o);
523 }
524 if (0 < remainder)
525 {
526 tx_out o;
527 o.amount = remainder;
528 o.target = target;
529 miner_tx.vout.push_back(o);
530 }
531
532 // Block reward will be incorrect, as it must be reduced if cumulative block size is very big,
533 // but in this test it doesn't matter
534 block blk_1;
535 if (!generator.construct_block_manually(blk_1, blk_0, miner_account, test_generator::bf_miner_tx, 0, 0, 0, crypto::hash(), 0, miner_tx))
536 return false;
537
538 events.push_back(blk_1);
539
540 DO_CALLBACK(events, "check_block_purged");
541
542 return true;
543}
#define BLOCK_VALIDATION_INIT_GENERATE()
#define MAKE_MINER_TX_MANUALLY(TX, BLK)
Definition chaingen.h:949
#define DO_CALLBACK(VEC_EVENTS, CB_NAME)
Definition chaingen.h:820
#define CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V1
POD_CLASS hash
Definition hash.h:50
uint64_t get_outs_etn_amount(const transaction &tx)
boost::variant< txout_to_script, txout_to_scripthash, txout_to_key, txout_to_key_public > txout_target_v
unsigned __int64 uint64_t
Definition stdint.h:136
txout_target_v target
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/block_validation.h
  • /home/abuild/rpmbuild/BUILD/electroneum-5.1.3.1-build/electroneum-5.1.3.1/tests/core_tests/block_validation.cpp