mirror of
https://git.wownero.com/wownero/onion-wownero-blockchain-explorer.git
synced 2024-08-15 00:33:12 +00:00
Searching for block height added
This commit is contained in:
parent
9235222a60
commit
dcd2c790d6
1 changed files with 26 additions and 7 deletions
33
src/page.h
33
src/page.h
|
@ -861,25 +861,44 @@ namespace xmreg {
|
||||||
string
|
string
|
||||||
search(const string& search_text)
|
search(const string& search_text)
|
||||||
{
|
{
|
||||||
// first let try searching for tx
|
|
||||||
// parse tx hash string to hash object
|
string result_html {"No such thing found: " + search_text};
|
||||||
string result_html = show_tx(search_text);
|
|
||||||
|
|
||||||
|
// first check if searching for block of given height
|
||||||
|
if (search_text.size() < 12)
|
||||||
|
{
|
||||||
|
result_html = show_block(boost::lexical_cast<uint64_t>(search_text));
|
||||||
|
}
|
||||||
|
|
||||||
// nasty check if output is "Cant get" as a sign of
|
// nasty check if output is "Cant get" as a sign of
|
||||||
// a not found tx. Later need to think of something better.
|
// a not found tx. Later need to think of something better.
|
||||||
if (result_html.find("Cant get") == std::string::npos) {
|
if (result_html.find("Cant get") == string::npos)
|
||||||
|
{
|
||||||
return result_html;
|
return result_html;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if tx search not successful, check if we are looking for block
|
// second let try searching for tx
|
||||||
|
result_html = show_tx(search_text);
|
||||||
|
|
||||||
|
// nasty check if output is "Cant get" as a sign of
|
||||||
|
// a not found tx. Later need to think of something better.
|
||||||
|
if (result_html.find("Cant get") == string::npos)
|
||||||
|
{
|
||||||
|
return result_html;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if tx search not successful, check if we are looking
|
||||||
|
// for a block with given hash
|
||||||
result_html = show_block(search_text);
|
result_html = show_block(search_text);
|
||||||
|
|
||||||
if (result_html.find("Cant get") == std::string::npos) {
|
if (result_html.find("Cant get") == string::npos)
|
||||||
|
{
|
||||||
return result_html;
|
return result_html;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return "No such thing found: " + search_text;
|
return result_html;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue