35template<
class concrete_test>
46template<
class concrete_test>
55template<
class concrete_test>
64template<
class concrete_test>
67 std::vector<cryptonote::block> block_list;
68 bool r = c.get_blocks(c.get_current_blockchain_height() - 1, 1, block_list);
69 CHECK_AND_ASSERT_MES(r,
false,
"core::get_blocks failed");
74template<
class concrete_test>
81template<
class concrete_test>
88template<
class concrete_test>
93 if (concrete_test::has_invalid_tx)
99 std::vector<cryptonote::block> block_list;
104 CHECK_EQ(concrete_test::expected_pool_txs_count, c.get_pool_transactions_count());
109 std::vector<cryptonote::block> chain;
111 std::vector<cryptonote::block>
blocks(block_list.begin(), block_list.end());
122template<
bool txs_keeped_by_block>
128 std::vector<cryptonote::tx_source_entry> sources;
130 se.
amount = tx_0.vout[0].amount;
131 se.
push_output(0, boost::get<cryptonote::txout_to_key>(tx_0.vout[0].target).key, se.
amount);
136 sources.push_back(se);
138 sources.push_back(se);
141 de.
addr = alice_account.get_keys().m_account_address;
143 std::vector<cryptonote::tx_destination_entry> destinations;
144 destinations.push_back(de);
147 if (!construct_tx(bob_account.get_keys(), sources, destinations, boost::none, std::vector<uint8_t>(), tx_1))
152 events.push_back(tx_1);
160template<
bool txs_keeped_by_block>
170 auto tx_1_idx = events.size() - 1;
179 events.insert(events.begin() + tx_1_idx, tx_1);
187template<
bool txs_keeped_by_block>
201 events.push_back(tx_blk_2);
209 events.push_back(tx_blk_3);
218template<
bool txs_keeped_by_block>
232 auto tx_1_idx = events.size() - 1;
241 events.insert(events.begin() + tx_1_idx, tx_1);
253template<
bool txs_keeped_by_block>
270 events.push_back(tx_1);
278 events.push_back(tx_2);
bool find_block_chain(const std::vector< test_event_entry > &events, std::vector< cryptonote::block > &blockchain, map_hash2tx_t &mtx, const crypto::hash &head)
Definition chaingen.cpp:1248
uint64_t get_balance(const cryptonote::account_base &addr, const std::vector< cryptonote::block > &blockchain, const map_hash2tx_t &mtx)
Definition chaingen.cpp:1091
#define MAKE_NEXT_BLOCK(VEC_EVENTS, BLK_NAME, PREV_BLOCK, MINER_ACC)
Definition chaingen.h:868
#define DEFINE_TESTS_ERROR_CONTEXT(text)
Definition chaingen.h:1087
std::unordered_map< crypto::hash, const cryptonote::transaction * > map_hash2tx_t
Definition chaingen.h:163
#define CHECK_NOT_EQ(v1, v2)
Definition chaingen.h:1090
#define CHECK_TEST_CONDITION(cond)
Definition chaingen.h:1088
#define MAKE_TX_LIST_START(VEC_EVENTS, SET_NAME, FROM, TO, AMOUNT, HEAD)
Definition chaingen.h:964
#define MAKE_NEXT_BLOCK_TX_LIST(VEC_EVENTS, BLK_NAME, PREV_BLOCK, MINER_ACC, TXLIST)
Definition chaingen.h:896
#define REGISTER_CALLBACK_METHOD(CLASS, METHOD)
Definition chaingen.h:859
#define DO_CALLBACK(VEC_EVENTS, CB_NAME)
Definition chaingen.h:849
#define MAKE_TX_LIST(VEC_EVENTS, SET_NAME, FROM, TO, AMOUNT, HEAD)
Definition chaingen.h:962
#define SET_EVENT_VISITOR_SETT(VEC_EVENTS, SETT)
Definition chaingen.h:982
#define TESTS_DEFAULT_FEE
Definition chaingen.h:1092
#define MAKE_TX(VEC_EVENTS, TX_NAME, FROM, TO, AMOUNT, HEAD)
Definition chaingen.h:932
#define CHECK_EQ(v1, v2)
Definition chaingen.h:1089
#define MAKE_NEXT_BLOCK_TX1(VEC_EVENTS, BLK_NAME, PREV_BLOCK, MINER_ACC, TX1)
Definition chaingen.h:878
handles core cryptonote functionality
Definition cryptonote_core.h:87
Definition cryptonote_basic.h:205
bool mark_invalid_block(cryptonote::core &c, size_t ev_index, const std::vector< test_event_entry > &events)
Definition double_spend.inl:82
cryptonote::block m_last_valid_block
Definition double_spend.h:55
size_t m_invalid_block_index
Definition double_spend.h:57
bool mark_invalid_tx(cryptonote::core &c, size_t ev_index, const std::vector< test_event_entry > &events)
Definition double_spend.inl:75
bool check_double_spend(cryptonote::core &c, size_t ev_index, const std::vector< test_event_entry > &events)
Definition double_spend.inl:89
bool check_block_verification_context(const cryptonote::block_verification_context &bvc, size_t event_idx, const cryptonote::block &block)
Definition double_spend.inl:56
gen_double_spend_base()
Definition double_spend.inl:36
bool check_tx_verification_context(const cryptonote::tx_verification_context &tvc, bool tx_added, size_t event_idx, const cryptonote::transaction &tx)
Definition double_spend.inl:47
bool mark_last_valid_block(cryptonote::core &c, size_t ev_index, const std::vector< test_event_entry > &events)
Definition double_spend.inl:65
size_t m_invalid_tx_index
Definition double_spend.h:56
#define CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW
Definition cryptonote_config.h:44
const size_t invalid_index_value
Definition double_spend.h:34
#define INIT_DOUBLE_SPEND_TEST()
Definition double_spend.h:140
crypto::hash get_block_hash(uint64_t height)
Definition output_distribution.cpp:95
#define blocks
Definition sha512-hash.c:11
Definition verification_context.h:66
bool m_verifivation_failed
Definition verification_context.h:68
Definition cryptonote_basic.h:475
Definition cryptonote_tx_utils.h:75
uint64_t amount
Definition cryptonote_tx_utils.h:77
account_public_address addr
Definition cryptonote_tx_utils.h:78
Definition cryptonote_tx_utils.h:43
crypto::public_key real_out_tx_key
Definition cryptonote_tx_utils.h:48
uint64_t amount
Definition cryptonote_tx_utils.h:51
bool rct
Definition cryptonote_tx_utils.h:52
uint64_t real_output
Definition cryptonote_tx_utils.h:47
uint64_t real_output_in_tx_index
Definition cryptonote_tx_utils.h:50
void push_output(uint64_t idx, const crypto::public_key &k, uint64_t amount)
Definition cryptonote_tx_utils.h:56
Definition verification_context.h:41
bool m_verifivation_failed
Definition verification_context.h:45
@ set_txs_keeped_by_block
Definition chaingen.h:116
bool generate(std::vector< test_event_entry > &events) const
Definition double_spend.inl:254
static const uint64_t send_amount
Definition double_spend.h:116
static const bool has_invalid_tx
Definition double_spend.h:117
static const bool has_invalid_tx
Definition double_spend.h:104
static const uint64_t send_amount
Definition double_spend.h:103
bool generate(std::vector< test_event_entry > &events) const
Definition double_spend.inl:219
bool generate(std::vector< test_event_entry > &events) const
Definition double_spend.inl:188
static const uint64_t send_amount
Definition double_spend.h:90
static const bool has_invalid_tx
Definition double_spend.h:91
static const bool has_invalid_tx
Definition double_spend.h:78
bool generate(std::vector< test_event_entry > &events) const
Definition double_spend.inl:161
static const uint64_t send_amount
Definition double_spend.h:77
bool generate(std::vector< test_event_entry > &events) const
Definition double_spend.inl:123