simplewallet: fix smart mining not starting after first setup

Also avoid rewriting the wallet if the setting is already was we need
This commit is contained in:
moneromooo-monero 2020-02-17 13:15:21 +00:00 committed by wowario
parent 1bbb2cbd63
commit b33dfc2ee4
No known key found for this signature in database
GPG key ID: 24DCBE762DE9C111

View file

@ -5198,8 +5198,11 @@ void simple_wallet::check_background_mining(const epee::wipeable_string &passwor
if (is_background_mining_enabled) if (is_background_mining_enabled)
{ {
// already active, nice // already active, nice
m_wallet->setup_background_mining(tools::wallet2::BackgroundMiningYes); if (setup == tools::wallet2::BackgroundMiningMaybe)
m_wallet->rewrite(m_wallet_file, password); {
m_wallet->setup_background_mining(tools::wallet2::BackgroundMiningYes);
m_wallet->rewrite(m_wallet_file, password);
}
start_background_mining(); start_background_mining();
return; return;
} }
@ -5222,6 +5225,11 @@ void simple_wallet::check_background_mining(const epee::wipeable_string &passwor
m_wallet->rewrite(m_wallet_file, password); m_wallet->rewrite(m_wallet_file, password);
start_background_mining(); start_background_mining();
} }
else
{
// the setting is already enabled, and the daemon is not mining yet, so start it
start_background_mining();
}
} }
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
bool simple_wallet::start_mining(const std::vector<std::string>& args) bool simple_wallet::start_mining(const std::vector<std::string>& args)