mirror of
https://git.wownero.com/wownero/onion-wownero-blockchain-explorer.git
synced 2024-08-15 00:33:12 +00:00
rpccalls::get_mempool refactored
This commit is contained in:
parent
70442c75e5
commit
5a2489c05e
1 changed files with 13 additions and 11 deletions
|
@ -76,6 +76,9 @@ rpccalls::get_mempool(vector<tx_info>& mempool_txs)
|
||||||
COMMAND_RPC_GET_TRANSACTION_POOL::request req;
|
COMMAND_RPC_GET_TRANSACTION_POOL::request req;
|
||||||
COMMAND_RPC_GET_TRANSACTION_POOL::response res;
|
COMMAND_RPC_GET_TRANSACTION_POOL::response res;
|
||||||
|
|
||||||
|
bool r;
|
||||||
|
|
||||||
|
{
|
||||||
std::lock_guard<std::mutex> guard(m_daemon_rpc_mutex);
|
std::lock_guard<std::mutex> guard(m_daemon_rpc_mutex);
|
||||||
|
|
||||||
if (!connect_to_monero_deamon())
|
if (!connect_to_monero_deamon())
|
||||||
|
@ -84,18 +87,18 @@ rpccalls::get_mempool(vector<tx_info>& mempool_txs)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool r = epee::net_utils::invoke_http_json(
|
r = epee::net_utils::invoke_http_json(
|
||||||
"/get_transaction_pool",
|
"/get_transaction_pool",
|
||||||
req, res, m_http_client, timeout_time_ms);
|
req, res, m_http_client, timeout_time_ms);
|
||||||
|
}
|
||||||
|
|
||||||
if (!r)
|
if (!r || res.status != CORE_RPC_STATUS_OK)
|
||||||
{
|
{
|
||||||
cerr << "Error connecting to Monero deamon at "
|
cerr << "Error connecting to Monero deamon at "
|
||||||
<< deamon_url << endl;
|
<< deamon_url << endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
mempool_txs = res.transactions;
|
mempool_txs = res.transactions;
|
||||||
|
|
||||||
// mempool txs are not sorted base on their arival time,
|
// mempool txs are not sorted base on their arival time,
|
||||||
|
@ -107,7 +110,6 @@ rpccalls::get_mempool(vector<tx_info>& mempool_txs)
|
||||||
return t1.receive_time > t2.receive_time;
|
return t1.receive_time > t2.receive_time;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue