aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2018-09-18 17:56:51 +0200
committerRiccardo Spagni <ric@spagni.net>2018-09-18 17:56:51 +0200
commit9d0565615c7195cfeecfbc5a3a8fd262d83f1262 (patch)
treea9e36e2f7071bfd7b6abe5e552cb905c15c83ead
parentMerge pull request #4349 (diff)
parentrpc: return "already mining" in start_mining if already mining (diff)
downloadmonero-9d0565615c7195cfeecfbc5a3a8fd262d83f1262.tar.xz
Merge pull request #4354
03c07b16 rpc: return "already mining" in start_mining if already mining (moneromooo-monero)
-rw-r--r--src/rpc/core_rpc_server.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp
index b74032a33..a85b94541 100644
--- a/src/rpc/core_rpc_server.cpp
+++ b/src/rpc/core_rpc_server.cpp
@@ -779,7 +779,13 @@ namespace cryptonote
boost::thread::attributes attrs;
attrs.set_stack_size(THREAD_STACK_SIZE);
- if(!m_core.get_miner().start(info.address, static_cast<size_t>(req.threads_count), attrs, req.do_background_mining, req.ignore_battery))
+ cryptonote::miner &miner= m_core.get_miner();
+ if (miner.is_mining())
+ {
+ res.status = "Already mining";
+ return true;
+ }
+ if(!miner.start(info.address, static_cast<size_t>(req.threads_count), attrs, req.do_background_mining, req.ignore_battery))
{
res.status = "Failed, mining not started";
LOG_PRINT_L0(res.status);