mirror of
https://github.com/monero-project/monero.git
synced 2025-12-22 07:10:46 -08:00
Merge pull request #3104
939629e8 Wallet API: all recover options with password (m2049r)
This commit is contained in:
@@ -457,6 +457,16 @@ bool WalletImpl::recoverFromKeys(const std::string &path,
|
||||
const std::string &address_string,
|
||||
const std::string &viewkey_string,
|
||||
const std::string &spendkey_string)
|
||||
{
|
||||
return recoverFromKeysWithPassword(path, "", language, address_string, viewkey_string, spendkey_string);
|
||||
}
|
||||
|
||||
bool WalletImpl::recoverFromKeysWithPassword(const std::string &path,
|
||||
const std::string &password,
|
||||
const std::string &language,
|
||||
const std::string &address_string,
|
||||
const std::string &viewkey_string,
|
||||
const std::string &spendkey_string)
|
||||
{
|
||||
cryptonote::address_parse_info info;
|
||||
if(!get_account_address_from_str(info, m_wallet->testnet(), address_string))
|
||||
@@ -524,12 +534,12 @@ bool WalletImpl::recoverFromKeys(const std::string &path,
|
||||
try
|
||||
{
|
||||
if (has_spendkey) {
|
||||
m_wallet->generate(path, "", info.address, spendkey, viewkey);
|
||||
m_wallet->generate(path, password, info.address, spendkey, viewkey);
|
||||
setSeedLanguage(language);
|
||||
LOG_PRINT_L1("Generated new wallet from keys with seed language: " + language);
|
||||
}
|
||||
else {
|
||||
m_wallet->generate(path, "", info.address, viewkey);
|
||||
m_wallet->generate(path, password, info.address, viewkey);
|
||||
LOG_PRINT_L1("Generated new view only wallet from keys");
|
||||
}
|
||||
|
||||
@@ -569,6 +579,11 @@ bool WalletImpl::open(const std::string &path, const std::string &password)
|
||||
}
|
||||
|
||||
bool WalletImpl::recover(const std::string &path, const std::string &seed)
|
||||
{
|
||||
return recover(path, "", seed);
|
||||
}
|
||||
|
||||
bool WalletImpl::recover(const std::string &path, const std::string &password, const std::string &seed)
|
||||
{
|
||||
clearStatus();
|
||||
m_errorString.clear();
|
||||
@@ -590,7 +605,7 @@ bool WalletImpl::recover(const std::string &path, const std::string &seed)
|
||||
|
||||
try {
|
||||
m_wallet->set_seed_language(old_language);
|
||||
m_wallet->generate(path, "", recovery_key, true, false);
|
||||
m_wallet->generate(path, password, recovery_key, true, false);
|
||||
|
||||
} catch (const std::exception &e) {
|
||||
m_status = Status_Critical;
|
||||
|
||||
Reference in New Issue
Block a user