diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2015-10-28 18:08:14 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2015-10-28 18:09:36 +0000 |
commit | 051ddbc741b1b703f5d58193ea770b13887d4e49 (patch) | |
tree | 0592af68b26102813ca855fe0a0cb38457b2df48 /src/daemon/rpc_command_executor.cpp | |
parent | Merge pull request #453 (diff) | |
download | monero-051ddbc741b1b703f5d58193ea770b13887d4e49.tar.xz |
rpc: fix start_mining and status RPC crashes
They check whether they're running on testnet by accessing the
m_rpc_server object, which does not exist when in RPC mode.
Also, fix hard_fork_info being called with the wrong API.
Diffstat (limited to 'src/daemon/rpc_command_executor.cpp')
-rw-r--r-- | src/daemon/rpc_command_executor.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/daemon/rpc_command_executor.cpp b/src/daemon/rpc_command_executor.cpp index 71b2e6f9d..a28b4290d 100644 --- a/src/daemon/rpc_command_executor.cpp +++ b/src/daemon/rpc_command_executor.cpp @@ -262,7 +262,7 @@ bool t_rpc_command_executor::show_status() { { return true; } - if (!m_rpc_client->rpc_request(hfreq, hfres, "/hard_fork_info", fail_message.c_str())) + if (!m_rpc_client->json_rpc_request(hfreq, hfres, "hard_fork_info", fail_message.c_str())) { return true; } @@ -285,7 +285,7 @@ bool t_rpc_command_executor::show_status() { % (unsigned long long)ires.height % (unsigned long long)(ires.target_height ? ires.target_height : ires.height) % (100.0f * ires.height / (ires.target_height ? ires.target_height < ires.height ? ires.height : ires.target_height : ires.height)) - % (m_rpc_server->is_testnet() ? "testnet" : "mainnet") + % (ires.testnet ? "testnet" : "mainnet") % [&ires]()->std::string { float hr = ires.difficulty / 60.0f; if (hr>1e9) return (boost::format("%.2f GH/s") % (hr/1e9)).str(); @@ -733,10 +733,10 @@ bool t_rpc_command_executor::print_transaction_pool_short() { return true; } -bool t_rpc_command_executor::start_mining(cryptonote::account_public_address address, uint64_t num_threads) { +bool t_rpc_command_executor::start_mining(cryptonote::account_public_address address, uint64_t num_threads, bool testnet) { cryptonote::COMMAND_RPC_START_MINING::request req; cryptonote::COMMAND_RPC_START_MINING::response res; - req.miner_address = cryptonote::get_account_address_as_str(m_rpc_server->is_testnet(), address); + req.miner_address = cryptonote::get_account_address_as_str(testnet, address); req.threads_count = num_threads; std::string fail_message = "Mining did not start"; |