From 1463563ba274821b329ade2942bda77cf1e4ced8 Mon Sep 17 00:00:00 2001 From: moneroexamples Date: Thu, 19 Jan 2017 02:57:39 +0000 Subject: [PATCH] possible spending added --- src/page.h | 12 +++++++++++- src/templates/my_outputs.html | 11 +++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/page.h b/src/page.h index 45c6a0c..c510728 100644 --- a/src/page.h +++ b/src/page.h @@ -1346,6 +1346,8 @@ public: vector 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& mix_out: txd.output_pub_keys) @@ -1594,7 +1598,13 @@ public: context["sum_xmr"] = xmreg::xmr_amount_to_str(sum_xmr); context.emplace("inputs", inputs); - context["show_inputs"] = show_key_images; + 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); diff --git a/src/templates/my_outputs.html b/src/templates/my_outputs.html index d6ed37d..5cfc5d8 100644 --- a/src/templates/my_outputs.html +++ b/src/templates/my_outputs.html @@ -63,7 +63,7 @@

- 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}} - +

+ Sum XMR from matched mixin's outputs: {{sum_mixin_xmr}} +
+ Possible spending is: {{possible_spending}} +
+ 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. +

{{/show_inputs}}