aboutsummaryrefslogtreecommitdiff
path: root/src/simplewallet
diff options
context:
space:
mode:
authorDion Ahmetaj <Dion Ahmetaj>2017-02-21 11:29:38 -0500
committerDion Ahmetaj <Dion Ahmetaj>2017-02-21 11:45:47 -0500
commit5cfddd74e90c84cd4916d5fdf434620b832d6692 (patch)
tree0dbe8ab991ac4c6dcb6f3dd9fe04c6d5b9add3b3 /src/simplewallet
parentMerge pull request #1760 (diff)
downloadmonero-5cfddd74e90c84cd4916d5fdf434620b832d6692.tar.xz
Add support for smart mining through wallet.
Diffstat (limited to '')
-rw-r--r--src/simplewallet/simplewallet.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp
index b466251ab..d4a679fc9 100644
--- a/src/simplewallet/simplewallet.cpp
+++ b/src/simplewallet/simplewallet.cpp
@@ -1561,16 +1561,15 @@ bool simple_wallet::start_mining(const std::vector<std::string>& args)
return true;
assert(m_wallet);
- COMMAND_RPC_START_MINING::request req;
+ COMMAND_RPC_START_MINING::request req = AUTO_VAL_INIT(req);
req.miner_address = m_wallet->get_account().get_public_address_str(m_wallet->testnet());
bool ok = true;
size_t max_mining_threads_count = (std::max)(tools::get_max_concurrency(), static_cast<unsigned>(2));
- if (0 == args.size())
- {
- req.threads_count = 1;
- }
- else if (1 == args.size())
+ size_t arg_size = args.size();
+ if(arg_size >= 3) req.ignore_battery = args[2] == "true";
+ if(arg_size >= 2) req.do_background_mining = args[1] == "true";
+ if(arg_size >= 1)
{
uint16_t num = 1;
ok = string_tools::get_xtype_from_string(num, args[0]);
@@ -1579,12 +1578,12 @@ bool simple_wallet::start_mining(const std::vector<std::string>& args)
}
else
{
- ok = false;
+ req.threads_count = 1;
}
if (!ok)
{
- fail_msg_writer() << tr("invalid arguments. Please use start_mining [<number_of_threads>], "
+ fail_msg_writer() << tr("invalid arguments. Please use start_mining [<number_of_threads>] [do_bg_mining] [ignore_battery], "
"<number_of_threads> should be from 1 to ") << max_mining_threads_count;
return true;
}