diff --git a/src/CmdLineOptions.cpp b/src/CmdLineOptions.cpp index a392fd0..b1fa5cb 100644 --- a/src/CmdLineOptions.cpp +++ b/src/CmdLineOptions.cpp @@ -55,7 +55,7 @@ namespace xmreg "number of last blocks to be shown on index page") ("mempool-info-timeout", value()->default_value("5000"), "maximum time, in milliseconds, to wait for mempool data for the front page") - ("mempool-refresh-time", value()->default_value("15"), + ("mempool-refresh-time", value()->default_value("10"), "time, in seconds, for each refresh of mempool state") ("bc-path,b", value(), "path to lmdb folder of the blockchain, e.g., ~/.bitmonero/lmdb") diff --git a/src/page.h b/src/page.h index ce790c1..55bc758 100644 --- a/src/page.h +++ b/src/page.h @@ -1122,6 +1122,17 @@ namespace xmreg show_tx(string tx_hash_str, uint16_t with_ring_signatures = 0) { + mstch::map context { + {"testnet" , this->testnet}, + {"show_cache_times" , show_cache_times}, + {"has_error" , false}, + {"error_tx_not_found" , false}, + {"error_msg" , string{}}, + {"txs" , mstch::array{}} + }; + + add_css_style(context); + // parse tx hash string to hash object crypto::hash tx_hash; @@ -1136,6 +1147,8 @@ namespace xmreg string blk_timestamp {"N/A"}; + mstch::map tx_context; + // get transaction transaction tx; @@ -1173,11 +1186,15 @@ namespace xmreg else { // tx is nowhere to be found :-( - return string("Cant get tx: " + tx_hash_str); + + context["has_error"] = true; + context["error_tx_not_found"] = true; + context["tx_hash"] = tx_hash_str; + + return mstch::render(template_file["tx"], context); } - } - mstch::map tx_context; + } // if (!mcore->get_tx(tx_hash, tx)) if (enable_tx_cache && tx_context_cache.Contains({tx_hash, with_ring_signatures})) { @@ -1330,12 +1347,6 @@ namespace xmreg return boost::get(tx_context["error_msg"]); } - mstch::map context { - {"testnet" , this->testnet}, - {"show_cache_times" , show_cache_times}, - {"txs" , mstch::array{}} - }; - boost::get(context["txs"]).push_back(tx_context); map partials { diff --git a/src/templates/tx.html b/src/templates/tx.html index a1fca02..e5807d5 100644 --- a/src/templates/tx.html +++ b/src/templates/tx.html @@ -1,8 +1,22 @@
- {{#txs}} - {{>tx_details}} - {{/txs}} - + {{#has_error}} +

Attempt failed

+ {{#error_tx_not_found}} +

Tx {{tx_hash}} not found.

+
+

If this is newly made tx, it can take some time (up to minute) + for it to get propagated to all nodes' mempools. +

+ Please refresh in 10-20 seconds to check if its here then. +

+
+ {{/error_tx_not_found}} + {{/has_error}} + {{^has_error}} + {{#txs}} + {{>tx_details}} + {{/txs}} + {{/has_error}}