diff --git a/src/MicroCore.cpp b/src/MicroCore.cpp index 0ad3ed5..2435868 100644 --- a/src/MicroCore.cpp +++ b/src/MicroCore.cpp @@ -142,22 +142,18 @@ namespace xmreg bool MicroCore::get_tx(const crypto::hash& tx_hash, transaction& tx) { - try + if (m_blockchain_storage.have_tx(tx_hash)) { // get transaction with given hash tx = m_blockchain_storage.get_db().get_tx(tx_hash); } - catch (const cryptonote::TX_DNE & e) - { - cerr << "MicroCore::get_tx cryptonote::TX_DNE: " << e.what() << endl; - return false; - } - catch (const std::exception& e) + else { - cerr << "MicroCore::get_tx: " << e.what() << endl; + cerr << "MicroCore::get_tx tx does not exist in blockchain: " << tx_hash << endl; return false; } + return true; } diff --git a/src/page.h b/src/page.h index 35539f1..981fcee 100644 --- a/src/page.h +++ b/src/page.h @@ -943,7 +943,15 @@ namespace xmreg { } } - mstch::map context = construct_tx_context(tx, with_ring_signatures); + mstch::map tx_context = construct_tx_context(tx, with_ring_signatures); + + mstch::map context {{"txs", mstch::array{}}}; + + boost::get(context["txs"]).push_back(tx_context); + + map partials { + {"tx_details", xmreg::read(string(TMPL_PARIALS_DIR) + "/tx_details.html")}, + }; // read tx.html string tx_html = xmreg::read(TMPL_TX); @@ -952,7 +960,7 @@ namespace xmreg { string full_page = get_full_page(tx_html); // render the page - return mstch::render(full_page, context); + return mstch::render(full_page, context, partials); } string @@ -1462,7 +1470,7 @@ namespace xmreg { std::vector ptxs = signed_txs.ptx; - context.insert({"signed_txs", mstch::array{}}); + context.insert({"txs", mstch::array{}}); for (tools::wallet2::pending_tx& ptx: ptxs) { @@ -1470,7 +1478,7 @@ namespace xmreg { mstch::map txd_map = txd.get_mstch_map(); - boost::get(context["signed_txs"]).push_back(txd_map); + boost::get(context["txs"]).push_back(txd_map); } } diff --git a/src/templates/checkrawtx.html b/src/templates/checkrawtx.html index cbe42f6..724fd98 100644 --- a/src/templates/checkrawtx.html +++ b/src/templates/checkrawtx.html @@ -183,9 +183,9 @@ {{^unsigned_tx_given}}

signed_tx_given

- {{#signed_txs}} + {{#txs}} {{>tx_details}} - {{/signed_txs}} + {{/txs}} {{/unsigned_tx_given}} diff --git a/src/templates/tx.html b/src/templates/tx.html index 92d50f8..a1fca02 100644 --- a/src/templates/tx.html +++ b/src/templates/tx.html @@ -1,197 +1,8 @@
-

Tx hash: {{tx_hash}}

-
Tx public key: {{tx_pub_key}}
- - - {{#has_payment_id}} -
Payment id: {{payment_id}}
- {{/has_payment_id}} - - {{#has_payment_id8}} -
Payment id (encrypted): {{payment_id8}}
- {{/has_payment_id8}} - - - {{#have_prev_hash}} -
Previous tx: {{prev_hash}}
- {{/have_prev_hash}} - - {{#have_next_hash}} -
Next tx: {{next_hash}}
- {{/have_next_hash}} - - - - - - - - - - - - - - - - - - - - - - - -
Timestamp: {{blk_timestamp_uint}}Timestamp [UCT]: {{blk_timestamp}}Age [y:d:h:m:s]: {{delta_time}}
Block: {{blk_height}}Fee: {{tx_fee}}Tx size: {{tx_size}} kB
Tx version: {{tx_version}}
Extra: {{extra}}
- - -

{{outputs_no}} output(s) for total of {{outputs_xmr_sum}} xmr

-
- - - - - - - {{#outputs}} - - - - - - {{/outputs}} -
stealth addressamountamount idx
{{output_idx}}: {{out_pub_key}}{{amount}}{{amount_idx}} of {{num_outputs}}
-
- -
-
- -
- - -
-

Check which outputs belong to given Moenro address and viewkey

-
-
-
-
- -
- -
-
- -
- - - -
-

Prove to someone that you send them Monero in this transaction

-
Tx private key can be obtained using get_tx_key - command in monero-wallet-cli command line tool
-
-
-
-
- -
-
-
-
- -
- - - -{{#has_inputs}} -

Inputs' mixins time scale (from {{min_mix_time}} till {{max_mix_time}}; - resolution: {{timescales_scale}} days)

-
-
    - {{#timescales}} -
  • |{{timescale}}|
  • - {{/timescales}} -
-
- - -

{{inputs_no}} inputs(s) for total of {{inputs_xmr_sum}} xmr

-
- - {{#inputs}} - - - - - - - - - - {{#with_ring_signatures}} - - - - - - {{/with_ring_signatures}} - - - {{/inputs}} -
key image {{input_idx}}: {{in_key_img}}amount: {{amount}}
- - - - - - - - - - {{#mixins}} - - - - - - - - - {{/mixins}} -
Mixin stealth addressblkmixinin/outtimestampage [y:d:h:m:s]
- {{mix_idx}}: {{mix_pub_key}}{{mix_blk}}{{mix_mixin_no}}{{mix_inputs_no}}/{{mix_outputs_no}}{{mix_timestamp}}{{mix_age}}
-
- - - - - {{#ring_sigs}} - - - - {{/ring_sigs}} -
Ring signature
{{ring_sig}}
-
- - - {{^with_ring_signatures}} -
More details
- {{/with_ring_signatures}} - {{#with_ring_signatures}} - -

JSON representaiton of tx

-
- - {{tx_json}} - -
- -
Less details
- {{/with_ring_signatures}} - -
- - {{/has_inputs}} + {{#txs}} + {{>tx_details}} + {{/txs}}