diff options
author | Riccardo Spagni <ric@spagni.net> | 2016-08-11 14:57:33 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2016-08-11 14:57:33 +0200 |
commit | b026650be97e15d1fb8c1ff2423aa8b6ded17276 (patch) | |
tree | 7988ca1371193ec13b73f5a6fada4d9da3ff3da7 /src | |
parent | Merge pull request #949 (diff) | |
parent | Better fix (#4) (diff) | |
download | monero-b026650be97e15d1fb8c1ff2423aa8b6ded17276.tar.xz |
Merge pull request #952
709c724 Better fix (#4) (hyc)
d2644c1 fix restore-deterministic height (luigi1111)
Diffstat (limited to 'src')
-rw-r--r-- | src/simplewallet/simplewallet.cpp | 12 | ||||
-rw-r--r-- | src/simplewallet/simplewallet.h | 1 |
2 files changed, 9 insertions, 4 deletions
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index c4d0fcc56..ec8e2a507 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -847,7 +847,7 @@ bool simple_wallet::ask_wallet_create_if_needed() // add logic to error out if new wallet requested but named wallet file exists if (keys_file_exists || wallet_file_exists) { - if (!m_generate_new.empty() || m_restore_deterministic_wallet || !m_generate_from_view_key.empty() || !m_generate_from_keys.empty() || !m_generate_from_json.empty()) + if (!m_generate_new.empty() || m_restoring) { fail_msg_writer() << tr("attempting to generate or restore wallet, but specified file(s) exist. Exiting to not risk overwriting."); return false; @@ -1224,7 +1224,7 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm) if (!cryptonote::simple_wallet::get_password(vm, true, pwd_container)) return false; - if (!m_generate_new.empty() || m_restore_deterministic_wallet || !m_generate_from_view_key.empty() || !m_generate_from_keys.empty() || !m_generate_from_json.empty()) + if (!m_generate_new.empty() || m_restoring) { if (m_wallet_file.empty()) m_wallet_file = m_generate_new; // alias for simplicity later @@ -1256,7 +1256,7 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm) return false; } } - if (!m_restore_height && m_generate_new.empty()) + if (!m_restore_height && m_restoring) { std::string heightstr = command_line::input_line("Restore from specific blockchain height (optional, default 0): "); if (std::cin.eof()) @@ -1444,6 +1444,10 @@ bool simple_wallet::handle_command_line(const boost::program_options::variables_ m_trusted_daemon = command_line::get_arg(vm, arg_trusted_daemon); m_allow_mismatched_daemon_version = command_line::get_arg(vm, arg_allow_mismatched_daemon_version); m_restore_height = command_line::get_arg(vm, arg_restore_height); + m_restoring = !m_generate_from_view_key.empty() || + !m_generate_from_keys.empty() || + !m_generate_from_json.empty() || + m_restore_deterministic_wallet; return true; } @@ -1544,7 +1548,7 @@ bool simple_wallet::new_wallet(const std::string &wallet_file, const std::string m_wallet->set_seed_language(mnemonic_language); // for a totally new account, we don't care about older blocks. - if (!m_generate_new.empty()) + if (!m_restoring) { std::string err; m_wallet->set_refresh_from_block_height(get_daemon_blockchain_height(err)); diff --git a/src/simplewallet/simplewallet.h b/src/simplewallet/simplewallet.h index 6c766a32d..52a4e150f 100644 --- a/src/simplewallet/simplewallet.h +++ b/src/simplewallet/simplewallet.h @@ -244,6 +244,7 @@ namespace cryptonote bool m_non_deterministic; // old 2-random generation bool m_trusted_daemon; bool m_allow_mismatched_daemon_version; + bool m_restoring; // are we restoring, by whatever method? uint64_t m_restore_height; // optional std::string m_daemon_address; |