aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet2.h
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2014-12-01 20:14:58 +0200
committerRiccardo Spagni <ric@spagni.net>2014-12-01 20:15:06 +0200
commit4cd15cdde58c00bfcde5af1c9f57779e62a76f2f (patch)
tree89b46555ee93ac9eb2af22afae639a51d904d090 /src/wallet/wallet2.h
parentMerge pull request #191 (diff)
parentPrints seed after wallet upgrade. Removed iostream include. (diff)
downloadmonero-4cd15cdde58c00bfcde5af1c9f57779e62a76f2f.tar.xz
Merge pull request #1
f1eaf88 Prints seed after wallet upgrade. Removed iostream include. (Oran Juice) 70971be Doxygen comments (Oran Juice) 031ca23 Rewrites to old wallet file correctly (Oran Juice) 1f833dc Doxygen comments in (Oran Juice) 0bd88ff Writes seed language while generating wallet. Wallet open fix. (Oran Juice) 09a659e Stores seed language in wallet file. added rapidjson. Yet to test backward compatibility (Oran Juice)
Diffstat (limited to 'src/wallet/wallet2.h')
-rw-r--r--src/wallet/wallet2.h41
1 files changed, 37 insertions, 4 deletions
diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h
index afa42c2d3..d7693e10d 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;
@@ -133,7 +133,24 @@ 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);
+ /*!
+ * \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();
cryptonote::account_base& get_account(){return m_account;}
@@ -155,7 +172,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);
@@ -203,7 +224,18 @@ namespace tools
static std::string address_from_txt_record(const std::string& s);
private:
+ /*!
+ * \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);
+ /*!
+ * \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);
void process_new_blockchain_entry(const cryptonote::block& b, cryptonote::block_complete_entry& bche, crypto::hash& bl_id, uint64_t height);
@@ -239,7 +271,8 @@ namespace tools
i_wallet2_callback* m_callback;
bool m_testnet;
- std::string seed_language;
+ 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)