fix monerod RPC connectivity issues

master
moneroexamples 3 years ago
parent 2f514c758a
commit b0a0afc44c

@ -194,7 +194,7 @@ xmrblocks, Onion Monero Blockchain Explorer:
functionality functionality
--ssl-key-file arg path to key file for ssl (https) --ssl-key-file arg path to key file for ssl (https)
functionality functionality
-d [ --deamon-url ] arg (=http:://127.0.0.1:18081) -d [ --deamon-url ] arg (=127.0.0.1:18081)
Monero daemon url Monero daemon url
--daemon-login arg Specify username[:password] for daemon --daemon-login arg Specify username[:password] for daemon
RPC client RPC client

@ -208,10 +208,10 @@ main(int ac, const char* av[])
string deamon_url {*deamon_url_opt}; string deamon_url {*deamon_url_opt};
if (testnet && deamon_url == "http:://127.0.0.1:18081") if (testnet && deamon_url == "127.0.0.1:18081")
deamon_url = "http:://127.0.0.1:28081"; deamon_url = "127.0.0.1:28081";
if (stagenet && deamon_url == "http:://127.0.0.1:18081") if (stagenet && deamon_url == "127.0.0.1:18081")
deamon_url = "http:://127.0.0.1:38081"; deamon_url = "127.0.0.1:38081";
uint64_t mempool_info_timeout {5000}; uint64_t mempool_info_timeout {5000};

@ -71,7 +71,7 @@ namespace xmreg
"path to key file for ssl (https) functionality") "path to key file for ssl (https) functionality")
("daemon-login", value<string>(), ("daemon-login", value<string>(),
"Specify username[:password] for daemon RPC client") "Specify username[:password] for daemon RPC client")
("deamon-url,d", value<string>()->default_value("http:://127.0.0.1:18081"), ("deamon-url,d", value<string>()->default_value("127.0.0.1:18081"),
"Monero daemon url") "Monero daemon url")
("enable-mixin-guess", value<bool>()->default_value(false)->implicit_value(true), ("enable-mixin-guess", value<bool>()->default_value(false)->implicit_value(true),
"enable guessing real outputs in key images based on viewkey"); "enable guessing real outputs in key images based on viewkey");

@ -227,7 +227,10 @@ MempoolStatus::read_network_info()
COMMAND_RPC_GET_INFO::response rpc_network_info; COMMAND_RPC_GET_INFO::response rpc_network_info;
if (!rpc.get_network_info(rpc_network_info)) if (!rpc.get_network_info(rpc_network_info))
{
cerr << "rpc.get_network_info(rpc_network_info) failed";
return false; return false;
}
uint64_t fee_estimated; uint64_t fee_estimated;

@ -578,21 +578,6 @@ page(MicroCore* _mcore,
string string
index2(uint64_t page_no = 0, bool refresh_page = false) index2(uint64_t page_no = 0, bool refresh_page = false)
{ {
// we get network info, such as current hash rate
// but since this makes a rpc call to deamon, we make it as an async
// call. this way we dont have to wait with execution of the rest of the
// index2 method, until deamon gives as the required result.
std::future<json> network_info_ftr = std::async(std::launch::async, [&]
{
json j_info;
get_monero_network_info(j_info);
return j_info;
});
// get mempool for the front page also using async future // get mempool for the front page also using async future
std::future<string> mempool_ftr = std::async(std::launch::async, [&] std::future<string> mempool_ftr = std::async(std::launch::async, [&]
{ {

@ -183,7 +183,7 @@ rpccalls::get_network_info(COMMAND_RPC_GET_INFO::response& response)
{ {
if (resp_t.result.status == CORE_RPC_STATUS_BUSY) if (resp_t.result.status == CORE_RPC_STATUS_BUSY)
{ {
err = "daemon is busy. Please try again later."; err = "Daemon is busy. Please try again later.";
} }
else if (resp_t.result.status != CORE_RPC_STATUS_OK) else if (resp_t.result.status != CORE_RPC_STATUS_OK)
{ {

@ -77,6 +77,7 @@ class rpccalls
epee::net_utils::http::url_content url; epee::net_utils::http::url_content url;
epee::net_utils::http::http_simple_client m_http_client; epee::net_utils::http::http_simple_client m_http_client;
std::mutex m_daemon_rpc_mutex; std::mutex m_daemon_rpc_mutex;
string port; string port;

Loading…
Cancel
Save