fix restore-deterministic height

Simplewallet improperly skipped the restore from height code if
restoring a deterministic wallet AND not specifying a wallet file in the
command line. The other generate options require a wallet file as an
argument, which prevents "ask_wallet_create_if_needed()" from being
called, which in turn causes "m_generate_new" to remain unset.
Specifying a wallet file at launch with --restore-deterministic emulated
this behavior.
This commit is contained in:
luigi1111 2016-08-09 17:46:49 -05:00
parent 0fbe9cfcdb
commit d2644c15c3
No known key found for this signature in database
GPG Key ID: F4ACA0183641E010

View File

@ -1259,7 +1259,7 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm)
return false; return false;
} }
} }
if (!m_restore_height && m_generate_new.empty()) if (!m_restore_height && (m_generate_new.empty() || m_restore_deterministic_wallet))
{ {
std::string heightstr = command_line::input_line("Restore from specific blockchain height (optional, default 0): "); std::string heightstr = command_line::input_line("Restore from specific blockchain height (optional, default 0): ");
if (std::cin.eof()) if (std::cin.eof())
@ -1546,7 +1546,7 @@ bool simple_wallet::new_wallet(const std::string &wallet_file, const std::string
m_wallet->set_seed_language(mnemonic_language); m_wallet->set_seed_language(mnemonic_language);
// for a totally new account, we don't care about older blocks. // for a totally new account, we don't care about older blocks.
if (!m_generate_new.empty()) if (!m_generate_new.empty() && !m_restore_deterministic_wallet)
{ {
std::string err; std::string err;
m_wallet->set_refresh_from_block_height(get_daemon_blockchain_height(err)); m_wallet->set_refresh_from_block_height(get_daemon_blockchain_height(err));