possible spending added

This commit is contained in:
moneroexamples 2017-01-19 02:57:39 +00:00
parent 591b481ec8
commit 1463563ba2
2 changed files with 20 additions and 3 deletions

View file

@ -1346,6 +1346,8 @@ public:
vector<txin_to_key> input_key_imgs = xmreg::get_key_images(tx);
uint64_t sum_mixin_xmr {0};
for (const txin_to_key& in_key: input_key_imgs)
{
@ -1570,6 +1572,8 @@ public:
found_something = true;
show_key_images = true;
sum_mixin_xmr += amount;
}
} // for (const pair<txout_to_key, uint64_t>& mix_out: txd.output_pub_keys)
@ -1595,6 +1599,12 @@ public:
context.emplace("inputs", inputs);
context["show_inputs"] = show_key_images;
context["sum_mixin_xmr"] = xmreg::xmr_amount_to_str(sum_mixin_xmr);
// (outcoming - incoming) - fee
uint64_t possible_spending = (sum_mixin_xmr - sum_xmr) - txd.fee;
context["possible_spending"] = xmreg::xmr_amount_to_str(possible_spending);
// read my_outputs.html
string my_outputs_html = xmreg::read(TMPL_MY_OUTPUTS);

View file

@ -63,7 +63,7 @@
</table>
<h3>
Sum XMR from matched outputs:
Sum XMR from matched outputs (i.e., incoming XMR):
{{#found_our_outputs}}
{{sum_xmr}}
{{/found_our_outputs}}
@ -127,7 +127,14 @@
{{/inputs}}
</div>
<h3>
Sum XMR from matched mixin's outputs: {{sum_mixin_xmr}}
<br/>
<span style="font-size: 16px"> Possible spending is: {{possible_spending}}</span>
<br/>
<span style="font-size: 14px">Note: without private spendkey, it is impossible to know whether this is your real spending.
So do not take this number seriously. It is just a guess.</span>
</h3>
{{/show_inputs}}