|
|
|
@ -462,18 +462,57 @@ YourMoneroRequests::get_random_outs(const shared_ptr< Session > session, const B
|
|
|
|
|
|
|
|
|
|
for (const COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::out_entry& out: outs.outs)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
uint64_t global_amount_index = out.global_amount_index;
|
|
|
|
|
|
|
|
|
|
j_outputs.push_back(json {
|
|
|
|
|
transaction random_output_tx;
|
|
|
|
|
uint64_t output_idx_in_tx;
|
|
|
|
|
|
|
|
|
|
if (!CurrentBlockchainStatus::get_tx_with_output(
|
|
|
|
|
global_amount_index, outs.amount,
|
|
|
|
|
random_output_tx, output_idx_in_tx))
|
|
|
|
|
{
|
|
|
|
|
cerr << "cant get random output transaction" << endl;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//cout << pod_to_hex(out.out_key) << endl;
|
|
|
|
|
//cout << pod_to_hex(get_transaction_hash(random_output_tx)) << endl;
|
|
|
|
|
//cout << output_idx_in_tx << endl;
|
|
|
|
|
|
|
|
|
|
// placeholder variable for ringct outputs info
|
|
|
|
|
// that we need to save in database
|
|
|
|
|
string rtc_outpk;
|
|
|
|
|
string rtc_mask("0", 64);
|
|
|
|
|
string rtc_amount("0", 64);
|
|
|
|
|
|
|
|
|
|
json out_details {
|
|
|
|
|
{"global_index", out.global_amount_index},
|
|
|
|
|
{"public_key" , pod_to_hex(out.out_key)}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (random_output_tx.version > 1 && !is_coinbase(random_output_tx))
|
|
|
|
|
{
|
|
|
|
|
rtc_outpk = pod_to_hex(random_output_tx.rct_signatures.outPk[output_idx_in_tx].mask);
|
|
|
|
|
rtc_mask = pod_to_hex(random_output_tx.rct_signatures.ecdhInfo[output_idx_in_tx].mask);
|
|
|
|
|
rtc_amount = pod_to_hex(random_output_tx.rct_signatures.ecdhInfo[output_idx_in_tx].amount);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
rtc_outpk = pod_to_hex(rct::pk2rct(out.out_key));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
out_details["rct"]= rtc_outpk + rtc_mask + rtc_amount;
|
|
|
|
|
|
|
|
|
|
j_outputs.push_back(out_details);
|
|
|
|
|
|
|
|
|
|
} // for (const COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::out_entry& out: outs.outs)
|
|
|
|
|
|
|
|
|
|
j_amount_outs.push_back(j_outs);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // for (const COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::outs_for_amount& outs: found_outputs)
|
|
|
|
|
|
|
|
|
|
} // if (CurrentBlockchainStatus::get_random_outputs(amounts, count, found_outputs))
|
|
|
|
|
|
|
|
|
|
string response_body = j_response.dump();
|
|
|
|
|
|
|
|
|
|