|
|
@ -1147,12 +1147,18 @@ namespace xmreg {
|
|
|
|
|
|
|
|
|
|
|
|
result_html = default_txt;
|
|
|
|
result_html = default_txt;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// get mempool transaction so that what we search,
|
|
|
|
|
|
|
|
// might be there. Note: show_tx above already searches it
|
|
|
|
|
|
|
|
// but only looks for tx hash. Now want to check
|
|
|
|
|
|
|
|
// for key_images, public_keys, payments_id, etc.
|
|
|
|
|
|
|
|
vector<transaction> mempool_txs = get_mempool_txs();
|
|
|
|
|
|
|
|
|
|
|
|
// now search my own custom lmdb database
|
|
|
|
// now search my own custom lmdb database
|
|
|
|
// with key_images, public_keys, payments_id etc.
|
|
|
|
// with key_images, public_keys, payments_id etc.
|
|
|
|
|
|
|
|
|
|
|
|
vector<pair<string, vector<string>>> all_possible_tx_hashes;
|
|
|
|
vector<pair<string, vector<string>>> all_possible_tx_hashes;
|
|
|
|
|
|
|
|
|
|
|
|
xmreg::MyLMDB mylmdb {"/home/mwo/.bitmonero/lmdb2"};
|
|
|
|
xmreg::MyLMDB mylmdb {mcore->get_blkchain_path()};
|
|
|
|
|
|
|
|
|
|
|
|
vector<string> tx_hashes;
|
|
|
|
vector<string> tx_hashes;
|
|
|
|
mylmdb.search(search_text, tx_hashes, "key_images");
|
|
|
|
mylmdb.search(search_text, tx_hashes, "key_images");
|
|
|
@ -1179,27 +1185,43 @@ namespace xmreg {
|
|
|
|
return result_html;
|
|
|
|
return result_html;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vector<transaction>
|
|
|
|
|
|
|
|
get_mempool_txs()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// get mempool data using rpc call
|
|
|
|
|
|
|
|
vector<pair<tx_info, transaction>> mempool_data = search_mempool();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// output only transactions
|
|
|
|
|
|
|
|
vector<transaction> mempool_txs;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mempool_txs.reserve(mempool_data.size());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (const auto& a_pair: mempool_data)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
mempool_txs.push_back(a_pair.second);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return mempool_txs;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
string
|
|
|
|
string
|
|
|
|
show_search_results(const string& search_text,
|
|
|
|
show_search_results(const string& search_text,
|
|
|
|
const vector<pair<string, vector<string>>>& all_possible_tx_hashes)
|
|
|
|
const vector<pair<string, vector<string>>>& all_possible_tx_hashes)
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
// initalise page tempate map with basic info about blockchain
|
|
|
|
// initalise page tempate map with basic info about blockchain
|
|
|
|
mstch::map context {
|
|
|
|
mstch::map context {
|
|
|
|
{"search_text", search_text},
|
|
|
|
{"search_text" , search_text},
|
|
|
|
{"no_results" , true},
|
|
|
|
{"no_results" , true},
|
|
|
|
{"to_many_results", false}
|
|
|
|
{"to_many_results", false}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
for (const pair<string, vector<string>>& found_txs: all_possible_tx_hashes)
|
|
|
|
for (const pair<string, vector<string>>& found_txs: all_possible_tx_hashes)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
// define flag, e.g., has_key_images denoting that
|
|
|
|
// define flag, e.g., has_key_images denoting that
|
|
|
|
// tx hashes for key_image searched were found
|
|
|
|
// tx hashes for key_image searched were found
|
|
|
|
context.insert({"has_" + found_txs.first, !found_txs.second.empty()});
|
|
|
|
context.insert({"has_" + found_txs.first, !found_txs.second.empty()});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// insert new array based on what we found to context if not exist
|
|
|
|
// insert new array based on what we found to context if not exist
|
|
|
|
pair< mstch::map::iterator, bool> res
|
|
|
|
pair< mstch::map::iterator, bool> res
|
|
|
|
= context.insert({found_txs.first, mstch::array{}});
|
|
|
|
= context.insert({found_txs.first, mstch::array{}});
|
|
|
@ -1226,8 +1248,10 @@ namespace xmreg {
|
|
|
|
mstch::map txd_map = txd.get_mstch_map();
|
|
|
|
mstch::map txd_map = txd.get_mstch_map();
|
|
|
|
|
|
|
|
|
|
|
|
// get timestamp of the tx's block
|
|
|
|
// get timestamp of the tx's block
|
|
|
|
uint64_t blk_height = core_storage->get_db().get_tx_block_height(txd.hash);
|
|
|
|
uint64_t blk_height = core_storage
|
|
|
|
uint64_t blk_timestamp = core_storage->get_db().get_block_timestamp(blk_height);
|
|
|
|
->get_db().get_tx_block_height(txd.hash);
|
|
|
|
|
|
|
|
uint64_t blk_timestamp = core_storage
|
|
|
|
|
|
|
|
->get_db().get_block_timestamp(blk_height);
|
|
|
|
|
|
|
|
|
|
|
|
// add the timestamp to tx mstch map
|
|
|
|
// add the timestamp to tx mstch map
|
|
|
|
txd_map.insert({"timestamp", xmreg::timestamp_to_str(blk_timestamp)});
|
|
|
|
txd_map.insert({"timestamp", xmreg::timestamp_to_str(blk_timestamp)});
|
|
|
@ -1269,6 +1293,19 @@ namespace xmreg {
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
map<string, vector<string>>
|
|
|
|
|
|
|
|
get_tx_keys(vector<tx_info> tx_infos)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
map<string, vector<string>> tx_keys;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (const tx_info& tx_info: tx_infos)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return tx_keys;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
tx_details
|
|
|
|
tx_details
|
|
|
|
get_tx_details(const transaction& tx, bool coinbase = false)
|
|
|
|
get_tx_details(const transaction& tx, bool coinbase = false)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1316,7 +1353,7 @@ namespace xmreg {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
vector<pair<tx_info, transaction>>
|
|
|
|
vector<pair<tx_info, transaction>>
|
|
|
|
search_mempool(crypto::hash tx_hash)
|
|
|
|
search_mempool(crypto::hash tx_hash = null_hash)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
vector<pair<tx_info, transaction>> found_txs;
|
|
|
|
vector<pair<tx_info, transaction>> found_txs;
|
|
|
@ -1363,12 +1400,22 @@ namespace xmreg {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// check if tx hash matches, and if yes, save it for return
|
|
|
|
// if we dont provide tx_hash, just get all txs in
|
|
|
|
if (tx_hash == get_transaction_hash(tx))
|
|
|
|
// the mempool
|
|
|
|
|
|
|
|
if (tx_hash != null_hash)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
found_txs.push_back(make_pair(_tx_info, tx));
|
|
|
|
// check if tx hash matches, and if yes, save it for return
|
|
|
|
break;
|
|
|
|
if (tx_hash == get_transaction_hash(tx))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
found_txs.push_back(make_pair(_tx_info, tx));
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
found_txs.push_back(make_pair(_tx_info, tx));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|