aboutsummaryrefslogtreecommitdiff
path: root/src/rpc
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2017-02-12 23:11:44 +0200
committerRiccardo Spagni <ric@spagni.net>2017-02-12 23:11:44 +0200
commitaf48b6cf22bf772e2331194ea93b47fd3583018d (patch)
tree5f543e906da88c41936ae279c63e96ebb5909435 /src/rpc
parentMerge pull request #1698 (diff)
parentAdded a note about smart mining to status command. Fixed up a bug where I was... (diff)
downloadmonero-af48b6cf22bf772e2331194ea93b47fd3583018d.tar.xz
Merge pull request #1582
ad95e650 Added a note about smart mining to status command. Fixed up a bug where I was resetting bg mining enabled instead of started. Upped the miner threshold. Also moved setting of enabled on start above miner thread creation since starting with true, then stopping, then starting with false resulted in race condition. (Dion Ahmetaj) e4dfd2fb Changed ac_line_status to on_battery_power. (Dion Ahmetaj) 23c73269 Use defined directive to silence pre-proc warnings. (Dion Ahmetaj) d2c7d0f6 Cleaned up some logging. Thanks to moneromooo for help. (Dion Ahmetaj) 68652cd9 Added some //TODO comments pertaining to returning enums instead of bools in order to be better able to handle failure states. (Dion Ahmetaj) 0b1045ed Moved around checking of AC power in order to bail quicker to sleep if not plugged in. (Dion Ahmetaj) 2937fdbb Moved setting of previous process times to block where background mining is started, and added an explicit sleep in that block to wait for some mining to occur. (Dion Ahmetaj) 21a1e025 Set background mining started bool to false on bg thread start. If mining::stop then mining::start, idle logic is re-run instead of starting immediately (if it was running before stop). (Dion Ahmetaj) 345ed482 Background/smart mining. If a users' computer is plugged into a power source, and CPU has been idle for some time, then begin mining to some threshold (don't destroy the users' CPU). (Dion Ahmetaj)
Diffstat (limited to 'src/rpc')
-rw-r--r--src/rpc/core_rpc_server.cpp3
-rw-r--r--src/rpc/core_rpc_server_commands_defs.h4
2 files changed, 6 insertions, 1 deletions
diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp
index 5442b6ac4..1caf737ca 100644
--- a/src/rpc/core_rpc_server.cpp
+++ b/src/rpc/core_rpc_server.cpp
@@ -635,7 +635,7 @@ namespace cryptonote
boost::thread::attributes attrs;
attrs.set_stack_size(THREAD_STACK_SIZE);
- if(!m_core.get_miner().start(adr, static_cast<size_t>(req.threads_count), attrs))
+ if(!m_core.get_miner().start(adr, static_cast<size_t>(req.threads_count), attrs, req.do_background_mining))
{
res.status = "Failed, mining not started";
LOG_PRINT_L0(res.status);
@@ -663,6 +663,7 @@ namespace cryptonote
const miner& lMiner = m_core.get_miner();
res.active = lMiner.is_mining();
+ res.is_background_mining_enabled = lMiner.get_is_background_mining_enabled();
if ( lMiner.is_mining() ) {
res.speed = lMiner.get_speed();
diff --git a/src/rpc/core_rpc_server_commands_defs.h b/src/rpc/core_rpc_server_commands_defs.h
index 83ef2ebd4..3ab1ea175 100644
--- a/src/rpc/core_rpc_server_commands_defs.h
+++ b/src/rpc/core_rpc_server_commands_defs.h
@@ -500,10 +500,12 @@ namespace cryptonote
{
std::string miner_address;
uint64_t threads_count;
+ bool do_background_mining;
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(miner_address)
KV_SERIALIZE(threads_count)
+ KV_SERIALIZE(do_background_mining)
END_KV_SERIALIZE_MAP()
};
@@ -608,6 +610,7 @@ namespace cryptonote
uint64_t speed;
uint32_t threads_count;
std::string address;
+ bool is_background_mining_enabled;
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(status)
@@ -615,6 +618,7 @@ namespace cryptonote
KV_SERIALIZE(speed)
KV_SERIALIZE(threads_count)
KV_SERIALIZE(address)
+ KV_SERIALIZE(is_background_mining_enabled)
END_KV_SERIALIZE_MAP()
};
};