From c47d53f6e065e615af7053e91c5fd6201009dad8 Mon Sep 17 00:00:00 2001 From: moneroexamples Date: Sat, 30 Apr 2016 10:17:47 +0800 Subject: [PATCH] showing tx with and without ring signatures added --- main.cpp | 5 +++++ src/page.h | 31 ++++++++++++++++--------------- src/templates/tx.html | 11 +++++++++++ 3 files changed, 32 insertions(+), 15 deletions(-) diff --git a/main.cpp b/main.cpp index e26ee8e..52d7873 100644 --- a/main.cpp +++ b/main.cpp @@ -94,6 +94,11 @@ int main(int ac, const char* av[]) { return xmrblocks.show_tx(tx_hash); }); + CROW_ROUTE(app, "/tx//") + ([&](string tx_hash, uint with_ring_signatures) { + return xmrblocks.show_tx(tx_hash, with_ring_signatures); + }); + CROW_ROUTE(app, "/search").methods("GET"_method) ([&](const crow::request& req) { diff --git a/src/page.h b/src/page.h index aee4fd9..87b9aa2 100644 --- a/src/page.h +++ b/src/page.h @@ -620,7 +620,7 @@ namespace xmreg { } 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 @@ -715,20 +715,21 @@ namespace xmreg { // initalise page tempate map with basic info about blockchain mstch::map context { - {"tx_hash" , tx_hash_str}, - {"tx_pub_key" , REMOVE_HASH_BRAKETS(fmt::format("{:s}", txd.pk))}, - {"blk_height" , tx_blk_height_str}, - {"tx_size" , fmt::format("{:0.4f}", - static_cast(txd.size) / 1024.0)}, - {"tx_fee" , fmt::format("{:0.12f}", XMR_AMOUNT(txd.fee))}, - {"blk_timestamp" , blk_timestamp}, - {"delta_time" , age.first}, - {"inputs_no" , txd.input_key_imgs.size()}, - {"outputs_no" , txd.output_pub_keys.size()}, - {"has_payment_id" , txd.payment_id != null_hash}, - {"has_payment_id8" , txd.payment_id8 != null_hash8}, - {"payment_id" , pid_str}, - {"payment_id8" , pid8_str}, + {"tx_hash" , tx_hash_str}, + {"tx_pub_key" , REMOVE_HASH_BRAKETS(fmt::format("{:s}", txd.pk))}, + {"blk_height" , tx_blk_height_str}, + {"tx_size" , fmt::format("{:0.4f}", + static_cast(txd.size) / 1024.0)}, + {"tx_fee" , fmt::format("{:0.12f}", XMR_AMOUNT(txd.fee))}, + {"blk_timestamp" , blk_timestamp}, + {"delta_time" , age.first}, + {"inputs_no" , txd.input_key_imgs.size()}, + {"outputs_no" , txd.output_pub_keys.size()}, + {"has_payment_id" , txd.payment_id != null_hash}, + {"has_payment_id8" , txd.payment_id8 != null_hash8}, + {"payment_id" , pid_str}, + {"payment_id8" , pid8_str}, + {"with_ring_signatures" , static_cast(with_ring_signatures)} }; string server_time_str = xmreg::timestamp_to_str(server_timestamp, "%F"); diff --git a/src/templates/tx.html b/src/templates/tx.html index 7733690..5a927c9 100644 --- a/src/templates/tx.html +++ b/src/templates/tx.html @@ -97,6 +97,8 @@ + {{#with_ring_signatures}} + @@ -112,10 +114,19 @@ + {{/with_ring_signatures}} {{/inputs}}
+ + {{^with_ring_signatures}} +
Show this tx with ring signature for each input
+ {{/with_ring_signatures}} + {{#with_ring_signatures}} +
Show this tx without ring signature for each input
+ {{/with_ring_signatures}} +