showing real mixin on timescale added

master
moneroexamples 8 years ago
parent 71f754c2f6
commit 327fb1756f

@ -1478,6 +1478,7 @@ namespace xmreg {
// get public keys of real outputs // get public keys of real outputs
vector<string> real_output_pub_keys; vector<string> real_output_pub_keys;
vector<uint64_t> real_output_indices;
for (const tx_source_entry& tx_source: ptx.construction_data.sources) for (const tx_source_entry& tx_source: ptx.construction_data.sources)
{ {
@ -1502,6 +1503,8 @@ namespace xmreg {
real_output_pub_keys.push_back( real_output_pub_keys.push_back(
REMOVE_HASH_BRAKETS(fmt::format("{:s}",real_out_pub_key)) REMOVE_HASH_BRAKETS(fmt::format("{:s}",real_out_pub_key))
); );
real_output_indices.push_back(tx_source.real_output);
} }
mstch::map tx_context = construct_tx_context(ptx.tx); mstch::map tx_context = construct_tx_context(ptx.tx);
@ -1509,6 +1512,7 @@ namespace xmreg {
// get reference to inputs array created of the tx // get reference to inputs array created of the tx
mstch::array& inputs = boost::get<mstch::array>(tx_context["inputs"]); mstch::array& inputs = boost::get<mstch::array>(tx_context["inputs"]);
// mark which mixin is real in each input's mstch context
for (mstch::node& input_node: inputs) for (mstch::node& input_node: inputs)
{ {
mstch::array& mixins = boost::get<mstch::array>( mstch::array& mixins = boost::get<mstch::array>(
@ -1531,9 +1535,32 @@ namespace xmreg {
mixin["mix_is_it_real"] = true; mixin["mix_is_it_real"] = true;
} }
} }
}
// mark real mixing in the mixins timescale graph
mstch::array& mixins_timescales
= boost::get<mstch::array>(tx_context["timescales"]);
uint64_t idx {0};
for (mstch::node& timescale_node: mixins_timescales)
{
string& timescale = boost::get<string>(
boost::get<mstch::map>(timescale_node)["timescale"]
);
boost::iterator_range<string::iterator> r
= boost::find_nth(timescale, "*", real_output_indices.at(idx));
*(r.begin()) = 'R';
//timescale.insert(*(r.begin()), "<span>*</span>");
++idx;
} }
boost::get<mstch::array>(context["txs"]).push_back(tx_context); boost::get<mstch::array>(context["txs"]).push_back(tx_context);
} }

@ -110,7 +110,8 @@
{{#has_inputs}} {{#has_inputs}}
<h3>Inputs' mixins time scale (from {{min_mix_time}} till {{max_mix_time}}; <h3>Inputs' mixins time scale (from {{min_mix_time}} till {{max_mix_time}};
resolution: {{timescales_scale}} days)</h3> resolution: {{timescales_scale}} days
{{#have_raw_tx}} R - real mixin {{/have_raw_tx}})</h3>
<div class="center"> <div class="center">
<ul class="center"> <ul class="center">
{{#timescales}} {{#timescales}}

@ -590,7 +590,9 @@ namespace xmreg
pair<string, double> pair<string, double>
timestamps_time_scale(const vector<uint64_t>& timestamps, timestamps_time_scale(const vector<uint64_t>& timestamps,
uint64_t timeN, uint64_t resolution, uint64_t time0) uint64_t timeN,
uint64_t resolution,
uint64_t time0)
{ {
string empty_time = string(resolution, '_'); string empty_time = string(resolution, '_');

Loading…
Cancel
Save