amount of outputs of given amount added

master
moneroexamples 9 years ago
parent c7ad1b6127
commit 6e90720b99

@ -1071,10 +1071,9 @@ namespace xmreg {
context["timescales_scale"] = fmt::format("{:0.2f}", context["timescales_scale"] = fmt::format("{:0.2f}",
timescale_scale / 3600.0 / 24.0); // in days timescale_scale / 3600.0 / 24.0); // in days
vector<uint64_t> out_global_indices; // get outputs global indices
vector<uint64_t> out_global_indices =
// get outputs global indices core_storage->get_db().get_tx_amount_output_indices(txd.hash);
core_storage->get_tx_outputs_gindexs(txd.hash, out_global_indices);
uint64_t output_idx {0}; uint64_t output_idx {0};
@ -1082,10 +1081,16 @@ namespace xmreg {
for (pair<txout_to_key, uint64_t>& outp: txd.output_pub_keys) for (pair<txout_to_key, uint64_t>& outp: txd.output_pub_keys)
{ {
// total number of ouputs in the blockchain for this amount
uint64_t num_outputs_amount = core_storage->get_db()
.get_num_outputs(outp.second);
outputs.push_back(mstch::map { outputs.push_back(mstch::map {
{"out_pub_key" , REMOVE_HASH_BRAKETS(fmt::format("{:s}", outp.first.key))}, {"out_pub_key" , REMOVE_HASH_BRAKETS(fmt::format("{:s}", outp.first.key))},
{"amount" , fmt::format("{:0.12f}", XMR_AMOUNT(outp.second))}, {"amount" , fmt::format("{:0.12f}", XMR_AMOUNT(outp.second))},
{"global_idx" , fmt::format("{:02d}", out_global_indices.at(output_idx))}, {"global_idx" , fmt::format("{:d}", out_global_indices.at(output_idx))},
{"num_outputs" , fmt::format("{:d}", num_outputs_amount)},
{"output_idx" , fmt::format("{:02d}", output_idx++)} {"output_idx" , fmt::format("{:02d}", output_idx++)}
}); });
} }

@ -43,17 +43,19 @@
<h3>Outputs ({{outputs_no}})</h3> <h3>Outputs ({{outputs_no}})</h3>
<div class="center"> <div class="center">
<table class="center" > <table class="center">
<tr> <tr>
<td>Outputs public keys</td> <td>outputs public keys</td>
<td>Global index</td> <td>global index</td>
<td>amount</td> <td>amount</td>
<td>total # of outputs <br/>for this amount</td>
</tr> </tr>
{{#outputs}} {{#outputs}}
<tr> <tr>
<td>{{output_idx}}: {{out_pub_key}}</td> <td>{{output_idx}}: {{out_pub_key}}</td>
<td>{{global_idx}}</td> <td>{{global_idx}}</td>
<td>{{amount}}</td> <td>{{amount}}</td>
<td>{{num_outputs}}</td>
</tr> </tr>
{{/outputs}} {{/outputs}}
</table> </table>

Loading…
Cancel
Save