aboutsummaryrefslogtreecommitdiff
path: root/src/simplewallet
diff options
context:
space:
mode:
authorhyc <hyc@symas.com>2016-08-10 00:54:20 +0100
committerluigi1111 <luigi1111w@gmail.com>2016-08-09 18:54:20 -0500
commit709c7247cd525952e89c4b8975171152a3969d92 (patch)
treeb5df70cfefa575abc6458627a2a56702f032cefa /src/simplewallet
parentfix restore-deterministic height (diff)
downloadmonero-709c7247cd525952e89c4b8975171152a3969d92.tar.xz
Better fix (#4)
Diffstat (limited to 'src/simplewallet')
-rw-r--r--src/simplewallet/simplewallet.cpp12
-rw-r--r--src/simplewallet/simplewallet.h1
2 files changed, 9 insertions, 4 deletions
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp
index 2d2de89b0..e4a771017 100644
--- a/src/simplewallet/simplewallet.cpp
+++ b/src/simplewallet/simplewallet.cpp
@@ -851,7 +851,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;
@@ -1227,7 +1227,7 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm)
if (!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
@@ -1259,7 +1259,7 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm)
return false;
}
}
- if (!m_restore_height && (m_generate_new.empty() || m_restore_deterministic_wallet))
+ 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())
@@ -1447,6 +1447,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;
}
@@ -1546,7 +1550,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() && !m_restore_deterministic_wallet)
+ 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 b35ca0866..46357cfc0 100644
--- a/src/simplewallet/simplewallet.h
+++ b/src/simplewallet/simplewallet.h
@@ -243,6 +243,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;