diff options
author | Oran Juice <oranjuices@hotmail.com> | 2014-10-19 14:39:45 +0530 |
---|---|---|
committer | Oran Juice <oranjuices@hotmail.com> | 2014-10-19 14:39:45 +0530 |
commit | f1eaf88ba691fc37c07b664af9ebb6fb342b4c23 (patch) | |
tree | 026d40be1aa5038ad4d46c912eb7ad7a89a04456 | |
parent | Doxygen comments (diff) | |
download | monero-f1eaf88ba691fc37c07b664af9ebb6fb342b4c23.tar.xz |
Prints seed after wallet upgrade. Removed iostream include.
-rw-r--r-- | src/simplewallet/simplewallet.cpp | 25 | ||||
-rw-r--r-- | src/simplewallet/simplewallet.h | 5 | ||||
-rw-r--r-- | src/wallet/wallet2.cpp | 2 |
3 files changed, 26 insertions, 6 deletions
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index d3b61c631..68f5cba06 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -317,6 +317,21 @@ bool simple_wallet::ask_wallet_create_if_needed() return r; } + +/*! + * \brief Prints the seed with a nice message + * \param seed seed to print + */ +void simple_wallet::print_seed(std::string seed) +{ + success_msg_writer(true) << "\nPLEASE NOTE: the following 25 words can be used to recover access to your wallet. " << + "Please write them down and store them somewhere safe and secure. Please do not store them in " << + "your email or on file storage services outside of your immediate control.\n"; + boost::replace_nth(seed, " ", 15, "\n"); + boost::replace_nth(seed, " ", 7, "\n"); + std::cout << seed << std::endl; +} + //---------------------------------------------------------------------------------------------------- bool simple_wallet::init(const boost::program_options::variables_map& vm) { @@ -544,10 +559,7 @@ bool simple_wallet::new_wallet(const std::string &wallet_file, const std::string if (!two_random) { - success_msg_writer(true) << "\nPLEASE NOTE: the following 25 words can be used to recover access to your wallet. Please write them down and store them somewhere safe and secure. Please do not store them in your email or on file storage services outside of your immediate control.\n"; - boost::replace_nth(electrum_words, " ", 15, "\n"); - boost::replace_nth(electrum_words, " ", 7, "\n"); - std::cout << electrum_words << std::endl; + print_seed(electrum_words); } success_msg_writer() << "**********************************************************************"; @@ -574,6 +586,11 @@ bool simple_wallet::open_wallet(const string &wallet_file, const std::string& pa std::string mnemonic_language = get_mnemonic_language(); m_wallet->set_seed_language(mnemonic_language); m_wallet->rewrite(m_wallet_file, password); + + // Display the seed + std::string seed; + m_wallet->get_seed(seed); + print_seed(seed); } } catch (const std::exception& e) diff --git a/src/simplewallet/simplewallet.h b/src/simplewallet/simplewallet.h index af6d4172a..ebc85ed17 100644 --- a/src/simplewallet/simplewallet.h +++ b/src/simplewallet/simplewallet.h @@ -101,6 +101,11 @@ namespace cryptonote uint64_t get_daemon_blockchain_height(std::string& err); bool try_connect_to_daemon(); bool ask_wallet_create_if_needed(); + /*! + * \brief Prints the seed with a nice message + * \param seed seed to print + */ + void print_seed(std::string seed); /*! * \brief Gets the word seed language from the user. diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index aece1e9d6..a28eaaa7b 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -52,8 +52,6 @@ using namespace epee; #include "rapidjson/writer.h" #include "rapidjson/stringbuffer.h" -#include <iostream> - extern "C" { #include "crypto/keccak.h" |