From 61ab16006d35bac8226a35ccf84ef3da8eaf1368 Mon Sep 17 00:00:00 2001 From: moneroexamples Date: Mon, 26 Dec 2016 12:21:23 +0800 Subject: [PATCH] future: tx prefix hash added to tx info page --- src/page.h | 10 ++++++++++ src/templates/partials/tx_details.html | 1 + 2 files changed, 11 insertions(+) diff --git a/src/page.h b/src/page.h index d6edf9a..797b1a5 100644 --- a/src/page.h +++ b/src/page.h @@ -104,6 +104,7 @@ does_header_has(const crow::request& req, struct tx_details { crypto::hash hash; + crypto::hash prefix_hash; crypto::public_key pk; uint64_t xmr_inputs; uint64_t xmr_outputs; @@ -135,6 +136,8 @@ struct tx_details // remove "<" and ">" from the hash string string tx_hash_str = REMOVE_HASH_BRAKETS(fmt::format("{:s}", hash)); + string tx_prefix_hash_str = REMOVE_HASH_BRAKETS(fmt::format("{:s}", prefix_hash)); + string tx_pk_str = REMOVE_HASH_BRAKETS(fmt::format("{:s}", pk)); //cout << "payment_id: " << payment_id << endl; @@ -158,6 +161,7 @@ struct tx_details mstch::map txd_map { {"hash" , tx_hash_str}, + {"prefix_hash" , tx_prefix_hash_str}, {"pub_key" , tx_pk_str}, {"tx_fee" , fee_str}, {"tx_fee_short" , fee_short_str}, @@ -1146,10 +1150,12 @@ public: string pid_str = REMOVE_HASH_BRAKETS(fmt::format("{:s}", txd.payment_id)); string pid8_str = REMOVE_HASH_BRAKETS(fmt::format("{:s}", txd.payment_id8)); + // initalise page tempate map with basic info about blockchain mstch::map context { {"testnet" , testnet}, {"tx_hash" , tx_hash_str}, + {"tx_prefix_hash" , pod_to_hex(txd.prefix_hash)}, {"xmr_address" , xmr_address_str}, {"viewkey" , viewkey_str}, {"tx_pub_key" , REMOVE_HASH_BRAKETS(fmt::format("{:s}", txd.pk))}, @@ -3715,6 +3721,7 @@ private: mstch::map context { {"testnet" , testnet}, {"tx_hash" , tx_hash_str}, + {"tx_prefix_hash" , pod_to_hex(txd.prefix_hash)}, {"tx_pub_key" , REMOVE_HASH_BRAKETS(fmt::format("{:s}", txd.pk))}, {"blk_height" , tx_blk_height_str}, {"tx_size" , fmt::format("{:0.4f}", @@ -4049,6 +4056,9 @@ private: // get tx hash txd.hash = get_transaction_hash(tx); + // get tx prefix hash + txd.prefix_hash = get_transaction_prefix_hash(tx); + // get tx public key from extra // this check if there are two public keys // due to previous bug with sining txs: diff --git a/src/templates/partials/tx_details.html b/src/templates/partials/tx_details.html index b4d5a1b..bdddc5b 100644 --- a/src/templates/partials/tx_details.html +++ b/src/templates/partials/tx_details.html @@ -2,6 +2,7 @@

Tx hash: {{tx_hash}}

+
Tx prefix hash: {{tx_prefix_hash}}
Tx public key: {{tx_pub_key}}
{{#have_raw_tx}}