diff --git a/src/MempoolStatus.cpp b/src/MempoolStatus.cpp index 928e5bb..61e23ed 100644 --- a/src/MempoolStatus.cpp +++ b/src/MempoolStatus.cpp @@ -170,7 +170,7 @@ MempoolStatus::read_mempool() vector input_key_imgs; // public keys and xmr amount of outputs - vector> output_pub_keys; + vector output_pub_keys; // sum xmr in inputs and ouputs in the given tx const array& sum_data = summary_of_in_out_rct( diff --git a/src/page.h b/src/page.h index 99e8dd7..d06b671 100644 --- a/src/page.h +++ b/src/page.h @@ -336,7 +336,7 @@ struct tx_details vector input_key_imgs; // public keys and xmr amount of outputs - vector> output_pub_keys; + vector output_pub_keys; mstch::map get_mstch_map() const @@ -2181,7 +2181,7 @@ show_my_outputs(string tx_hash_str, uint64_t output_idx {0}; - for (tuple& outp: txd.output_pub_keys) + for (output_tuple_with_tag& outp: txd.output_pub_keys) { // get the tx output public key @@ -4236,9 +4236,9 @@ search_txs(vector txs, const string& search_text) // check if output_public_keys matche the search_text - vector>::iterator it2 = + vector::iterator it2 = find_if(begin(txd.output_pub_keys), end(txd.output_pub_keys), - [&](const tuple& tx_out_pk) + [&](const output_tuple_with_tag& tx_out_pk) { return pod_to_hex(std::get<0>(tx_out_pk)) == search_text; }); @@ -5387,7 +5387,7 @@ json_outputs(string tx_hash_str, j_data["outputs"] = json::array(); json& j_outptus = j_data["outputs"]; - for (tuple& outp: txd.output_pub_keys) + for (output_tuple_with_tag& outp: txd.output_pub_keys) { // get the tx output public key @@ -5863,7 +5863,7 @@ find_our_outputs( //j_data["outputs"] = json::array(); //json& j_outptus = j_data["outputs"]; - for (tuple &outp: txd.output_pub_keys) + for (output_tuple_with_tag &outp: txd.output_pub_keys) { // get the tx output public key @@ -6456,7 +6456,7 @@ construct_tx_context(transaction tx, uint16_t with_ring_signatures = 0) uint64_t outputs_xmr_sum {0}; - for (tuple& outp: txd.output_pub_keys) + for (output_tuple_with_tag& outp: txd.output_pub_keys) { // total number of ouputs in the blockchain for this amount @@ -6476,7 +6476,12 @@ construct_tx_context(transaction tx, uint16_t with_ring_signatures = 0) outputs_xmr_sum += std::get<1>(outp); std::stringstream ss; - ss << std::get<2>(outp); + if (std::get<2>(outp)) { + ss << *(std::get<2>(outp)); + } + else { + ss << "-"; + } string view_tag_str = ss.str(); diff --git a/src/tools.cpp b/src/tools.cpp index 1923335..0340552 100644 --- a/src/tools.cpp +++ b/src/tools.cpp @@ -345,7 +345,7 @@ sum_money_in_outputs(const json& _json) array summary_of_in_out_rct( const transaction& tx, - vector>& output_pub_keys, + vector& output_pub_keys, vector& input_key_imgs) { @@ -361,17 +361,24 @@ summary_of_in_out_rct( if (!cryptonote::get_output_public_key(txout, output_pub_key)) { // push empty pair. - output_pub_keys.push_back(tuple{}); + output_pub_keys.push_back(output_tuple_with_tag { + public_key{}, + uint64_t{}, + boost::none + }); continue; } - view_tag output_tag {}; + boost::optional output_tag; if (txout.target.type() == typeid(txout_to_tagged_key)) { output_tag = boost::get< txout_to_tagged_key >(txout.target).view_tag; } - output_pub_keys.push_back(make_tuple(output_pub_key, txout.amount, output_tag)); + output_pub_keys.push_back( + make_tuple(output_pub_key, + txout.amount, + output_tag)); xmr_outputs += txout.amount; } @@ -622,28 +629,35 @@ sum_fees_in_txs(const vector& txs) -vector> +vector get_ouputs(const transaction& tx) { - vector> outputs; + vector outputs; for (const tx_out& txout: tx.vout) { public_key output_pub_key; if (!cryptonote::get_output_public_key(txout, output_pub_key)) { - // push empty pair. - outputs.push_back(tuple{}); + // push empty tuple. + outputs.push_back(output_tuple_with_tag { + public_key{}, + uint64_t{}, + boost::none + }); continue; } - view_tag output_tag {}; + boost::optional output_tag; if (txout.target.type() == typeid(txout_to_tagged_key)) { - output_tag = boost::get< txout_to_tagged_key >(txout.target).view_tag; + output_tag = boost::get< txout_to_tagged_key >(txout.target) + .view_tag; } - outputs.push_back(make_tuple(output_pub_key, txout.amount, output_tag)); + outputs.push_back(make_tuple(output_pub_key, + txout.amount, + output_tag)); } return outputs; diff --git a/src/tools.h b/src/tools.h index 1db46cb..164d2a1 100644 --- a/src/tools.h +++ b/src/tools.h @@ -49,6 +49,10 @@ namespace bf = boost::filesystem; using json = nlohmann::json; +using output_tuple_with_tag = tuple>; + struct outputs_visitor { std::vector& m_output_keys; @@ -154,7 +158,7 @@ sum_money_in_outputs(const json& _json); array summary_of_in_out_rct( const transaction& tx, - vector>& output_pub_keys, + vector& output_pub_keys, vector& input_key_imgs); // this version for mempool txs from json @@ -200,7 +204,7 @@ get_mixin_no(const json& _json); vector get_mixin_no_in_txs(const vector& txs); -vector> +vector get_ouputs(const transaction& tx); vector>