43{
45
48
49
50 cryptonote::account_base miner_accounts[4];
51 const cryptonote::block *prev_block = &blk_0;
52 cryptonote::block blocks[4];
53 for (size_t n = 0; n < 4; ++n) {
55 CHECK_AND_ASSERT_MES(generator.construct_block_manually(blocks[n], *prev_block, miner_accounts[n],
58 crypto::hash(), 0, transaction(), std::vector<crypto::hash>(), 0, 0),
59 false, "Failed to generate block");
60 events.push_back(blocks[n]);
61 prev_block = blocks + n;
62 }
63
64
65 cryptonote::block blk_r;
66 {
67 cryptonote::block blk_last = blocks[3];
69 {
70 cryptonote::block blk;
74 crypto::hash(), 0, transaction(), std::vector<crypto::hash>(), 0, 0),
75 false, "Failed to generate block");
76 events.push_back(blk);
77 blk_last = blk;
78 }
79 blk_r = blk_last;
80 }
81
82
83 std::vector<tx_source_entry> sources;
84 for (size_t out_idx_idx = 0; out_idx[out_idx_idx] >= 0; ++out_idx_idx) {
85 sources.resize(sources.size()+1);
86 tx_source_entry& src = sources.back();
87
89 std::cout <<
"using " <<
print_etn(src.
amount) <<
" output at index " << out_idx[out_idx_idx] << std::endl;
90 for (int m = 0; m <= mixin; ++m) {
91 int idx;
93 idx = m+1;
94 else
95 idx = 0;
96 src.
push_output(idx, boost::get<txout_to_key>(blocks[m].miner_tx.vout[out_idx[out_idx_idx]].target).key, src.
amount);
97 }
102 }
103
104
105 tx_destination_entry td;
106 td.
addr = miner_account.get_keys().m_account_address;
108 std::vector<tx_destination_entry> destinations;
109 destinations.push_back(td);
110
111 transaction tx;
112 bool r =
construct_tx(miner_accounts[0].get_keys(), sources, destinations, boost::none, std::vector<uint8_t>(), tx, 0);
114 if (!valid)
116 events.push_back(tx);
117
118 return true;
119}
#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)
std::vector< tx_out > vout
#define DIFFICULTY_BLOCKS_ESTIMATE_TIMESPAN
#define CRYPTONOTE_MINED_ETN_UNLOCK_WINDOW
#define CHECK_AND_ASSERT_MES(expr, fail_ret_val, message)
bool is_valid_decomposed_amount(uint64_t amount)
crypto::public_key get_tx_pub_key_from_extra(const std::vector< uint8_t > &tx_extra, size_t pk_index)
bool construct_tx(const account_keys &sender_account_keys, std::vector< tx_source_entry > &sources, const 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)
std::string print_etn(uint64_t amount, unsigned int decimal_point)
unsigned __int64 uint64_t
account_public_address addr
crypto::public_key real_out_tx_key
void push_output(uint64_t idx, const crypto::public_key &k, uint64_t amount)
size_t real_output_in_tx_index