showing tx with and without ring signatures added

This commit is contained in:
moneroexamples 2016-04-30 10:17:47 +08:00
parent 88701d0d91
commit c47d53f6e0
3 changed files with 32 additions and 15 deletions

View File

@ -94,6 +94,11 @@ int main(int ac, const char* av[]) {
return xmrblocks.show_tx(tx_hash); return xmrblocks.show_tx(tx_hash);
}); });
CROW_ROUTE(app, "/tx/<string>/<uint>")
([&](string tx_hash, uint with_ring_signatures) {
return xmrblocks.show_tx(tx_hash, with_ring_signatures);
});
CROW_ROUTE(app, "/search").methods("GET"_method) CROW_ROUTE(app, "/search").methods("GET"_method)
([&](const crow::request& req) { ([&](const crow::request& req) {

View File

@ -620,7 +620,7 @@ namespace xmreg {
} }
string string
show_tx(string tx_hash_str) show_tx(string tx_hash_str, uint with_ring_signatures = 0)
{ {
// parse tx hash string to hash object // parse tx hash string to hash object
@ -729,6 +729,7 @@ namespace xmreg {
{"has_payment_id8" , txd.payment_id8 != null_hash8}, {"has_payment_id8" , txd.payment_id8 != null_hash8},
{"payment_id" , pid_str}, {"payment_id" , pid_str},
{"payment_id8" , pid8_str}, {"payment_id8" , pid8_str},
{"with_ring_signatures" , static_cast<bool>(with_ring_signatures)}
}; };
string server_time_str = xmreg::timestamp_to_str(server_timestamp, "%F"); string server_time_str = xmreg::timestamp_to_str(server_timestamp, "%F");

View File

@ -97,6 +97,8 @@
</tr> </tr>
{{#with_ring_signatures}}
<tr> <tr>
<td colspan="2"> <td colspan="2">
<table style="width:100%; margin-bottom:20px"> <table style="width:100%; margin-bottom:20px">
@ -112,10 +114,19 @@
</td> </td>
</tr> </tr>
{{/with_ring_signatures}}
{{/inputs}} {{/inputs}}
</table> </table>
{{^with_ring_signatures}}
<h5 style="margin-top:1px"><a href="/tx/{{tx_hash}}/1">Show this tx with ring signature for each input</a></h5>
{{/with_ring_signatures}}
{{#with_ring_signatures}}
<h5 style="margin-top:1px"><a href="/tx/{{tx_hash}}">Show this tx without ring signature for each input</a></h5>
{{/with_ring_signatures}}
</div> </div>