mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-12-23 07:28:54 +00:00
wallet: fix memory only wallets
at least when using restore_deterministic_wallet
This commit is contained in:
parent
ea07a9bc61
commit
a8b98a0bd7
@ -3460,6 +3460,7 @@ void wallet2::change_password(const std::string &filename, const epee::wipeable_
|
|||||||
decrypt_keys(original_password);
|
decrypt_keys(original_password);
|
||||||
setup_keys(new_password);
|
setup_keys(new_password);
|
||||||
rewrite(filename, new_password);
|
rewrite(filename, new_password);
|
||||||
|
if (!filename.empty())
|
||||||
store();
|
store();
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
@ -5142,6 +5143,7 @@ std::string wallet2::path() const
|
|||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
void wallet2::store()
|
void wallet2::store()
|
||||||
{
|
{
|
||||||
|
if (!m_wallet_file.empty())
|
||||||
store_to("", epee::wipeable_string());
|
store_to("", epee::wipeable_string());
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
|
@ -2902,7 +2902,7 @@ namespace tools
|
|||||||
er.message = "Invalid filename";
|
er.message = "Invalid filename";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
std::string wallet_file = m_wallet_dir + "/" + req.filename;
|
std::string wallet_file = req.filename.empty() ? "" : (m_wallet_dir + "/" + req.filename);
|
||||||
{
|
{
|
||||||
std::vector<std::string> languages;
|
std::vector<std::string> languages;
|
||||||
crypto::ElectrumWords::get_language_list(languages);
|
crypto::ElectrumWords::get_language_list(languages);
|
||||||
@ -3187,12 +3187,6 @@ namespace tools
|
|||||||
}
|
}
|
||||||
|
|
||||||
// early check for mandatory fields
|
// early check for mandatory fields
|
||||||
if (req.filename.empty())
|
|
||||||
{
|
|
||||||
er.code = WALLET_RPC_ERROR_CODE_UNKNOWN_ERROR;
|
|
||||||
er.message = "field 'filename' is mandatory. Please provide a filename to save the restored wallet to.";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (req.viewkey.empty())
|
if (req.viewkey.empty())
|
||||||
{
|
{
|
||||||
er.code = WALLET_RPC_ERROR_CODE_UNKNOWN_ERROR;
|
er.code = WALLET_RPC_ERROR_CODE_UNKNOWN_ERROR;
|
||||||
@ -3221,7 +3215,7 @@ namespace tools
|
|||||||
er.message = "Invalid filename";
|
er.message = "Invalid filename";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
std::string wallet_file = m_wallet_dir + "/" + req.filename;
|
std::string wallet_file = req.filename.empty() ? "" : (m_wallet_dir + "/" + req.filename);
|
||||||
// check if wallet file already exists
|
// check if wallet file already exists
|
||||||
if (!wallet_file.empty())
|
if (!wallet_file.empty())
|
||||||
{
|
{
|
||||||
@ -3331,6 +3325,7 @@ namespace tools
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
if (!wallet_file.empty())
|
||||||
m_wallet->store();
|
m_wallet->store();
|
||||||
}
|
}
|
||||||
catch (const std::exception &e)
|
catch (const std::exception &e)
|
||||||
@ -3355,12 +3350,6 @@ namespace tools
|
|||||||
}
|
}
|
||||||
|
|
||||||
// early check for mandatory fields
|
// early check for mandatory fields
|
||||||
if (req.filename.empty())
|
|
||||||
{
|
|
||||||
er.code = WALLET_RPC_ERROR_CODE_UNKNOWN_ERROR;
|
|
||||||
er.message = "field 'filename' is mandatory. Please provide a filename to save the restored wallet to.";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (req.seed.empty())
|
if (req.seed.empty())
|
||||||
{
|
{
|
||||||
er.code = WALLET_RPC_ERROR_CODE_UNKNOWN_ERROR;
|
er.code = WALLET_RPC_ERROR_CODE_UNKNOWN_ERROR;
|
||||||
@ -3383,7 +3372,7 @@ namespace tools
|
|||||||
er.message = "Invalid filename";
|
er.message = "Invalid filename";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
std::string wallet_file = m_wallet_dir + "/" + req.filename;
|
std::string wallet_file = req.filename.empty() ? "" : (m_wallet_dir + "/" + req.filename);
|
||||||
// check if wallet file already exists
|
// check if wallet file already exists
|
||||||
if (!wallet_file.empty())
|
if (!wallet_file.empty())
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user