48{
50
53
54
55 cryptonote::account_base miner_accounts[4];
56 const cryptonote::block *prev_block = &blk_0;
57 cryptonote::block blocks[4];
58 for (size_t n = 0; n < 4; ++n) {
60 CHECK_AND_ASSERT_MES(generator.construct_block_manually(blocks[n], *prev_block, miner_accounts[n],
63 crypto::hash(), 0, transaction(), std::vector<crypto::hash>(), 0, 0, 2),
64 false, "Failed to generate block");
65 events.push_back(blocks[n]);
66 prev_block = blocks + n;
68 }
69
70
71 cryptonote::block blk_r, blk_last;
72 {
73 blk_last = blocks[3];
75 {
76 cryptonote::block blk;
80 crypto::hash(), 0, transaction(), std::vector<crypto::hash>(), 0, 0, 2),
81 false, "Failed to generate block");
82 events.push_back(blk);
83 blk_last = blk;
84 }
85 blk_r = blk_last;
86 }
87
88
89 transaction rct_txes[4];
90 rct::key rct_tx_masks[16];
91 cryptonote::block blk_txes[4];
92 for (size_t n = 0; n < 4; ++n)
93 {
94 std::vector<crypto::hash> starting_rct_tx_hashes;
95 std::vector<tx_source_entry> sources;
96
97 sources.resize(1);
98 tx_source_entry& src = sources.back();
99
100 const size_t index_in_tx = 5;
101 src.
amount = 30000000000000;
102 for (int m = 0; m < 4; ++m) {
103 src.
push_output(m, boost::get<txout_to_key>(blocks[m].miner_tx.vout[index_in_tx].target).key, src.
amount);
104 }
110
111
112 tx_destination_entry td;
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);
120
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]);
129
130 for (size_t o = 0; o < 4; ++o)
131 {
140 else
142 }
143
147 crypto::hash(), 0, transaction(), starting_rct_tx_hashes, 0, 6, 4),
148 false, "Failed to generate block");
149 events.push_back(blk_txes[n]);
150 blk_last = blk_txes[n];
151 }
152
153
154 {
156 {
157 cryptonote::block blk;
161 crypto::hash(), 0, transaction(), std::vector<crypto::hash>(), 0, 6, 4),
162 false, "Failed to generate block");
163 events.push_back(blk);
164 blk_last = blk;
165 }
166 blk_r = blk_last;
167 }
168
169
170 std::vector<tx_source_entry> sources;
171 size_t global_rct_idx = 6;
172 size_t rct_idx = 0;
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);
176 tx_source_entry& src = sources.back();
177
179 if (out_idx[out_idx_idx]) {
180
181 src.
amount = 7390000000000;
184 src.
mask = rct_tx_masks[rct_idx];
186 for (int m = 0; m <= mixin; ++m) {
187 rct::ctkey ctkey;
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));
191 ++rct_idx;
192 ++global_rct_idx;
193 if (global_rct_idx % 10 == 0)
194 global_rct_idx += 6;
195 }
196 }
197 else
198 {
199
200 src.
amount = 5000000000000;
205 for (int m = 0; m <= mixin; ++m) {
206 src.
push_output(m, boost::get<txout_to_key>(blocks[pre_rct_idx].miner_tx.vout[4].target).key, src.
amount);
207 ++pre_rct_idx;
208 }
209 }
210 }
211
212
213 tx_destination_entry td;
214 td.
addr = miner_account.get_keys().m_account_address;
216 std::vector<tx_destination_entry> destinations;
217 destinations.push_back(td);
218
219 if (pre_tx)
220 pre_tx(sources, destinations);
221
222 transaction tx;
224 std::vector<crypto::secret_key> additional_tx_keys;
225 std::unordered_map<crypto::public_key, cryptonote::subaddress_index> subaddresses;
226 subaddresses[miner_accounts[0].get_keys().m_account_address.m_spend_public_key] = {0,0};
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);
229
230 if (post_tx)
231 post_tx(tx);
232
233 if (!valid)
235 events.push_back(tx);
237
238 return true;
239}
#define MAKE_GENESIS_BLOCK(VEC_EVENTS, BLK_NAME, MINER_ACC, TS)
#define DO_CALLBACK(VEC_EVENTS, CB_NAME)
#define GENERATE_ACCOUNT(account)
crypto::secret_key generate(const crypto::secret_key &recovery_key=crypto::secret_key(), bool recover=false, bool two_random=false)
const account_keys & get_keys() const
rct::rctSig rct_signatures
#define DIFFICULTY_BLOCKS_ESTIMATE_TIMESPAN
#define CRYPTONOTE_MINED_ETN_UNLOCK_WINDOW
#define CHECK_AND_ASSERT_MES(expr, fail_ret_val, message)
epee::mlocked< tools::scrubbed< ec_scalar > > secret_key
bool generate_key_derivation(const public_key &key1, const secret_key &key2, key_derivation &derivation)
void derivation_to_scalar(const key_derivation &derivation, size_t output_index, ec_scalar &res)
std::string obj_to_json_str(T &obj)
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)
crypto::public_key get_tx_pub_key_from_extra(const std::vector< uint8_t > &tx_extra, size_t pk_index)
crypto::hash get_transaction_hash(const transaction &t)
device & get_device(const std::string &device_descriptor)
etn_amount decodeRctSimple(const rctSig &rv, const key &sk, unsigned int i, key &mask, hw::device &hwdev)
etn_amount decodeRct(const rctSig &rv, const key &sk, unsigned int i, key &mask, hw::device &hwdev)
unsigned __int64 uint64_t
account_public_address m_account_address
crypto::public_key m_spend_public_key
account_public_address addr
crypto::public_key real_out_tx_key
std::vector< output_entry > outputs
void push_output(uint64_t idx, const crypto::public_key &k, uint64_t amount)
size_t real_output_in_tx_index