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

#include <tx_validation.h>

Inheritance diagram for gen_tx_unlock_time:
Collaboration diagram for gen_tx_unlock_time:

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 83 of file tx_validation.h.

Member Function Documentation

◆ generate()

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

Definition at line 210 of file tx_validation.cpp.

211{
212 uint64_t ts_start = 1338224400;
213
214 GENERATE_ACCOUNT(miner_account);
215 MAKE_GENESIS_BLOCK(events, blk_0, miner_account, ts_start);
216 REWIND_BLOCKS_N(events, blk_1, blk_0, miner_account, 10);
217 REWIND_BLOCKS(events, blk_1r, blk_1, miner_account);
218
219 auto make_tx_with_unlock_time = [&](uint64_t unlock_time) -> transaction
220 {
221 return make_simple_tx_with_unlock_time(events, blk_1, miner_account, miner_account, MK_COINS(1), unlock_time);
222 };
223
224 std::list<transaction> txs_0;
225
226 txs_0.push_back(make_tx_with_unlock_time(0));
227 events.push_back(txs_0.back());
228
229 txs_0.push_back(make_tx_with_unlock_time(get_block_height(blk_1r) - 1));
230 events.push_back(txs_0.back());
231
232 txs_0.push_back(make_tx_with_unlock_time(get_block_height(blk_1r)));
233 events.push_back(txs_0.back());
234
235 txs_0.push_back(make_tx_with_unlock_time(get_block_height(blk_1r) + 1));
236 events.push_back(txs_0.back());
237
238 txs_0.push_back(make_tx_with_unlock_time(get_block_height(blk_1r) + 2));
239 events.push_back(txs_0.back());
240
241 txs_0.push_back(make_tx_with_unlock_time(ts_start - 1));
242 events.push_back(txs_0.back());
243
244 txs_0.push_back(make_tx_with_unlock_time(time(0) + 60 * 60));
245 events.push_back(txs_0.back());
246
247 MAKE_NEXT_BLOCK_TX_LIST(events, blk_2, blk_1r, miner_account, txs_0);
248
249 return true;
250}
time_t time
#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 MAKE_NEXT_BLOCK_TX_LIST(VEC_EVENTS, BLK_NAME, PREV_BLOCK, MINER_ACC, TXLIST)
Definition chaingen.h:867
#define REWIND_BLOCKS_N(VEC_EVENTS, BLK_NAME, PREV_BLOCK, MINER_ACC, COUNT)
Definition chaingen.h:889
#define MK_COINS(amount)
Definition chaingen.h:1060
#define GENERATE_ACCOUNT(account)
Definition chaingen.h:801
uint64_t get_block_height(const block &b)
unsigned __int64 uint64_t
Definition stdint.h:136
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