From 3a923c26ef5b146c73c2edd73a45d9a3dd099a6e Mon Sep 17 00:00:00 2001 From: moneroexamples Date: Tue, 11 Oct 2016 14:52:58 +0800 Subject: [PATCH] showing outputs amount for signed tx check started --- src/page.h | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/src/page.h b/src/page.h index 9781922..3957b94 100644 --- a/src/page.h +++ b/src/page.h @@ -1475,12 +1475,37 @@ namespace xmreg { for (tools::wallet2::pending_tx& ptx: ptxs) { - // get public keys of real outputs + mstch::map tx_context = construct_tx_context(ptx.tx); + + vector address_amounts; + + // get amounts for stealth addresses + for (tx_destination_entry& dest: ptx.construction_data.destinations) + { + //stealth_address_amount.insert({dest.addr, dest.amount}); + //cout << pod_to_hex(dest.addr) << endl; + address_amounts.push_back(dest.amount); + } + + // get reference to inputs array created of the tx + mstch::array& outputs = boost::get(tx_context["outputs"]); + // mark which mixin is real in each input's mstch context + for (size_t i = 0; i < outputs.size(); ++i) + { + mstch::map& output_map = boost::get(outputs.at(i)); + + //cout << boost::get(output_map["out_pub_key"]) <<", " << address_amounts.at(i) << endl; + cout << boost::get(output_map["out_pub_key"]) << endl; + } + + // get public keys of real outputs vector real_output_pub_keys; vector real_output_indices; vector real_amounts; + uint64_t inputs_xmr_sum {0}; + for (const tx_source_entry& tx_source: ptx.construction_data.sources) { transaction real_source_tx; @@ -1507,13 +1532,16 @@ namespace xmreg { real_output_indices.push_back(tx_source.real_output); real_amounts.push_back(tx_source.amount); - } - mstch::map tx_context = construct_tx_context(ptx.tx); + inputs_xmr_sum += tx_source.amount; + } // mark that we have signed tx data for use in mstch tx_context["have_raw_tx"] = true; + // provide total mount of inputs xmr + tx_context["inputs_xmr_sum"] = fmt::format("{:0.12f}", XMR_AMOUNT(inputs_xmr_sum)); + // get reference to inputs array created of the tx mstch::array& inputs = boost::get(tx_context["inputs"]);