diff options
author | Riccardo Spagni <ric@spagni.net> | 2017-02-22 09:37:31 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2017-02-22 09:37:31 +0200 |
commit | 5aab25b60af88e11a5a606ed78edff8846bfe01f (patch) | |
tree | 21a5c673636540db2ae07ff5554cd98aa9dc96c0 | |
parent | Merge pull request #1762 (diff) | |
parent | Add support for smart mining through wallet. (diff) | |
download | monero-5aab25b60af88e11a5a606ed78edff8846bfe01f.tar.xz |
Merge pull request #1765
5cfddd74 Add support for smart mining through wallet. (Dion Ahmetaj)
Diffstat (limited to '')
-rw-r--r-- | src/simplewallet/simplewallet.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index 6ab589f6b..5f774ac18 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; } |