show "at least" input amount when tx has mixture of known and uknown imputs amounts

master
moneroexamples 8 years ago
parent 918a223c0b
commit f70e7e2db2

@ -4039,6 +4039,14 @@ private:
uint64_t inputs_xmr_sum {0}; uint64_t inputs_xmr_sum {0};
// ringct inputs can be mixture of known amounts (when old outputs)
// are spent, and unknown umounts (makrked in explorer by '?') when
// ringct outputs are spent. thus we totalling input amounts
// in such case, we need to show sum of known umounts, and
// indicate that this is minium sum, as we dont know the unknown
// umounts.
bool have_any_unknown_amount {false};
vector<vector<uint64_t>> mixin_timestamp_groups; vector<vector<uint64_t>> mixin_timestamp_groups;
// make timescale maps for mixins in input // make timescale maps for mixins in input
@ -4089,6 +4097,13 @@ private:
inputs_xmr_sum += in_key.amount; inputs_xmr_sum += in_key.amount;
if (in_key.amount == 0)
{
// if any input has amount equal to zero,
// it is really an unkown amount
have_any_unknown_amount = true;
}
vector<uint64_t> mixin_timestamps; vector<uint64_t> mixin_timestamps;
// get reference to mixins array created above // get reference to mixins array created above
@ -4199,13 +4214,18 @@ private:
max_mix_timestamp max_mix_timestamp
); );
context["have_any_unknown_amount"] = have_any_unknown_amount;
context["inputs_xmr_sum_not_zero"] = (inputs_xmr_sum > 0);
context["inputs_xmr_sum"] = xmreg::xmr_amount_to_str(inputs_xmr_sum); context["inputs_xmr_sum"] = xmreg::xmr_amount_to_str(inputs_xmr_sum);
context["server_time"] = server_time_str; context["server_time"] = server_time_str;
context.emplace("inputs", inputs); context.emplace("inputs", inputs);
context["min_mix_time"] = xmreg::timestamp_to_str(min_mix_timestamp); context["min_mix_time"] = xmreg::timestamp_to_str(min_mix_timestamp);
context["max_mix_time"] = xmreg::timestamp_to_str(max_mix_timestamp); context["max_mix_time"] = xmreg::timestamp_to_str(max_mix_timestamp);
context.emplace("timescales", mixins_timescales.first); context.emplace("timescales", mixins_timescales.first);
context["timescales_scale"] = fmt::format("{:0.2f}", context["timescales_scale"] = fmt::format("{:0.2f}",
mixins_timescales.second / 3600.0 / 24.0); // in days mixins_timescales.second / 3600.0 / 24.0); // in days

@ -137,7 +137,19 @@
</div> </div>
{{^inputs_xmr_sum_not_zero}}
<h3>{{inputs_no}} inputs(s) for total of {{inputs_xmr_sum}} xmr</h3> <h3>{{inputs_no}} inputs(s) for total of {{inputs_xmr_sum}} xmr</h3>
{{/inputs_xmr_sum_not_zero}}
{{#inputs_xmr_sum_not_zero}}
{{^have_any_unknown_amount}}
<h3>{{inputs_no}} inputs(s) for total of {{inputs_xmr_sum}} xmr</h3>
{{/have_any_unknown_amount}}
{{#have_any_unknown_amount}}
<h3>{{inputs_no}} inputs(s) for total of at least {{inputs_xmr_sum}} xmr</h3>
{{/have_any_unknown_amount}}
{{/inputs_xmr_sum_not_zero}}
<div class="center"> <div class="center">
<table class="center"> <table class="center">
{{#inputs}} {{#inputs}}

Loading…
Cancel
Save