mirror of
https://github.com/monero-project/monero.git
synced 2024-12-28 07:59:27 -05:00
Add support for smart mining through wallet.
This commit is contained in:
parent
2bdad8d695
commit
5cfddd74e9
@ -1561,16 +1561,15 @@ bool simple_wallet::start_mining(const std::vector<std::string>& args)
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
assert(m_wallet);
|
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());
|
req.miner_address = m_wallet->get_account().get_public_address_str(m_wallet->testnet());
|
||||||
|
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
size_t max_mining_threads_count = (std::max)(tools::get_max_concurrency(), static_cast<unsigned>(2));
|
size_t max_mining_threads_count = (std::max)(tools::get_max_concurrency(), static_cast<unsigned>(2));
|
||||||
if (0 == args.size())
|
size_t arg_size = args.size();
|
||||||
{
|
if(arg_size >= 3) req.ignore_battery = args[2] == "true";
|
||||||
req.threads_count = 1;
|
if(arg_size >= 2) req.do_background_mining = args[1] == "true";
|
||||||
}
|
if(arg_size >= 1)
|
||||||
else if (1 == args.size())
|
|
||||||
{
|
{
|
||||||
uint16_t num = 1;
|
uint16_t num = 1;
|
||||||
ok = string_tools::get_xtype_from_string(num, args[0]);
|
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
|
else
|
||||||
{
|
{
|
||||||
ok = false;
|
req.threads_count = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ok)
|
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;
|
"<number_of_threads> should be from 1 to ") << max_mining_threads_count;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user