ring members output info as hex added
This commit is contained in:
parent
8c8a42656c
commit
2b78eb4ef1
5
main.cpp
5
main.cpp
|
@ -321,6 +321,11 @@ main(int ac, const char* av[])
|
||||||
return crow::response(xmrblocks.show_tx_hex(remove_bad_chars(tx_hash)));
|
return crow::response(xmrblocks.show_tx_hex(remove_bad_chars(tx_hash)));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
CROW_ROUTE(app, "/ringmembershex/<string>")
|
||||||
|
([&](string tx_hash) {
|
||||||
|
return crow::response(xmrblocks.show_ringmembers_hex(remove_bad_chars(tx_hash)));
|
||||||
|
});
|
||||||
|
|
||||||
CROW_ROUTE(app, "/blockhex/<uint>")
|
CROW_ROUTE(app, "/blockhex/<uint>")
|
||||||
([&](size_t block_height) {
|
([&](size_t block_height) {
|
||||||
return crow::response(xmrblocks.show_block_hex(block_height, false));
|
return crow::response(xmrblocks.show_block_hex(block_height, false));
|
||||||
|
|
93
src/page.h
93
src/page.h
|
@ -1697,6 +1697,96 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string
|
||||||
|
show_ringmembers_hex(string const& tx_hash_str)
|
||||||
|
{
|
||||||
|
crypto::hash tx_hash;
|
||||||
|
|
||||||
|
if (!epee::string_tools::hex_to_pod(tx_hash_str, tx_hash))
|
||||||
|
{
|
||||||
|
string msg = fmt::format("Cant parse {:s} as tx hash!", tx_hash_str);
|
||||||
|
cerr << msg << endl;
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
// get transaction
|
||||||
|
transaction tx;
|
||||||
|
|
||||||
|
if (!mcore->get_tx(tx_hash, tx))
|
||||||
|
{
|
||||||
|
cerr << "Cant get tx in blockchain: " << tx_hash
|
||||||
|
<< ". \n Check mempool now" << endl;
|
||||||
|
|
||||||
|
vector<MempoolStatus::mempool_tx> found_txs;
|
||||||
|
|
||||||
|
search_mempool(tx_hash, found_txs);
|
||||||
|
|
||||||
|
if (found_txs.empty())
|
||||||
|
{
|
||||||
|
// tx is nowhere to be found :-(
|
||||||
|
return string("Cant get tx: " + tx_hash_str);
|
||||||
|
}
|
||||||
|
|
||||||
|
tx = found_txs.at(0).tx;
|
||||||
|
}
|
||||||
|
|
||||||
|
vector<txin_to_key> input_key_imgs = xmreg::get_key_images(tx);
|
||||||
|
|
||||||
|
std::vector<string> all_mixin_outputs;
|
||||||
|
|
||||||
|
// make timescale maps for mixins in input
|
||||||
|
for (txin_to_key const& in_key: input_key_imgs)
|
||||||
|
{
|
||||||
|
// get absolute offsets of mixins
|
||||||
|
std::vector<uint64_t> absolute_offsets
|
||||||
|
= cryptonote::relative_output_offsets_to_absolute(
|
||||||
|
in_key.key_offsets);
|
||||||
|
|
||||||
|
// get public keys of outputs used in the mixins that
|
||||||
|
// match to the offests
|
||||||
|
std::vector<cryptonote::output_data_t> mixin_outputs;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// before proceeding with geting the outputs based on
|
||||||
|
// the amount and absolute offset
|
||||||
|
// check how many outputs there are for that amount
|
||||||
|
// go to next input if a too large offset was found
|
||||||
|
if (are_absolute_offsets_good(absolute_offsets, in_key) == false)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
core_storage->get_db().get_output_key(in_key.amount,
|
||||||
|
absolute_offsets,
|
||||||
|
mixin_outputs);
|
||||||
|
}
|
||||||
|
catch (const OUTPUT_DNE& e)
|
||||||
|
{
|
||||||
|
cerr << "get_output_keys: " << e.what() << endl;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto const& mo: mixin_outputs)
|
||||||
|
{
|
||||||
|
all_mixin_outputs.emplace_back(pod_to_hex(mo));
|
||||||
|
}
|
||||||
|
|
||||||
|
} // for (txin_to_key const& in_key: input_key_imgs)
|
||||||
|
|
||||||
|
if (all_mixin_outputs.empty())
|
||||||
|
return string {"No ring members to serialize"};
|
||||||
|
|
||||||
|
|
||||||
|
std::ostringstream oss;
|
||||||
|
boost::archive::portable_binary_oarchive archive(oss);
|
||||||
|
archive << all_mixin_outputs;
|
||||||
|
|
||||||
|
return epee::string_tools
|
||||||
|
::buff_to_hex_nodelimer(oss.str());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
string
|
string
|
||||||
show_my_outputs(string tx_hash_str,
|
show_my_outputs(string tx_hash_str,
|
||||||
string xmr_address_str,
|
string xmr_address_str,
|
||||||
|
@ -2114,7 +2204,8 @@ public:
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// before proceeding with geting the outputs based on the amount and absolute offset
|
// before proceeding with geting the outputs based on
|
||||||
|
// the amount and absolute offset
|
||||||
// check how many outputs there are for that amount
|
// check how many outputs there are for that amount
|
||||||
// go to next input if a too large offset was found
|
// go to next input if a too large offset was found
|
||||||
if (are_absolute_offsets_good(absolute_offsets, in_key) == false)
|
if (are_absolute_offsets_good(absolute_offsets, in_key) == false)
|
||||||
|
|
|
@ -535,6 +535,7 @@
|
||||||
<a href="/tx/{{tx_hash}}/1">More details</a>
|
<a href="/tx/{{tx_hash}}/1">More details</a>
|
||||||
{{#enable_as_hex}}
|
{{#enable_as_hex}}
|
||||||
| <a href="/txhex/{{tx_hash}}">Tx as hex</a>
|
| <a href="/txhex/{{tx_hash}}">Tx as hex</a>
|
||||||
|
| <a href="/ringmembershex/{{tx_hash}}">Tx ring members as hex</a>
|
||||||
{{/enable_as_hex}}
|
{{/enable_as_hex}}
|
||||||
</h5>
|
</h5>
|
||||||
{{/show_more_details_link}}
|
{{/show_more_details_link}}
|
||||||
|
|
Loading…
Reference in New Issue