mirror of
https://git.wownero.com/wownero/onion-wownero-blockchain-explorer.git
synced 2024-08-15 00:33:12 +00:00
Checking if lmdb2 exists or not, before trying to use the custom lmdb database for searching things.
This commit is contained in:
parent
9f7cbc38b9
commit
f52905f08c
3 changed files with 188 additions and 170 deletions
|
@ -12,7 +12,9 @@ set(SOURCE_FILES
|
|||
MicroCore.cpp
|
||||
tools.cpp
|
||||
CmdLineOptions.cpp
|
||||
tx_details.cpp page.cpp page.h rpccalls.cpp rpccalls.h)
|
||||
tx_details.cpp
|
||||
page.h
|
||||
rpccalls.cpp rpccalls.h)
|
||||
|
||||
# make static library called libmyxrm
|
||||
# that we are going to link to
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
//
|
||||
// Created by mwo on 8/04/16.
|
||||
//
|
||||
|
||||
#include "page.h"
|
43
src/page.h
43
src/page.h
|
@ -1447,12 +1447,21 @@ namespace xmreg {
|
|||
vector<pair<string, vector<string>>> all_possible_tx_hashes;
|
||||
|
||||
|
||||
xmreg::MyLMDB mylmdb {lmdb2_path};
|
||||
|
||||
// search the custum lmdb for key_images and append the result
|
||||
// to those from the mempool search if found
|
||||
|
||||
mylmdb.search(search_text,
|
||||
try
|
||||
{
|
||||
unique_ptr<xmreg::MyLMDB> mylmdb;
|
||||
|
||||
if (!bf::is_directory(lmdb2_path))
|
||||
{
|
||||
throw std::runtime_error(lmdb2_path + " does not exist");
|
||||
}
|
||||
|
||||
mylmdb = make_unique<xmreg::MyLMDB>(lmdb2_path);
|
||||
|
||||
|
||||
mylmdb->search(search_text,
|
||||
tx_search_results["key_images"],
|
||||
"key_images");
|
||||
|
||||
|
@ -1466,7 +1475,7 @@ namespace xmreg {
|
|||
// search the custum lmdb for tx_public_keys and append the result
|
||||
// to those from the mempool search if found
|
||||
|
||||
mylmdb.search(search_text,
|
||||
mylmdb->search(search_text,
|
||||
tx_search_results["tx_public_keys"],
|
||||
"tx_public_keys");
|
||||
|
||||
|
@ -1477,7 +1486,7 @@ namespace xmreg {
|
|||
// search the custum lmdb for payments_id and append the result
|
||||
// to those from the mempool search if found
|
||||
|
||||
mylmdb.search(search_text,
|
||||
mylmdb->search(search_text,
|
||||
tx_search_results["payments_id"],
|
||||
"payments_id");
|
||||
|
||||
|
@ -1488,7 +1497,7 @@ namespace xmreg {
|
|||
// search the custum lmdb for encrypted_payments_id and append the result
|
||||
// to those from the mempool search if found
|
||||
|
||||
mylmdb.search(search_text,
|
||||
mylmdb->search(search_text,
|
||||
tx_search_results["encrypted_payments_id"],
|
||||
"encrypted_payments_id");
|
||||
|
||||
|
@ -1499,7 +1508,7 @@ namespace xmreg {
|
|||
// search the custum lmdb for output_public_keys and append the result
|
||||
// to those from the mempool search if found
|
||||
|
||||
mylmdb.search(search_text,
|
||||
mylmdb->search(search_text,
|
||||
tx_search_results["output_public_keys"],
|
||||
"output_public_keys");
|
||||
|
||||
|
@ -1536,7 +1545,7 @@ namespace xmreg {
|
|||
|
||||
vector<string> found_outputs;
|
||||
|
||||
mylmdb.search(output_pub_key,
|
||||
mylmdb->search(output_pub_key,
|
||||
found_outputs,
|
||||
"output_public_keys");
|
||||
|
||||
|
@ -1552,7 +1561,7 @@ namespace xmreg {
|
|||
cerr << "Cant cast global_idx string: "
|
||||
<< search_text.substr(4) << endl;
|
||||
}
|
||||
}
|
||||
} // if (search_for_global_output_idx)
|
||||
|
||||
// seach for output using output amount index and amount
|
||||
|
||||
|
@ -1595,7 +1604,7 @@ namespace xmreg {
|
|||
|
||||
vector<string> found_outputs;
|
||||
|
||||
mylmdb.search(output_pub_key,
|
||||
mylmdb->search(output_pub_key,
|
||||
found_outputs,
|
||||
"output_public_keys");
|
||||
|
||||
|
@ -1619,6 +1628,18 @@ namespace xmreg {
|
|||
return(string("Output not found in the blockchain: ")
|
||||
+ search_text.substr(4));
|
||||
}
|
||||
} // if (search_for_amount_output_idx)
|
||||
}
|
||||
catch (const lmdb::runtime_error& e)
|
||||
{
|
||||
cerr << "Error opening/accessing custom lmdb database: "
|
||||
<< e.what() << endl;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
std::exception_ptr p = std::current_exception();
|
||||
cerr << "Error opening/accessing custom lmdb database: "
|
||||
<< p.__cxa_exception_type()->name() << endl;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue