aboutsummaryrefslogtreecommitdiff
path: root/src/simplewallet/simplewallet.cpp
diff options
context:
space:
mode:
authorHoward Chu <hyc@symas.com>2016-04-29 06:02:55 +0100
committerHoward Chu <hyc@symas.com>2016-04-29 15:33:28 +0100
commit687855d658dc4a9e5aeb18a47475855deb84f4d5 (patch)
tree553cab1fbfbfe6ee6b203442f1d4333024090fb9 /src/simplewallet/simplewallet.cpp
parentFix 19fe8ae3ef1aa46ae8fdd4e4d6862510390ddab7 (diff)
downloadmonero-687855d658dc4a9e5aeb18a47475855deb84f4d5.tar.xz
Set refresh height earlier
Do it before the generate() call so the value actually gets stored.
Diffstat (limited to '')
-rw-r--r--src/simplewallet/simplewallet.cpp28
1 files changed, 15 insertions, 13 deletions
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp
index 8a493202f..be1e35e4d 100644
--- a/src/simplewallet/simplewallet.cpp
+++ b/src/simplewallet/simplewallet.cpp
@@ -992,6 +992,7 @@ bool simple_wallet::generate_from_json(const boost::program_options::variables_m
m_wallet.reset(new tools::wallet2(testnet));
m_wallet->callback(this);
+ m_wallet->set_refresh_from_block_height(field_scan_from_height);
try
{
@@ -1037,8 +1038,6 @@ bool simple_wallet::generate_from_json(const boost::program_options::variables_m
return false;
}
- m_wallet->set_refresh_from_block_height(field_scan_from_height);
-
wallet_file = m_wallet_file;
return r;
@@ -1433,6 +1432,16 @@ bool simple_wallet::new_wallet(const std::string &wallet_file, const std::string
m_wallet->callback(this);
m_wallet->set_seed_language(mnemonic_language);
+ // for a totally new account, we don't care about older blocks.
+ if (!m_generate_new.empty())
+ {
+ std::string err;
+ m_wallet->set_refresh_from_block_height(get_daemon_blockchain_height(err));
+ } else if (m_restore_height)
+ {
+ m_wallet->set_refresh_from_block_height(m_restore_height);
+ }
+
crypto::secret_key recovery_val;
try
{
@@ -1448,15 +1457,6 @@ bool simple_wallet::new_wallet(const std::string &wallet_file, const std::string
}
m_wallet->init(m_daemon_address);
- // for a totally new account, we don't care about older blocks.
- if (!m_generate_new.empty())
- {
- std::string err;
- m_wallet->set_refresh_from_block_height(get_daemon_blockchain_height(err));
- } else if (m_restore_height)
- {
- m_wallet->set_refresh_from_block_height(m_restore_height);
- }
// convert rng value to electrum-style word list
std::string electrum_words;
@@ -1489,6 +1489,8 @@ bool simple_wallet::new_wallet(const std::string &wallet_file, const std::string
m_wallet.reset(new tools::wallet2(testnet));
m_wallet->callback(this);
+ if (m_restore_height)
+ m_wallet->set_refresh_from_block_height(m_restore_height);
try
{
@@ -1504,7 +1506,6 @@ bool simple_wallet::new_wallet(const std::string &wallet_file, const std::string
}
m_wallet->init(m_daemon_address);
- m_wallet->set_refresh_from_block_height(m_restore_height);
return true;
}
@@ -1516,6 +1517,8 @@ bool simple_wallet::new_wallet(const std::string &wallet_file, const std::string
m_wallet.reset(new tools::wallet2(testnet));
m_wallet->callback(this);
+ if (m_restore_height)
+ m_wallet->set_refresh_from_block_height(m_restore_height);
try
{
@@ -1530,7 +1533,6 @@ bool simple_wallet::new_wallet(const std::string &wallet_file, const std::string
}
m_wallet->init(m_daemon_address);
- m_wallet->set_refresh_from_block_height(m_restore_height);
return true;
}