From cd64eef13ae3c6c4a1a9545fc75abd6357bf95ce Mon Sep 17 00:00:00 2001 From: moneroexamples Date: Mon, 13 Jan 2020 07:25:41 +0800 Subject: [PATCH 1/2] Remove payment id indicators https://github.com/moneroexamples/onion-monero-blockchain-explorer/issues/203 --- main.cpp | 3 --- src/MempoolStatus.cpp | 20 -------------------- src/MempoolStatus.h | 4 ---- src/page.h | 25 ------------------------- src/templates/index2.html | 4 ++-- src/templates/mempool.html | 4 ++-- 6 files changed, 4 insertions(+), 56 deletions(-) diff --git a/main.cpp b/main.cpp index c4324fb..016363f 100644 --- a/main.cpp +++ b/main.cpp @@ -192,9 +192,6 @@ main(int ac, const char* av[]) return EXIT_FAILURE; } - cout << blockchain_path << endl; - - // create instance of our MicroCore // and make pointer to the Blockchain xmreg::MicroCore mcore; diff --git a/src/MempoolStatus.cpp b/src/MempoolStatus.cpp index ccdac23..b55b312 100644 --- a/src/MempoolStatus.cpp +++ b/src/MempoolStatus.cpp @@ -200,26 +200,6 @@ MempoolStatus::read_mempool() last_tx.txsize = fmt::format("{:0.2f}", tx_size); - last_tx.pID = '-'; - - crypto::hash payment_id; - crypto::hash8 payment_id8; - - get_payment_id(tx, payment_id, payment_id8); - - if (payment_id != null_hash) - last_tx.pID = 'l'; // legacy payment id - else if (payment_id8 != null_hash8) - last_tx.pID = 'e'; // encrypted payment id - else if (!get_additional_tx_pub_keys_from_extra(tx).empty()) - { - // if multioutput tx have additional public keys, - // mark it so that it represents that it has at least - // one sub-address - last_tx.pID = 's'; - } - // } // if (hex_to_pod(_tx_info.id_hash, mem_tx_hash)) - } // for (size_t i = 0; i < mempool_tx_info.size(); ++i) diff --git a/src/MempoolStatus.h b/src/MempoolStatus.h index 7459f65..8699c65 100644 --- a/src/MempoolStatus.h +++ b/src/MempoolStatus.h @@ -46,10 +46,6 @@ struct MempoolStatus string xmr_outputs_str; string timestamp_str; string txsize; - - char pID; // '-' - no payment ID, - // 'l' - legacy, long 64 character payment id, - // 'e' - encrypted, short, from integrated addresses }; diff --git a/src/page.h b/src/page.h index 65c0cd3..496b83d 100644 --- a/src/page.h +++ b/src/page.h @@ -323,10 +323,6 @@ struct tx_details bool has_additional_tx_pub_keys {false}; - char pID; // '-' - no payment ID, - // 'l' - legacy, long 64 character payment id, - // 'e' - encrypted, short, from integrated addresses - // 's' - sub-address (avaliable only for multi-output txs) uint64_t unlock_time; uint64_t no_confirmations; vector extra; @@ -395,7 +391,6 @@ struct tx_details {"version" , static_cast(version)}, {"has_payment_id" , payment_id != null_hash}, {"has_payment_id8" , payment_id8 != null_hash8}, - {"pID" , string {pID}}, {"payment_id" , pod_to_hex(payment_id)}, {"confirmations" , no_confirmations}, {"extra" , get_extra_str()}, @@ -939,7 +934,6 @@ mempool(bool add_header_and_footer = false, uint64_t no_of_mempool_tx = 25) {"xmr_outputs" , mempool_tx.xmr_outputs_str}, {"no_inputs" , mempool_tx.no_inputs}, {"no_outputs" , mempool_tx.no_outputs}, - {"pID" , string {mempool_tx.pID}}, {"no_nonrct_inputs", mempool_tx.num_nonrct_inputs}, {"mixin" , mempool_tx.mixin_no}, {"txsize" , mempool_tx.txsize} @@ -6542,8 +6536,6 @@ get_tx_details(const transaction& tx, } } - txd.pID = '-'; // no payment ID - get_payment_id(tx, txd.payment_id, txd.payment_id8); // get tx size in bytes @@ -6551,23 +6543,6 @@ get_tx_details(const transaction& tx, txd.extra = tx.extra; - if (txd.payment_id != null_hash) - { - txd.payment_id_as_ascii = std::string(txd.payment_id.data, crypto::HASH_SIZE); - txd.pID = 'l'; // legacy payment id - } - else if (txd.payment_id8 != null_hash8) - { - txd.pID = 'e'; // encrypted payment id - } - else if (txd.additional_pks.empty() == false) - { - // if multioutput tx have additional public keys, - // mark it so that it represents that it has at least - // one sub-address - txd.pID = 's'; - } - // get tx signatures for each input txd.signatures = tx.signatures; diff --git a/src/templates/index2.html b/src/templates/index2.html index 7c39a2c..f2c6a4c 100644 --- a/src/templates/index2.html +++ b/src/templates/index2.html @@ -83,7 +83,7 @@ transaction hash fee [µɱ] outputs - in/out/pID + in/out tx size [kB] {{#txs}} @@ -94,7 +94,7 @@ {{hash}} {{fee_micro}} {{sum_outputs_short}} - {{no_inputs}}/{{no_outputs}}/{{pID}} + {{no_inputs}}/{{no_outputs}} {{tx_size_short}} {{/txs}} diff --git a/src/templates/mempool.html b/src/templates/mempool.html index ca4bc43..9ec8abc 100644 --- a/src/templates/mempool.html +++ b/src/templates/mempool.html @@ -10,7 +10,7 @@ transaction hash fee/per_kB [µɱ] - in/out/pID + in/out tx size [kB] {{#mempooltxs}} @@ -19,7 +19,7 @@ {{hash}} {{fee}}/{{payed_for_kB}} - {{no_inputs}}/{{no_outputs}}/{{pID}} + {{no_inputs}}/{{no_outputs}} {{txsize}} {{/mempooltxs}} From b60a147b8bc710db9f788336f42894b6d7a5a83f Mon Sep 17 00:00:00 2001 From: moneroexamples Date: Sat, 15 Feb 2020 11:07:52 +0800 Subject: [PATCH 2/2] Remove payment id to ascii conversion https://github.com/moneroexamples/onion-monero-blockchain-explorer/issues/204 --- src/page.h | 6 ------ src/templates/partials/tx_details.html | 1 - 2 files changed, 7 deletions(-) diff --git a/src/page.h b/src/page.h index 496b83d..e170d14 100644 --- a/src/page.h +++ b/src/page.h @@ -330,8 +330,6 @@ struct tx_details crypto::hash payment_id = null_hash; // normal crypto::hash8 payment_id8 = null_hash8; // encrypted - string payment_id_as_ascii; - std::vector> signatures; // key images of inputs @@ -6038,9 +6036,6 @@ construct_tx_context(transaction tx, uint16_t with_ring_signatures = 0) string tx_json = obj_to_json_str(tx); - // use this regex to remove all non friendly characters in payment_id_as_ascii string - static std::regex e {"[^a-zA-Z0-9 ./\\\\!]"}; - double tx_size = static_cast(txd.size) / 1024.0; double payed_for_kB = XMR_AMOUNT(txd.fee) / tx_size; @@ -6069,7 +6064,6 @@ construct_tx_context(transaction tx, uint16_t with_ring_signatures = 0) {"has_payment_id8" , txd.payment_id8 != null_hash8}, {"confirmations" , txd.no_confirmations}, {"payment_id" , pid_str}, - {"payment_id_as_ascii" , remove_bad_chars(txd.payment_id_as_ascii)}, {"payment_id8" , pid8_str}, {"extra" , txd.get_extra_str()}, {"with_ring_signatures" , static_cast( diff --git a/src/templates/partials/tx_details.html b/src/templates/partials/tx_details.html index 7da9d24..ef217fc 100644 --- a/src/templates/partials/tx_details.html +++ b/src/templates/partials/tx_details.html @@ -10,7 +10,6 @@ {{#has_payment_id}}
Payment id: {{payment_id}}
-
Payment id as ascii: {{payment_id_as_ascii}}
{{/has_payment_id}} {{#has_payment_id8}}