error_tx_not_found message added to tx.html

master
moneroexamples 8 years ago
parent 875a92566e
commit 9385852f9e

@ -55,7 +55,7 @@ namespace xmreg
"number of last blocks to be shown on index page")
("mempool-info-timeout", value<string>()->default_value("5000"),
"maximum time, in milliseconds, to wait for mempool data for the front page")
("mempool-refresh-time", value<string>()->default_value("15"),
("mempool-refresh-time", value<string>()->default_value("10"),
"time, in seconds, for each refresh of mempool state")
("bc-path,b", value<string>(),
"path to lmdb folder of the blockchain, e.g., ~/.bitmonero/lmdb")

@ -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<string>(tx_context["error_msg"]);
}
mstch::map context {
{"testnet" , this->testnet},
{"show_cache_times" , show_cache_times},
{"txs" , mstch::array{}}
};
boost::get<mstch::array>(context["txs"]).push_back(tx_context);
map<string, string> partials {

@ -1,8 +1,22 @@
<div>
{{#txs}}
{{>tx_details}}
{{/txs}}
{{#has_error}}
<h4 style="color:red">Attempt failed</h4>
{{#error_tx_not_found}}
<h4>Tx {{tx_hash}} not found. </h4>
<div class="center" style="text-align: center;width:80%">
<p> If this is newly made tx, it can take some time (up to minute)
for it to get propagated to all nodes' mempools.
<br/><br/>
Please refresh in 10-20 seconds to check if its here then.
</p>
</div>
{{/error_tx_not_found}}
{{/has_error}}
{{^has_error}}
{{#txs}}
{{>tx_details}}
{{/txs}}
{{/has_error}}
</div>

Loading…
Cancel
Save