more info about inputs and outputs added

master
moneroexamples 9 years ago
parent a73d919389
commit df4a9b9f3f

@ -615,8 +615,14 @@ namespace xmreg {
// for each found output public key find its block to get timestamp // for each found output public key find its block to get timestamp
for (const uint64_t &i: absolute_offsets) for (const uint64_t &i: absolute_offsets)
{ {
// get basic information about mixn's output
cryptonote::output_data_t output_data = outputs.at(count); cryptonote::output_data_t output_data = outputs.at(count);
// get pair pair<crypto::hash, uint64_t> where first is tx hash
// and second is local index of the output i in that tx
tx_out_index tx_out_idx =
core_storage->get_db().get_output_tx_and_index(in_key.amount, i);
// get block of given height, as we want to get its timestamp // get block of given height, as we want to get its timestamp
cryptonote::block blk; cryptonote::block blk;
@ -629,7 +635,11 @@ namespace xmreg {
pair<string, string> mixin_age = get_age(server_timestamp, blk.timestamp); pair<string, string> mixin_age = get_age(server_timestamp, blk.timestamp);
mixins.push_back(mstch::map { mixins.push_back(mstch::map {
{"mix_timestamp" , blk.timestamp}, {"mix_blk" , fmt::format("{:d}", output_data.height)},
{"mix_pub_key" , fmt::format("{:s}", output_data.pubkey)},
{"mix_tx_hash" , fmt::format("{:s}", tx_out_idx.first)},
{"mix_out_indx" , fmt::format("{:d}", tx_out_idx.second)},
{"mix_timestamp" , xmreg::timestamp_to_str(blk.timestamp)},
{"mix_age" , mixin_age.first}, {"mix_age" , mixin_age.first},
{"mix_age_format" , mixin_age.second} {"mix_age_format" , mixin_age.second}
}); });
@ -655,6 +665,19 @@ namespace xmreg {
context["inputs"] = inputs; context["inputs"] = inputs;
context["timescales"] = mixins_timescales; context["timescales"] = mixins_timescales;
mstch::array outputs;
for (pair<txout_to_key, uint64_t>& outp: txd.output_pub_keys)
{
outputs.push_back(mstch::map {
{"out_pub_key" , fmt::format("{:s}", outp.first.key)},
{"amount" , fmt::format("{:0.4f}", XMR_AMOUNT(outp.second))}
});
}
context["outputs"] = outputs;
// read tx.html // read tx.html
string tx_html = xmreg::read(TMPL_TX); string tx_html = xmreg::read(TMPL_TX);

@ -32,20 +32,45 @@
</tr> </tr>
</table> </table>
<h3>Inputs {{inputs_no}}</h3> <h3>Inputs {{inputs_no}}</h3>
<div class="center">
<table class="center"> <table class="center">
<tr> <tr>
<td>key image</td> <td>key image</td>
<td>amount</td> <td>amount</td>
</tr> </tr>
{{#inputs}} {{#inputs}}
<tr> <tr>
<td>{{in_key_img}}</td> <td>{{in_key_img}}</td>
<td>{{amount}}</td> <td>{{amount}}</td>
</tr> </tr>
{{/inputs}} <tr>
<td colspan="2">
<table style="width:100%">
<tr>
<td>pub_key</td>
<td>blk</td>
<td>timestamp</td>
<td>age</td>
</tr>
{{#mixins}}
<tr>
<td><a href="/tx/{{mix_tx_hash}}">{{mix_pub_key}}</a></td> <td>{{mix_blk}}</td> <td>{{mix_timestamp}}</td><td>{{mix_age}}</td>
</tr>
<!-- <tr>
<td>{{mix_tx_hash}}</td> <td>{{mix_out_indx}}</td><td></td><td></td>
</tr>-->
{{/mixins}}
</table>
</td>
</tr>
{{/inputs}}
</table> </table>
</div>
<h3>Mixins time scale</h3> <h3>Mixins time scale</h3>
@ -56,28 +81,20 @@
</ul> </ul>
<h3>Outputs ({{outputs_no}})</h3> <h3>Outputs</h3>
{{#have_txs}} <div class="center">
<table class="center" style="width:80%"> <table class="center" >
<tr> <tr>
<td>hash</td> <td>out_pub_key</td>
<td>outputs</td> <td>amount</td>
<td>fee</td>
<td>mixin no</td>
<td>size [kB]</td>
<td>version</td>
</tr> </tr>
{{#blk_txs}} {{#outputs}}
<tr> <tr>
<td>{{hash}}</td> <td>{{out_pub_key}}</td>
<td>{{sum_outputs}}</td> <td>{{amount}}</td>
<td>{{tx_fee}}</td>
<td>{{mixin}}</td>
<td>{{tx_size}}</td>
<td>{{version}}</td>
</tr> </tr>
{{/blk_txs}} {{/outputs}}
</table> </table>
{{/have_txs}} </div>
</div> </div>

Loading…
Cancel
Save