searching tx in a given minute added corrected

master
moneroexamples 8 years ago
parent 1460bc0c29
commit 53a7b381b8

@ -478,11 +478,8 @@ namespace xmreg
sizeof(key_timestamp)};
lmdb::val info_val;
lmdb::cursor cr = lmdb::cursor::open(rtxn, rdbi);
// set cursor the the first item
if (cr.get(key_to_find, info_val, MDB_SET_RANGE))
{
@ -523,7 +520,6 @@ namespace xmreg
try
{
lmdb::txn rtxn = lmdb::txn::begin(m_env, nullptr, MDB_RDONLY);
lmdb::dbi rdbi = lmdb::dbi::open(rtxn, db_name.c_str(), flags);
@ -531,13 +527,10 @@ namespace xmreg
sizeof(key_timestamp_start)};
lmdb::val info_val;
lmdb::cursor cr = lmdb::cursor::open(rtxn, rdbi);
uint64_t current_timestamp = key_timestamp_start;
// set cursor the the first item
if (cr.get(key_to_find, info_val, MDB_SET_RANGE))
{
@ -547,12 +540,13 @@ namespace xmreg
while (cr.get(key_to_find, info_val, MDB_NEXT))
{
current_timestamp = *key_to_find.data<uint64_t>();
//cout << current_timestamp << endl;
out_infos.push_back(*(info_val.data<output_info>()));
if (current_timestamp > key_timestamp_end)
{
break;
}
out_infos.push_back(*(info_val.data<output_info>()));
}
}
else

@ -2394,6 +2394,8 @@ public:
= parse(search_text, "%Y-%m-%d %H:%M")
.time_since_epoch().count();
cout << "blk_timestamp_utc_start: " << blk_timestamp_utc_start << endl;
if (blk_timestamp_utc_start)
{
// seems we have a correct date!
@ -2413,11 +2415,19 @@ public:
// we found something. add all unique tx found to
// the vector we are going to show results with
// auto sort_by_timestamp =
// [](const pair<uint64_t, crypto::hash>& l,
// const pair<uint64_t, crypto::hash>& r)
// {
// l.first < l.second;
// };
set<string> unique_tx_found;
for (const auto &out_info: out_infos)
{
//cout << " - " << out_info << endl;
//unique_tx_found.insert(pod_to_hex(out_info.tx_hash));
unique_tx_found.insert(pod_to_hex(out_info.tx_hash));
}
@ -2426,7 +2436,6 @@ public:
vector<string>(unique_tx_found.begin(),
unique_tx_found.end()))
);
}
}
}

Loading…
Cancel
Save