started adding info about inputs

master
moneroexamples 9 years ago
parent 5891b30122
commit a73d919389

@ -578,7 +578,9 @@ namespace xmreg {
string server_time_str = xmreg::timestamp_to_str(server_timestamp, "%F"); string server_time_str = xmreg::timestamp_to_str(server_timestamp, "%F");
mstch::array inputs;
mstch::array inputs = mstch::array{};
mstch::array mixins_timescales; mstch::array mixins_timescales;
// make timescale maps for mixins in input // make timescale maps for mixins in input
@ -599,10 +601,16 @@ namespace xmreg {
size_t count = 0; size_t count = 0;
inputs.push_back{mstch::map {
inputs.push_back(mstch::map {
{"in_key_img", fmt::format("{:s}", in_key.k_image)}, {"in_key_img", fmt::format("{:s}", in_key.k_image)},
{"in_amount", amount} {"amount" , fmt::format("{:0.3f}", XMR_AMOUNT(in_key.amount))},
}; {"mixins" , mstch::array{}}
});
// get reference to mixins array created above
mstch::array& mixins = boost::get<mstch::array>(
boost::get<mstch::map>(inputs.back())["mixins"]);
// 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)
@ -618,6 +626,14 @@ namespace xmreg {
return fmt::format("- cant get block of height: {}\n", output_data.height); return fmt::format("- cant get block of height: {}\n", output_data.height);
} }
pair<string, string> mixin_age = get_age(server_timestamp, blk.timestamp);
mixins.push_back(mstch::map {
{"mix_timestamp" , blk.timestamp},
{"mix_age" , mixin_age.first},
{"mix_age_format" , mixin_age.second}
});
// get mixin timestamp from its orginal block // get mixin timestamp from its orginal block
mixin_timestamps.push_back(blk.timestamp); mixin_timestamps.push_back(blk.timestamp);

@ -35,19 +35,15 @@
<h3>Inputs {{inputs_no}}</h3> <h3>Inputs {{inputs_no}}</h3>
<table class="center"> <table class="center">
<tr> <tr>
<td>hash</td> <td>key image</td>
<td>outputs</td> <td>amount</td>
<td>size [kB]</td>
<td>version</td>
</tr> </tr>
{{#coinbase_txs}} {{#inputs}}
<tr> <tr>
<td>{{hash}}</td> <td>{{in_key_img}}</td>
<td>{{sum_outputs}}</td> <td>{{amount}}</td>
<td>{{tx_size}}</td>
<td>{{version}}</td>
</tr> </tr>
{{/coinbase_txs}} {{/inputs}}
</table> </table>

Loading…
Cancel
Save