|
|
@ -1447,178 +1447,199 @@ namespace xmreg {
|
|
|
|
vector<pair<string, vector<string>>> all_possible_tx_hashes;
|
|
|
|
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
|
|
|
|
tx_search_results["key_images"],
|
|
|
|
{
|
|
|
|
"key_images");
|
|
|
|
unique_ptr<xmreg::MyLMDB> mylmdb;
|
|
|
|
|
|
|
|
|
|
|
|
cout << "size: " << tx_search_results["key_images"].size() << endl;
|
|
|
|
if (!bf::is_directory(lmdb2_path))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
throw std::runtime_error(lmdb2_path + " does not exist");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
all_possible_tx_hashes.push_back(
|
|
|
|
mylmdb = make_unique<xmreg::MyLMDB>(lmdb2_path);
|
|
|
|
make_pair("key_images",
|
|
|
|
|
|
|
|
tx_search_results["key_images"]));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// search the custum lmdb for tx_public_keys and append the result
|
|
|
|
mylmdb->search(search_text,
|
|
|
|
// to those from the mempool search if found
|
|
|
|
tx_search_results["key_images"],
|
|
|
|
|
|
|
|
"key_images");
|
|
|
|
|
|
|
|
|
|
|
|
mylmdb.search(search_text,
|
|
|
|
cout << "size: " << tx_search_results["key_images"].size() << endl;
|
|
|
|
tx_search_results["tx_public_keys"],
|
|
|
|
|
|
|
|
"tx_public_keys");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
all_possible_tx_hashes.push_back(
|
|
|
|
all_possible_tx_hashes.push_back(
|
|
|
|
make_pair("tx_public_keys",
|
|
|
|
make_pair("key_images",
|
|
|
|
tx_search_results["tx_public_keys"]));
|
|
|
|
tx_search_results["key_images"]));
|
|
|
|
|
|
|
|
|
|
|
|
// search the custum lmdb for payments_id and append the result
|
|
|
|
|
|
|
|
// to those from the mempool search if found
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mylmdb.search(search_text,
|
|
|
|
// search the custum lmdb for tx_public_keys and append the result
|
|
|
|
tx_search_results["payments_id"],
|
|
|
|
// to those from the mempool search if found
|
|
|
|
"payments_id");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
all_possible_tx_hashes.push_back(
|
|
|
|
mylmdb->search(search_text,
|
|
|
|
make_pair("payments_id",
|
|
|
|
tx_search_results["tx_public_keys"],
|
|
|
|
tx_search_results["payments_id"]));
|
|
|
|
"tx_public_keys");
|
|
|
|
|
|
|
|
|
|
|
|
// search the custum lmdb for encrypted_payments_id and append the result
|
|
|
|
all_possible_tx_hashes.push_back(
|
|
|
|
// to those from the mempool search if found
|
|
|
|
make_pair("tx_public_keys",
|
|
|
|
|
|
|
|
tx_search_results["tx_public_keys"]));
|
|
|
|
|
|
|
|
|
|
|
|
mylmdb.search(search_text,
|
|
|
|
// search the custum lmdb for payments_id and append the result
|
|
|
|
tx_search_results["encrypted_payments_id"],
|
|
|
|
// to those from the mempool search if found
|
|
|
|
"encrypted_payments_id");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
all_possible_tx_hashes.push_back(
|
|
|
|
mylmdb->search(search_text,
|
|
|
|
make_pair("encrypted_payments_id",
|
|
|
|
tx_search_results["payments_id"],
|
|
|
|
tx_search_results["encrypted_payments_id"]));
|
|
|
|
"payments_id");
|
|
|
|
|
|
|
|
|
|
|
|
// search the custum lmdb for output_public_keys and append the result
|
|
|
|
all_possible_tx_hashes.push_back(
|
|
|
|
// to those from the mempool search if found
|
|
|
|
make_pair("payments_id",
|
|
|
|
|
|
|
|
tx_search_results["payments_id"]));
|
|
|
|
|
|
|
|
|
|
|
|
mylmdb.search(search_text,
|
|
|
|
// search the custum lmdb for encrypted_payments_id and append the result
|
|
|
|
tx_search_results["output_public_keys"],
|
|
|
|
// to those from the mempool search if found
|
|
|
|
"output_public_keys");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
all_possible_tx_hashes.push_back(
|
|
|
|
mylmdb->search(search_text,
|
|
|
|
make_pair("output_public_keys",
|
|
|
|
tx_search_results["encrypted_payments_id"],
|
|
|
|
tx_search_results["output_public_keys"]));
|
|
|
|
"encrypted_payments_id");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
all_possible_tx_hashes.push_back(
|
|
|
|
|
|
|
|
make_pair("encrypted_payments_id",
|
|
|
|
|
|
|
|
tx_search_results["encrypted_payments_id"]));
|
|
|
|
|
|
|
|
|
|
|
|
// seach for output using output global index
|
|
|
|
// search the custum lmdb for output_public_keys and append the result
|
|
|
|
|
|
|
|
// to those from the mempool search if found
|
|
|
|
|
|
|
|
|
|
|
|
if (search_for_global_output_idx)
|
|
|
|
mylmdb->search(search_text,
|
|
|
|
{
|
|
|
|
tx_search_results["output_public_keys"],
|
|
|
|
try
|
|
|
|
"output_public_keys");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
all_possible_tx_hashes.push_back(
|
|
|
|
|
|
|
|
make_pair("output_public_keys",
|
|
|
|
|
|
|
|
tx_search_results["output_public_keys"]));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// seach for output using output global index
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (search_for_global_output_idx)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
uint64_t global_idx = boost::lexical_cast<uint64_t>(
|
|
|
|
try
|
|
|
|
search_text.substr(4));
|
|
|
|
{
|
|
|
|
|
|
|
|
uint64_t global_idx = boost::lexical_cast<uint64_t>(
|
|
|
|
|
|
|
|
search_text.substr(4));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//cout << "global_idx: " << global_idx << endl;
|
|
|
|
//cout << "global_idx: " << global_idx << endl;
|
|
|
|
|
|
|
|
|
|
|
|
// get info about output of a given global index
|
|
|
|
// get info about output of a given global index
|
|
|
|
output_data_t output_data = core_storage->get_db()
|
|
|
|
output_data_t output_data = core_storage->get_db()
|
|
|
|
.get_output_key(global_idx);
|
|
|
|
.get_output_key(global_idx);
|
|
|
|
|
|
|
|
|
|
|
|
//tx_out_index tx_out = core_storage->get_db()
|
|
|
|
//tx_out_index tx_out = core_storage->get_db()
|
|
|
|
// .get_output_tx_and_index_from_global(global_idx);
|
|
|
|
// .get_output_tx_and_index_from_global(global_idx);
|
|
|
|
|
|
|
|
|
|
|
|
//cout << "tx_out.first: " << tx_out.first << endl;
|
|
|
|
//cout << "tx_out.first: " << tx_out.first << endl;
|
|
|
|
//cout << "tx_out.second: " << tx_out.second << endl;
|
|
|
|
//cout << "tx_out.second: " << tx_out.second << endl;
|
|
|
|
|
|
|
|
|
|
|
|
string output_pub_key = pod_to_hex(output_data.pubkey);
|
|
|
|
string output_pub_key = pod_to_hex(output_data.pubkey);
|
|
|
|
|
|
|
|
|
|
|
|
//cout << "output_pub_key: " << output_pub_key << endl;
|
|
|
|
//cout << "output_pub_key: " << output_pub_key << endl;
|
|
|
|
|
|
|
|
|
|
|
|
vector<string> found_outputs;
|
|
|
|
vector<string> found_outputs;
|
|
|
|
|
|
|
|
|
|
|
|
mylmdb.search(output_pub_key,
|
|
|
|
mylmdb->search(output_pub_key,
|
|
|
|
found_outputs,
|
|
|
|
found_outputs,
|
|
|
|
"output_public_keys");
|
|
|
|
"output_public_keys");
|
|
|
|
|
|
|
|
|
|
|
|
//cout << "found_outputs.size(): " << found_outputs.size() << endl;
|
|
|
|
//cout << "found_outputs.size(): " << found_outputs.size() << endl;
|
|
|
|
|
|
|
|
|
|
|
|
all_possible_tx_hashes.push_back(
|
|
|
|
all_possible_tx_hashes.push_back(
|
|
|
|
make_pair("output_public_keys_based_on_global_idx",
|
|
|
|
make_pair("output_public_keys_based_on_global_idx",
|
|
|
|
found_outputs));
|
|
|
|
found_outputs));
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(boost::bad_lexical_cast &e)
|
|
|
|
catch(boost::bad_lexical_cast &e)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
cerr << "Cant cast global_idx string: "
|
|
|
|
cerr << "Cant cast global_idx string: "
|
|
|
|
<< search_text.substr(4) << endl;
|
|
|
|
<< search_text.substr(4) << endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} // if (search_for_global_output_idx)
|
|
|
|
|
|
|
|
|
|
|
|
// seach for output using output amount index and amount
|
|
|
|
// seach for output using output amount index and amount
|
|
|
|
|
|
|
|
|
|
|
|
if (search_for_amount_output_idx)
|
|
|
|
if (search_for_amount_output_idx)
|
|
|
|
{
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
string str_to_split = search_text.substr(4);
|
|
|
|
string str_to_split = search_text.substr(4);
|
|
|
|
|
|
|
|
|
|
|
|
vector<string> string_parts;
|
|
|
|
vector<string> string_parts;
|
|
|
|
|
|
|
|
|
|
|
|
boost::split(string_parts, str_to_split,
|
|
|
|
boost::split(string_parts, str_to_split,
|
|
|
|
boost::is_any_of("-"));
|
|
|
|
boost::is_any_of("-"));
|
|
|
|
|
|
|
|
|
|
|
|
if (string_parts.size() != 2)
|
|
|
|
if (string_parts.size() != 2)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
throw;
|
|
|
|
throw;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
uint64_t amount_idx = boost::lexical_cast<uint64_t>(
|
|
|
|
uint64_t amount_idx = boost::lexical_cast<uint64_t>(
|
|
|
|
string_parts[0]);
|
|
|
|
string_parts[0]);
|
|
|
|
|
|
|
|
|
|
|
|
uint64_t amount = static_cast<uint64_t>
|
|
|
|
uint64_t amount = static_cast<uint64_t>
|
|
|
|
(boost::lexical_cast<double>(
|
|
|
|
(boost::lexical_cast<double>(
|
|
|
|
string_parts[1]) * 1e12);
|
|
|
|
string_parts[1]) * 1e12);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//cout << "amount_idx: " << amount_idx << endl;
|
|
|
|
//cout << "amount_idx: " << amount_idx << endl;
|
|
|
|
//cout << "amount: " << amount << endl;
|
|
|
|
//cout << "amount: " << amount << endl;
|
|
|
|
|
|
|
|
|
|
|
|
// get info about output of a given global index
|
|
|
|
// get info about output of a given global index
|
|
|
|
output_data_t output_data = core_storage->get_db()
|
|
|
|
output_data_t output_data = core_storage->get_db()
|
|
|
|
.get_output_key(
|
|
|
|
.get_output_key(
|
|
|
|
amount, amount_idx);
|
|
|
|
amount, amount_idx);
|
|
|
|
|
|
|
|
|
|
|
|
string output_pub_key = pod_to_hex(output_data.pubkey);
|
|
|
|
string output_pub_key = pod_to_hex(output_data.pubkey);
|
|
|
|
|
|
|
|
|
|
|
|
//cout << "output_pub_key: " << output_pub_key << endl;
|
|
|
|
//cout << "output_pub_key: " << output_pub_key << endl;
|
|
|
|
|
|
|
|
|
|
|
|
vector<string> found_outputs;
|
|
|
|
vector<string> found_outputs;
|
|
|
|
|
|
|
|
|
|
|
|
mylmdb.search(output_pub_key,
|
|
|
|
mylmdb->search(output_pub_key,
|
|
|
|
found_outputs,
|
|
|
|
found_outputs,
|
|
|
|
"output_public_keys");
|
|
|
|
"output_public_keys");
|
|
|
|
|
|
|
|
|
|
|
|
//cout << "found_outputs.size(): " << found_outputs.size() << endl;
|
|
|
|
//cout << "found_outputs.size(): " << found_outputs.size() << endl;
|
|
|
|
|
|
|
|
|
|
|
|
all_possible_tx_hashes.push_back(
|
|
|
|
all_possible_tx_hashes.push_back(
|
|
|
|
make_pair("output_public_keys_based_on_amount_idx",
|
|
|
|
make_pair("output_public_keys_based_on_amount_idx",
|
|
|
|
found_outputs));
|
|
|
|
found_outputs));
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(boost::bad_lexical_cast& e)
|
|
|
|
catch(boost::bad_lexical_cast& e)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
cerr << "Cant parse amout index and amout string: "
|
|
|
|
cerr << "Cant parse amout index and amout string: "
|
|
|
|
<< search_text.substr(4) << endl;
|
|
|
|
<< search_text.substr(4) << endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(OUTPUT_DNE& e)
|
|
|
|
catch(OUTPUT_DNE& e)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
cerr << "Output not found in the blockchain: "
|
|
|
|
cerr << "Output not found in the blockchain: "
|
|
|
|
<< search_text.substr(4) << endl;
|
|
|
|
<< search_text.substr(4) << endl;
|
|
|
|
|
|
|
|
|
|
|
|
return(string("Output not found in the blockchain: ")
|
|
|
|
return(string("Output not found in the blockchain: ")
|
|
|
|
+ search_text.substr(4));
|
|
|
|
+ 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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|