|
|
@ -2238,11 +2238,11 @@ public:
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return result_html;
|
|
|
|
return result_html;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(boost::bad_lexical_cast &e)
|
|
|
|
catch(boost::bad_lexical_cast &e)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return result_html;
|
|
|
|
cerr << fmt::format("Parsing {:s} into uint64_t failed", search_text)
|
|
|
|
|
|
|
|
<< endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -2394,8 +2394,6 @@ public:
|
|
|
|
= parse(search_text, "%Y-%m-%d %H:%M")
|
|
|
|
= parse(search_text, "%Y-%m-%d %H:%M")
|
|
|
|
.time_since_epoch().count();
|
|
|
|
.time_since_epoch().count();
|
|
|
|
|
|
|
|
|
|
|
|
cout << "blk_timestamp_utc_start: " << blk_timestamp_utc_start << endl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (blk_timestamp_utc_start)
|
|
|
|
if (blk_timestamp_utc_start)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// seems we have a correct date!
|
|
|
|
// seems we have a correct date!
|
|
|
@ -2404,39 +2402,83 @@ public:
|
|
|
|
uint64_t blk_timestamp_utc_end
|
|
|
|
uint64_t blk_timestamp_utc_end
|
|
|
|
= blk_timestamp_utc_start + 59;
|
|
|
|
= blk_timestamp_utc_start + 59;
|
|
|
|
|
|
|
|
|
|
|
|
// so try to get blocks in the timestamp range
|
|
|
|
all_possible_tx_hashes.push_back(
|
|
|
|
|
|
|
|
make_pair("tx_public_keys", vector<string>{}));
|
|
|
|
|
|
|
|
|
|
|
|
vector<xmreg::output_info> out_infos;
|
|
|
|
vector<string>& txs_found_ref
|
|
|
|
|
|
|
|
= all_possible_tx_hashes.back().second;
|
|
|
|
|
|
|
|
|
|
|
|
if (mylmdb->get_output_info_range(blk_timestamp_utc_start,
|
|
|
|
get_txs_from_timestamp_range(
|
|
|
|
blk_timestamp_utc_end,
|
|
|
|
blk_timestamp_utc_start,
|
|
|
|
out_infos))
|
|
|
|
blk_timestamp_utc_end,
|
|
|
|
{
|
|
|
|
mylmdb,
|
|
|
|
// we found something. add all unique tx found to
|
|
|
|
txs_found_ref);
|
|
|
|
// the vector we are going to show results with
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (search_text.length() == 13)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// check if date given in format: 2015-04-15 12
|
|
|
|
|
|
|
|
// this is 13 characters, i.e., only hour given
|
|
|
|
|
|
|
|
// so search all blocks made within that hour
|
|
|
|
|
|
|
|
|
|
|
|
// auto sort_by_timestamp =
|
|
|
|
// first parse the string to date::sys_seconds and then to timestamp
|
|
|
|
// [](const pair<uint64_t, crypto::hash>& l,
|
|
|
|
// since epoch
|
|
|
|
// const pair<uint64_t, crypto::hash>& r)
|
|
|
|
uint64_t blk_timestamp_utc_start
|
|
|
|
// {
|
|
|
|
= parse(search_text, "%Y-%m-%d %H")
|
|
|
|
// l.first < l.second;
|
|
|
|
.time_since_epoch().count();
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
set<string> unique_tx_found;
|
|
|
|
if (blk_timestamp_utc_start)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// seems we have a correct date!
|
|
|
|
|
|
|
|
|
|
|
|
for (const auto &out_info: out_infos)
|
|
|
|
// add 60 seconds, i.e. 1 hour
|
|
|
|
{
|
|
|
|
uint64_t blk_timestamp_utc_end
|
|
|
|
//cout << " - " << out_info << endl;
|
|
|
|
= blk_timestamp_utc_start + 3599;
|
|
|
|
//unique_tx_found.insert(pod_to_hex(out_info.tx_hash));
|
|
|
|
|
|
|
|
unique_tx_found.insert(pod_to_hex(out_info.tx_hash));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
all_possible_tx_hashes.push_back(
|
|
|
|
all_possible_tx_hashes.push_back(
|
|
|
|
make_pair("tx_public_keys",
|
|
|
|
make_pair("tx_public_keys", vector<string>{}));
|
|
|
|
vector<string>(unique_tx_found.begin(),
|
|
|
|
|
|
|
|
unique_tx_found.end()))
|
|
|
|
vector<string>& txs_found_ref
|
|
|
|
);
|
|
|
|
= all_possible_tx_hashes.back().second;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
get_txs_from_timestamp_range(
|
|
|
|
|
|
|
|
blk_timestamp_utc_start,
|
|
|
|
|
|
|
|
blk_timestamp_utc_end,
|
|
|
|
|
|
|
|
mylmdb,
|
|
|
|
|
|
|
|
txs_found_ref);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (search_text.length() == 10)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// check if date given in format: 2015-04-15
|
|
|
|
|
|
|
|
// this is 10 characters, i.e., only day given
|
|
|
|
|
|
|
|
// so search all blocks made within that day
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// first parse the string to date::sys_seconds and then to timestamp
|
|
|
|
|
|
|
|
// since epoch
|
|
|
|
|
|
|
|
uint64_t blk_timestamp_utc_start
|
|
|
|
|
|
|
|
= parse(search_text, "%Y-%m-%d")
|
|
|
|
|
|
|
|
.time_since_epoch().count();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (blk_timestamp_utc_start)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// seems we have a correct date!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// add 60 seconds, i.e. 1 day
|
|
|
|
|
|
|
|
uint64_t blk_timestamp_utc_end
|
|
|
|
|
|
|
|
= blk_timestamp_utc_start + 86399;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
all_possible_tx_hashes.push_back(
|
|
|
|
|
|
|
|
make_pair("tx_public_keys", vector<string>{}));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vector<string>& txs_found_ref
|
|
|
|
|
|
|
|
= all_possible_tx_hashes.back().second;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
get_txs_from_timestamp_range(
|
|
|
|
|
|
|
|
blk_timestamp_utc_start,
|
|
|
|
|
|
|
|
blk_timestamp_utc_end,
|
|
|
|
|
|
|
|
mylmdb,
|
|
|
|
|
|
|
|
txs_found_ref);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -3464,6 +3506,33 @@ private:
|
|
|
|
return txd;
|
|
|
|
return txd;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
|
|
|
|
get_txs_from_timestamp_range(
|
|
|
|
|
|
|
|
uint64_t timestamp_start,
|
|
|
|
|
|
|
|
uint64_t timestamp_end,
|
|
|
|
|
|
|
|
const unique_ptr<xmreg::MyLMDB>& mylmdb,
|
|
|
|
|
|
|
|
vector<string>& out_txs)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vector<crypto::hash> txs_found;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (mylmdb->get_txs_from_timestamp_range(
|
|
|
|
|
|
|
|
timestamp_start,
|
|
|
|
|
|
|
|
timestamp_end,
|
|
|
|
|
|
|
|
txs_found))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (auto tf: txs_found)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
out_txs.push_back(pod_to_hex(tf));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
vector<pair<tx_info, transaction>>
|
|
|
|
vector<pair<tx_info, transaction>>
|
|
|
|
search_mempool(crypto::hash tx_hash = null_hash)
|
|
|
|
search_mempool(crypto::hash tx_hash = null_hash)
|
|
|
|
{
|
|
|
|
{
|
|
|
|