mirror of
https://git.wownero.com/wownero/onion-wownero-blockchain-explorer.git
synced 2024-08-15 00:33:12 +00:00
started searching block by date
This commit is contained in:
parent
4211e5a5cb
commit
968de0ae09
1 changed files with 30 additions and 1 deletions
31
src/page.h
31
src/page.h
|
@ -2198,6 +2198,36 @@ namespace xmreg {
|
||||||
// such search start with "aoi_", e.g., "aoi_444-23.00"
|
// such search start with "aoi_", e.g., "aoi_444-23.00"
|
||||||
bool search_for_amount_output_idx = (search_text.substr(0, 4) == "aoi_");
|
bool search_for_amount_output_idx = (search_text.substr(0, 4) == "aoi_");
|
||||||
|
|
||||||
|
|
||||||
|
// check if date given in format: 2005-04-55
|
||||||
|
// this is 10 characters
|
||||||
|
if (search_text.length() == 10)
|
||||||
|
{
|
||||||
|
uint64_t estimated_blk_height {0};
|
||||||
|
|
||||||
|
// first parse the string date into boost's ptime object
|
||||||
|
dateparser parser {"%Y-%m-%d"};
|
||||||
|
|
||||||
|
if (parser(search_text))
|
||||||
|
{
|
||||||
|
// seems we have a correct date!
|
||||||
|
// so try to estimate block height from it.
|
||||||
|
|
||||||
|
// estimate blockchain height from the start date provided
|
||||||
|
estimated_blk_height = xmreg::estimate_bc_height(search_text);
|
||||||
|
|
||||||
|
result_html = show_block(estimated_blk_height);
|
||||||
|
|
||||||
|
// 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// first check if searching for block of given height
|
// first check if searching for block of given height
|
||||||
if (search_text.size() < 12 &&
|
if (search_text.size() < 12 &&
|
||||||
(search_for_global_output_idx == false
|
(search_for_global_output_idx == false
|
||||||
|
@ -2275,7 +2305,6 @@ namespace xmreg {
|
||||||
return show_integrated_address_details(address, encrypted_payment_id, testnet);
|
return show_integrated_address_details(address, encrypted_payment_id, testnet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// second let try searching for tx
|
// second let try searching for tx
|
||||||
result_html = show_tx(search_text);
|
result_html = show_tx(search_text);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue