aboutsummaryrefslogtreecommitdiff
path: root/src/simplewallet
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2018-04-12 11:12:33 +0200
committerRiccardo Spagni <ric@spagni.net>2018-04-12 11:12:33 +0200
commit96b2fee7210f30352820635c8340e9a922fa9d21 (patch)
treeb6601233411e47e358c81d09ccdbb8a9dd422b5b /src/simplewallet
parentMerge pull request #3492 (diff)
parentAdd the possibility to export private view key for fast scan. (diff)
downloadmonero-96b2fee7210f30352820635c8340e9a922fa9d21.tar.xz
Merge pull request #3536
c77d2bfa Add the possibility to export private view key for fast scan. (cslashm) 100b7bc1 Change mutex lock model to avoid dead lock and ensure locks are always released. (cslashm) 641dfc99 Automatic height setup when creating/restoring hw device. (cslashm)
Diffstat (limited to 'src/simplewallet')
-rw-r--r--src/simplewallet/simplewallet.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp
index 4e06c4692..b2651026f 100644
--- a/src/simplewallet/simplewallet.cpp
+++ b/src/simplewallet/simplewallet.cpp
@@ -2974,6 +2974,22 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm)
// create wallet
bool r = new_wallet(vm, "Ledger");
CHECK_AND_ASSERT_MES(r, false, tr("account creation failed"));
+ // if no block_height is specified, assume its a new account and start it "now"
+ if(m_wallet->get_refresh_from_block_height() == 0) {
+ {
+ tools::scoped_message_writer wrt = tools::msg_writer();
+ wrt << tr("No restore height is specified.");
+ wrt << tr("Assumed you are creating a new account, restore will be done from current estimated blockchain height.");
+ wrt << tr("Use --restore-height if you want to restore an already setup account from a specific height");
+ }
+ std::string confirm = input_line(tr("Is this okay? (Y/Yes/N/No): "));
+ if (std::cin.eof() || !command_line::is_yes(confirm))
+ CHECK_AND_ASSERT_MES(false, false, tr("account creation aborted"));
+
+ m_wallet->set_refresh_from_block_height(m_wallet->estimate_blockchain_height()-1);
+ m_wallet->explicit_refresh_from_block_height(true);
+ m_restore_height = m_wallet->get_refresh_from_block_height();
+ }
}
else
{
@@ -2990,7 +3006,7 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm)
CHECK_AND_ASSERT_MES(r, false, tr("account creation failed"));
}
- if (m_restoring && m_generate_from_json.empty())
+ if (m_restoring && m_generate_from_json.empty() && m_generate_from_device.empty())
{
m_wallet->explicit_refresh_from_block_height(!command_line::is_arg_defaulted(vm, arg_restore_height));
}
@@ -3388,7 +3404,7 @@ bool simple_wallet::new_wallet(const boost::program_options::variables_map& vm,
try
{
m_wallet->restore(m_wallet_file, std::move(rc.second).password(), device_name);
- message_writer(console_color_white, true) << tr("Generated new on device wallet: ")
+ message_writer(console_color_white, true) << tr("Generated new wallet on hw device: ")
<< m_wallet->get_account().get_public_address_str(m_wallet->nettype());
}
catch (const std::exception& e)