mirror of
https://github.com/monero-project/monero.git
synced 2025-05-25 18:30:52 -04:00
Rewrites to old wallet file correctly
This commit is contained in:
parent
1f833dcf77
commit
031ca23ce9
3 changed files with 18 additions and 3 deletions
|
@ -552,7 +552,8 @@ void wallet2::load_keys(const std::string& keys_file_name, const std::string& pa
|
|||
* @param two_random Whether it is a non-deterministic wallet
|
||||
* @return The secret key of the generated wallet
|
||||
*/
|
||||
crypto::secret_key wallet2::generate(const std::string& wallet_, const std::string& password, const crypto::secret_key& recovery_param, bool recover, bool two_random)
|
||||
crypto::secret_key wallet2::generate(const std::string& wallet_, const std::string& password,
|
||||
const crypto::secret_key& recovery_param, bool recover, bool two_random)
|
||||
{
|
||||
clear();
|
||||
prepare_file_names(wallet_);
|
||||
|
@ -578,6 +579,17 @@ crypto::secret_key wallet2::generate(const std::string& wallet_, const std::stri
|
|||
store();
|
||||
return retval;
|
||||
}
|
||||
|
||||
void wallet2::rewrite(const std::string& wallet_name, const std::string& password)
|
||||
{
|
||||
prepare_file_names(wallet_name);
|
||||
boost::system::error_code ignored_ec;
|
||||
THROW_WALLET_EXCEPTION_IF(!boost::filesystem::exists(m_wallet_file, ignored_ec), error::file_not_found, m_wallet_file);
|
||||
THROW_WALLET_EXCEPTION_IF(!boost::filesystem::exists(m_keys_file, ignored_ec), error::file_not_found, m_keys_file);
|
||||
bool r = store_keys(m_keys_file, password);
|
||||
THROW_WALLET_EXCEPTION_IF(!r, error::file_save_error, m_keys_file);
|
||||
store();
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
void wallet2::wallet_exists(const std::string& file_path, bool& keys_file_exists, bool& wallet_file_exists)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue