45 const int *out_idx,
int mixin,
uint64_t amount_paid,
bool valid,
46 const std::function<
void(std::vector<tx_source_entry> &sources, std::vector<tx_destination_entry> &destinations)> &pre_tx,
47 const std::function<
void(
transaction &tx)> &post_tx)
const 58 for (
size_t n = 0; n < 4; ++n) {
64 false,
"Failed to generate block");
65 events.push_back(
blocks[n]);
81 false,
"Failed to generate block");
82 events.push_back(blk);
92 for (
size_t n = 0; n < 4; ++n)
94 std::vector<crypto::hash> starting_rct_tx_hashes;
95 std::vector<tx_source_entry> sources;
100 const size_t index_in_tx = 5;
101 src.
amount = 30000000000000;
102 for (
int m = 0; m < 4; ++m) {
114 td.
amount = 7390000000000;
115 std::vector<tx_destination_entry> destinations;
116 destinations.push_back(td);
117 destinations.push_back(td);
118 destinations.push_back(td);
119 destinations.push_back(td);
122 std::vector<crypto::secret_key> additional_tx_keys;
123 std::unordered_map<crypto::public_key, cryptonote::subaddress_index> subaddresses;
125 bool r =
construct_tx_and_get_tx_key(miner_accounts[n].get_keys(), subaddresses, sources, destinations,
cryptonote::account_public_address{}, std::vector<uint8_t>(), rct_txes[n], 0, tx_key, additional_tx_keys,
true);
127 events.push_back(rct_txes[n]);
130 for (
size_t o = 0; o < 4; ++o)
148 false,
"Failed to generate block");
149 events.push_back(blk_txes[n]);
150 blk_last = blk_txes[n];
162 false,
"Failed to generate block");
163 events.push_back(blk);
170 std::vector<tx_source_entry> sources;
171 size_t global_rct_idx = 6;
173 size_t pre_rct_idx = 0;
174 for (
size_t out_idx_idx = 0; out_idx[out_idx_idx] >= 0; ++out_idx_idx) {
175 sources.resize(sources.size()+1);
179 if (out_idx[out_idx_idx]) {
181 src.
amount = 7390000000000;
184 src.
mask = rct_tx_masks[rct_idx];
186 for (
int m = 0; m <= mixin; ++m) {
188 ctkey.
dest = rct::pk2rct(boost::get<txout_to_key>(rct_txes[rct_idx/4].vout[rct_idx&3].target).
key);
190 src.
outputs.push_back(std::make_pair(global_rct_idx, ctkey));
193 if (global_rct_idx % 10 == 0)
200 src.
amount = 5000000000000;
205 for (
int m = 0; m <= mixin; ++m) {
214 td.
addr = miner_account.get_keys().m_account_address;
216 std::vector<tx_destination_entry> destinations;
217 destinations.push_back(td);
220 pre_tx(sources, destinations);
224 std::vector<crypto::secret_key> additional_tx_keys;
225 std::unordered_map<crypto::public_key, cryptonote::subaddress_index> subaddresses;
227 bool r =
construct_tx_and_get_tx_key(miner_accounts[0].get_keys(), subaddresses, sources, destinations,
cryptonote::account_public_address{}, std::vector<uint8_t>(), tx, 0, tx_key, additional_tx_keys,
true);
235 events.push_back(tx);
244 const int out_idx[] = {0, -1};
246 return generate_with(events, out_idx, mixin, amount_paid,
true, NULL, NULL);
252 const int out_idx[] = {1, -1};
254 return generate_with(events, out_idx, mixin, amount_paid,
true, NULL, NULL);
260 const int out_idx[] = {1, 0, -1};
262 return generate_with(events, out_idx, mixin, amount_paid,
true, NULL, NULL);
268 const int out_idx[] = {0, -1};
270 bool tx_creation_succeeded =
false;
272 bool ret = generate_with(events, out_idx, mixin, amount_paid,
false,
273 [](std::vector<tx_source_entry> &sources, std::vector<tx_destination_entry> &destinations) {
rct::key sk;
rct::skpkGen(sk, sources[0].outputs[0].second.dest);},
274 [&tx_creation_succeeded](
const transaction &tx){tx_creation_succeeded=
true;});
275 return !ret && !tx_creation_succeeded;
281 const int out_idx[] = {0, -1};
283 return generate_with(events, out_idx, mixin, amount_paid,
false,
284 [](std::vector<tx_source_entry> &sources, std::vector<tx_destination_entry> &destinations) {sources[0].outputs[0].second.mask =
rct::zeroCommit(99999);},
291 const int out_idx[] = {0, -1};
293 return generate_with(events, out_idx, mixin, amount_paid,
false,
294 [](std::vector<tx_source_entry> &sources, std::vector<tx_destination_entry> &destinations) {
rct::key sk;
rct::skpkGen(sk, sources[0].outputs[1].second.dest);},
301 const int out_idx[] = {0, -1};
303 return generate_with(events, out_idx, mixin, amount_paid,
false,
304 [](std::vector<tx_source_entry> &sources, std::vector<tx_destination_entry> &destinations) {sources[0].outputs[1].second.mask =
rct::zeroCommit(99999);},
311 const int out_idx[] = {1, -1};
313 bool tx_creation_succeeded =
false;
315 bool ret = generate_with(events, out_idx, mixin, amount_paid,
false,
316 [](std::vector<tx_source_entry> &sources, std::vector<tx_destination_entry> &destinations) {
rct::key sk;
rct::skpkGen(sk, sources[0].outputs[0].second.dest);},
317 [&tx_creation_succeeded](
const transaction &tx){tx_creation_succeeded=
true;});
318 return !ret && !tx_creation_succeeded;
324 const int out_idx[] = {1, -1};
326 return generate_with(events, out_idx, mixin, amount_paid,
false,
327 [](std::vector<tx_source_entry> &sources, std::vector<tx_destination_entry> &destinations) {sources[0].outputs[0].second.mask =
rct::zeroCommit(99999);},
334 const int out_idx[] = {1, -1};
336 return generate_with(events, out_idx, mixin, amount_paid,
false,
337 [](std::vector<tx_source_entry> &sources, std::vector<tx_destination_entry> &destinations) {
rct::key sk;
rct::skpkGen(sk, sources[0].outputs[1].second.dest);},
344 const int out_idx[] = {1, -1};
346 return generate_with(events, out_idx, mixin, amount_paid,
false,
347 [](std::vector<tx_source_entry> &sources, std::vector<tx_destination_entry> &destinations) {sources[0].outputs[1].second.mask =
rct::zeroCommit(99999);},
354 const int out_idx[] = {1, -1};
356 return generate_with(events, out_idx, mixin, amount_paid,
false,
357 [](std::vector<tx_source_entry> &sources, std::vector<tx_destination_entry> &destinations) {sources[0].outputs[0].second.mask =
rct::zeroCommit(sources[0].amount); sources[0].mask =
rct::identity();},
358 [](
transaction &tx){boost::get<txin_to_key>(tx.vin[0]).amount = 0;});
364 const int out_idx[] = {0, -1};
366 return generate_with(events, out_idx, mixin, amount_paid,
false,
367 NULL, [](
transaction &tx) {boost::get<txin_to_key>(tx.
vin[0]).amount = 0;});
373 const int out_idx[] = {1, -1};
375 return generate_with(events, out_idx, mixin, amount_paid,
false,
376 NULL, [](
transaction &tx) {boost::get<txin_to_key>(tx.
vin[0]).amount = 5000000000000;});
382 const int out_idx[] = {1, -1};
384 return generate_with(events, out_idx, mixin, amount_paid,
false,
391 const int out_idx[] = {0, -1};
393 return generate_with(events, out_idx, mixin, amount_paid,
false,
394 NULL, [&events](
transaction &tx) {boost::get<txin_to_key>(tx.
vin[0]).k_image = boost::get<txin_to_key>(boost::get<transaction>(events[67]).vin[0]).k_image;});
400 const int out_idx[] = {1, -1};
402 return generate_with(events, out_idx, mixin, amount_paid,
false,
403 NULL, [&events](
transaction &tx) {boost::get<txin_to_key>(tx.
vin[0]).k_image = boost::get<txin_to_key>(boost::get<transaction>(events[67]).vin[0]).k_image;});
409 const int out_idx[] = {0, -1};
412 static const uint8_t k_image[33] =
"\x49\x3b\x56\x16\x54\x76\xa8\x75\xb7\xf4\xa8\x51\xf5\x55\xd3\x44\xe7\x3e\xea\x73\xee\xc1\x06\x7c\x7d\xb6\x57\x28\x46\x85\xe1\x07";
413 return generate_with(events, out_idx, mixin, amount_paid,
false,
420 const int out_idx[] = {1, -1};
423 static const uint8_t k_image[33] =
"\x49\x3b\x56\x16\x54\x76\xa8\x75\xb7\xf4\xa8\x51\xf5\x55\xd3\x44\xe7\x3e\xea\x73\xee\xc1\x06\x7c\x7d\xb6\x57\x28\x46\x85\xe1\x07";
424 return generate_with(events, out_idx, mixin, amount_paid,
false,
431 const int out_idx[] = {0, -1};
433 return generate_with(events, out_idx, mixin, amount_paid,
false,
440 const int out_idx[] = {1, -1};
442 return generate_with(events, out_idx, mixin, amount_paid,
false,
449 const int out_idx[] = {0, -1};
451 return generate_with(events, out_idx, mixin, amount_paid,
false,
458 const int out_idx[] = {0, -1};
460 return generate_with(events, out_idx, mixin, amount_paid,
false,
467 const int out_idx[] = {1, -1};
469 return generate_with(events, out_idx, mixin, amount_paid,
false,
476 const int out_idx[] = {0, -1};
478 return generate_with(events, out_idx, mixin, amount_paid,
false,
485 const int out_idx[] = {1, -1};
487 return generate_with(events, out_idx, mixin, amount_paid,
false,
494 const int out_idx[] = {0, -1};
497 return generate_with(events, out_idx, mixin, amount_paid,
false,
504 const int out_idx[] = {1, -1};
507 return generate_with(events, out_idx, mixin, amount_paid,
false,
#define CRYPTONOTE_MINED_ETN_UNLOCK_WINDOW
void derivation_to_scalar(const key_derivation &derivation, size_t output_index, ec_scalar &res)
crypto::public_key real_out_tx_key
bool generate(std::vector< test_event_entry > &events) const
bool generate(std::vector< test_event_entry > &events) const
bool generate(std::vector< test_event_entry > &events) const
bool generate(std::vector< test_event_entry > &events) const
#define CHECK_AND_ASSERT_MES(expr, fail_ret_val, message)
bool generate(std::vector< test_event_entry > &events) const
crypto::secret_key generate(const crypto::secret_key &recovery_key=crypto::secret_key(), bool recover=false, bool two_random=false)
etn_amount decodeRct(const rctSig &rv, const key &sk, unsigned int i, key &mask, hw::device &hwdev)
bool generate_key_derivation(const public_key &key1, const secret_key &key2, key_derivation &derivation)
std::vector< uint8_t > extra
bool generate(std::vector< test_event_entry > &events) const
const account_keys & get_keys() const
std::vector< tx_out > vout
Holds cryptonote related classes and helpers.
bool generate(std::vector< test_event_entry > &events) const
bool generate(std::vector< test_event_entry > &events) const
std::vector< txin_v > vin
crypto::public_key m_spend_public_key
bool generate(std::vector< test_event_entry > &events) const
bool generate(std::vector< test_event_entry > &events) const
rct::rctSig rct_signatures
bool generate(std::vector< test_event_entry > &events) const
device & get_device(const std::string &device_descriptor)
#define MAKE_GENESIS_BLOCK(VEC_EVENTS, BLK_NAME, MINER_ACC, TS)
bool generate(std::vector< test_event_entry > &events) const
std::string obj_to_json_str(T &obj)
unsigned __int64 uint64_t
bool generate(std::vector< test_event_entry > &events) const
bool generate(std::vector< test_event_entry > &events) const
bool generate(std::vector< test_event_entry > &events) const
bool generate_with(std::vector< test_event_entry > &events, const int *out_idx, int mixin, uint64_t amount_paid, bool valid, const std::function< void(std::vector< cryptonote::tx_source_entry > &sources, std::vector< cryptonote::tx_destination_entry > &destinations)> &pre_tx, const std::function< void(cryptonote::transaction &tx)> &post_tx) const
crypto::public_key get_tx_pub_key_from_extra(const std::vector< uint8_t > &tx_extra, size_t pk_index)
bool generate(std::vector< test_event_entry > &events) const
void push_output(uint64_t idx, const crypto::public_key &k, uint64_t amount)
account_public_address addr
bool generate(std::vector< test_event_entry > &events) const
account_public_address m_account_address
bool generate(std::vector< test_event_entry > &events) const
bool generate(std::vector< test_event_entry > &events) const
bool generate(std::vector< test_event_entry > &events) const
void * memcpy(void *a, const void *b, size_t c)
size_t real_output_in_tx_index
crypto::hash get_transaction_hash(const transaction &t)
void skpkGen(key &sk, key &pk)
bool generate(std::vector< test_event_entry > &events) const
bool add_extra_nonce_to_tx_extra(std::vector< uint8_t > &tx_extra, const blobdata &extra_nonce)
bool generate(std::vector< test_event_entry > &events) const
std::vector< output_entry > outputs
key zeroCommit(etn_amount amount)
#define DIFFICULTY_BLOCKS_ESTIMATE_TIMESPAN
bool generate(std::vector< test_event_entry > &events) const
void set_payment_id_to_tx_extra_nonce(blobdata &extra_nonce, const crypto::hash &payment_id)
bool generate(std::vector< test_event_entry > &events) const
#define GENERATE_ACCOUNT(account)
bool construct_tx_and_get_tx_key(const account_keys &sender_account_keys, const std::unordered_map< crypto::public_key, subaddress_index > &subaddresses, std::vector< tx_source_entry > &sources, std::vector< tx_destination_entry > &destinations, const boost::optional< cryptonote::account_public_address > &change_addr, const std::vector< uint8_t > &extra, transaction &tx, uint64_t unlock_time, crypto::secret_key &tx_key, std::vector< crypto::secret_key > &additional_tx_keys, bool rct, const rct::RCTConfig &rct_config, rct::multisig_out *msout, const uint32_t account_major_offset, const cryptonote::network_type nettype)
#define DO_CALLBACK(VEC_EVENTS, CB_NAME)
bool generate(std::vector< test_event_entry > &events) const
etn_amount decodeRctSimple(const rctSig &rv, const key &sk, unsigned int i, key &mask, hw::device &hwdev)
bool generate(std::vector< test_event_entry > &events) const