From 09a659edb5f77ce1879338545f388076881b4e06 Mon Sep 17 00:00:00 2001 From: Oran Juice Date: Sat, 18 Oct 2014 02:21:37 +0530 Subject: Stores seed language in wallet file. added rapidjson. Yet to test backward compatibility --- src/wallet/wallet2.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/wallet/wallet2.h') diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h index afa42c2d3..35e02ce28 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h @@ -155,7 +155,11 @@ namespace tools /*! * \brief Sets the seed language */ - void set_seed_language(const std::string &language); + void set_seed_language(const std::string &language); + /*! + * \brief Tells if the wallet file is deprecated. + */ + bool is_deprecated() const; void refresh(); void refresh(uint64_t start_height, size_t & blocks_fetched); void refresh(uint64_t start_height, size_t & blocks_fetched, bool& received_money); @@ -240,6 +244,7 @@ namespace tools i_wallet2_callback* m_callback; bool m_testnet; std::string seed_language; + bool is_old_file_format; }; } BOOST_CLASS_VERSION(tools::wallet2, 7) -- cgit v1.2.3 From 0bd88ff256e18e13235eaafff388dad99845e4b1 Mon Sep 17 00:00:00 2001 From: Oran Juice Date: Sat, 18 Oct 2014 23:01:43 +0530 Subject: Writes seed language while generating wallet. Wallet open fix. --- src/wallet/wallet2.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/wallet/wallet2.h') diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h index 35e02ce28..10b4d6f3f 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h @@ -82,7 +82,7 @@ namespace tools { wallet2(const wallet2&) : m_run(true), m_callback(0), m_testnet(false) {}; public: - wallet2(bool testnet = false) : m_run(true), m_callback(0), m_testnet(testnet) {}; + wallet2(bool testnet = false) : m_run(true), m_callback(0), m_testnet(testnet), is_old_file_format(false) {}; struct transfer_details { uint64_t m_block_height; -- cgit v1.2.3 From 1f833dcf7760094358c3037b4af6a263c3ef236d Mon Sep 17 00:00:00 2001 From: Oran Juice Date: Sat, 18 Oct 2014 23:11:05 +0530 Subject: Doxygen comments in --- src/wallet/wallet2.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/wallet/wallet2.h') diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h index 10b4d6f3f..c3dfa4df6 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h @@ -207,7 +207,18 @@ namespace tools static std::string address_from_txt_record(const std::string& s); private: + /*! + * Stores wallet information to wallet file. + * @param keys_file_name Name of wallet file + * @param password Password of wallet file + * @return Whether it was successful. + */ bool store_keys(const std::string& keys_file_name, const std::string& password); + /*! + * Load wallet information from wallet file. + * @param keys_file_name Name of wallet file + * @param password Password of wallet file + */ void load_keys(const std::string& keys_file_name, const std::string& password); void process_new_transaction(const cryptonote::transaction& tx, uint64_t height); void process_new_blockchain_entry(const cryptonote::block& b, cryptonote::block_complete_entry& bche, crypto::hash& bl_id, uint64_t height); @@ -243,8 +254,8 @@ namespace tools i_wallet2_callback* m_callback; bool m_testnet; - std::string seed_language; - bool is_old_file_format; + std::string seed_language; /*!< Language of the mnemonics (seed). */ + bool is_old_file_format; /*!< Whether the wallet file is of an old file format */ }; } BOOST_CLASS_VERSION(tools::wallet2, 7) -- cgit v1.2.3 From 031ca23ce9adcdb802097f93017e4acab87d4b37 Mon Sep 17 00:00:00 2001 From: Oran Juice Date: Sun, 19 Oct 2014 01:00:18 +0530 Subject: Rewrites to old wallet file correctly --- src/wallet/wallet2.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/wallet/wallet2.h') diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h index c3dfa4df6..90b0ec331 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h @@ -133,7 +133,10 @@ namespace tools END_SERIALIZE() }; - crypto::secret_key generate(const std::string& wallet, const std::string& password, const crypto::secret_key& recovery_param = crypto::secret_key(), bool recover = false, bool two_random = false); + crypto::secret_key generate(const std::string& wallet, const std::string& password, + const crypto::secret_key& recovery_param = crypto::secret_key(), bool recover = false, + bool two_random = false); + void rewrite(const std::string& wallet_name, const std::string& password); void load(const std::string& wallet, const std::string& password); void store(); cryptonote::account_base& get_account(){return m_account;} -- cgit v1.2.3 From 70971be96bce4ac7efad7160ac904161a45f5b9b Mon Sep 17 00:00:00 2001 From: Oran Juice Date: Sun, 19 Oct 2014 01:08:21 +0530 Subject: Doxygen comments --- src/wallet/wallet2.h | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'src/wallet/wallet2.h') diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h index 90b0ec331..d7693e10d 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h @@ -133,9 +133,23 @@ namespace tools END_SERIALIZE() }; + /*! + * \brief Generates a wallet or restores one. + * \param wallet_ Name of wallet file + * \param password Password of wallet file + * \param recovery_param If it is a restore, the recovery key + * \param recover Whether it is a restore + * \param two_random Whether it is a non-deterministic wallet + * \return The secret key of the generated wallet + */ crypto::secret_key generate(const std::string& wallet, const std::string& password, const crypto::secret_key& recovery_param = crypto::secret_key(), bool recover = false, bool two_random = false); + /*! + * \brief Rewrites to the wallet file for wallet upgrade (doesn't generate key, assumes it's already there) + * \param wallet_name Name of wallet file (should exist) + * \param password Password for wallet file + */ void rewrite(const std::string& wallet_name, const std::string& password); void load(const std::string& wallet, const std::string& password); void store(); @@ -211,16 +225,16 @@ namespace tools static std::string address_from_txt_record(const std::string& s); private: /*! - * Stores wallet information to wallet file. - * @param keys_file_name Name of wallet file - * @param password Password of wallet file - * @return Whether it was successful. + * \brief Stores wallet information to wallet file. + * \param keys_file_name Name of wallet file + * \param password Password of wallet file + * \return Whether it was successful. */ bool store_keys(const std::string& keys_file_name, const std::string& password); /*! - * Load wallet information from wallet file. - * @param keys_file_name Name of wallet file - * @param password Password of wallet file + * \brief Load wallet information from wallet file. + * \param keys_file_name Name of wallet file + * \param password Password of wallet file */ void load_keys(const std::string& keys_file_name, const std::string& password); void process_new_transaction(const cryptonote::transaction& tx, uint64_t height); -- cgit v1.2.3