rpc: return "already mining" in start_mining if already mining

This commit is contained in:
moneromooo-monero 2018-09-09 15:26:50 +00:00 committed by wowario
parent ae255e3857
commit 332ac6a03a
No known key found for this signature in database
GPG key ID: 24DCBE762DE9C111

View file

@ -863,7 +863,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);