moneroexamples 3 years ago
parent c6d8eb0dbe
commit 810f4f5b98

@ -170,7 +170,7 @@ MempoolStatus::read_mempool()
vector<txin_to_key> input_key_imgs;
// public keys and xmr amount of outputs
vector<tuple<public_key, uint64_t, view_tag>> output_pub_keys;
vector<output_tuple_with_tag> output_pub_keys;
// sum xmr in inputs and ouputs in the given tx
const array<uint64_t, 4>& sum_data = summary_of_in_out_rct(

@ -336,7 +336,7 @@ struct tx_details
vector<txin_to_key> input_key_imgs;
// public keys and xmr amount of outputs
vector<tuple<public_key, uint64_t, view_tag>> output_pub_keys;
vector<output_tuple_with_tag> 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<public_key, uint64_t, view_tag>& 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<transaction> txs, const string& search_text)
// check if output_public_keys matche the search_text
vector<tuple<public_key, uint64_t, view_tag>>::iterator it2 =
vector<output_tuple_with_tag>::iterator it2 =
find_if(begin(txd.output_pub_keys), end(txd.output_pub_keys),
[&](const tuple<public_key, uint64_t, view_tag>& 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<public_key, uint64_t, view_tag>& 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<public_key, uint64_t, view_tag> &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<public_key, uint64_t, view_tag>& 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();

@ -345,7 +345,7 @@ sum_money_in_outputs(const json& _json)
array<uint64_t, 4>
summary_of_in_out_rct(
const transaction& tx,
vector<tuple<public_key, uint64_t, view_tag>>& output_pub_keys,
vector<output_tuple_with_tag>& output_pub_keys,
vector<txin_to_key>& 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<public_key, uint64_t, view_tag>{});
output_pub_keys.push_back(output_tuple_with_tag {
public_key{},
uint64_t{},
boost::none
});
continue;
}
view_tag output_tag {};
boost::optional<view_tag> 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<transaction>& txs)
vector<tuple<public_key, uint64_t, view_tag>>
vector<output_tuple_with_tag>
get_ouputs(const transaction& tx)
{
vector<tuple<public_key, uint64_t, view_tag>> outputs;
vector<output_tuple_with_tag> 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<public_key, uint64_t, view_tag>{});
// push empty tuple.
outputs.push_back(output_tuple_with_tag {
public_key{},
uint64_t{},
boost::none
});
continue;
}
view_tag output_tag {};
boost::optional<view_tag> 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;

@ -49,6 +49,10 @@ namespace bf = boost::filesystem;
using json = nlohmann::json;
using output_tuple_with_tag = tuple<public_key,
uint64_t,
boost::optional<view_tag>>;
struct outputs_visitor
{
std::vector<crypto::public_key >& m_output_keys;
@ -154,7 +158,7 @@ sum_money_in_outputs(const json& _json);
array<uint64_t, 4>
summary_of_in_out_rct(
const transaction& tx,
vector<tuple<public_key, uint64_t, view_tag>>& output_pub_keys,
vector<output_tuple_with_tag>& output_pub_keys,
vector<txin_to_key>& input_key_imgs);
// this version for mempool txs from json
@ -200,7 +204,7 @@ get_mixin_no(const json& _json);
vector<uint64_t>
get_mixin_no_in_txs(const vector<transaction>& txs);
vector<tuple<public_key, uint64_t, view_tag>>
vector<output_tuple_with_tag>
get_ouputs(const transaction& tx);
vector<tuple<public_key, uint64_t, uint64_t>>

Loading…
Cancel
Save