diff options
author | Riccardo Spagni <ric@spagni.net> | 2018-01-27 17:24:07 -0800 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2018-01-27 17:24:08 -0800 |
commit | 087a77324770e512eaa8417fb30b9110639783c9 (patch) | |
tree | b14c597ff76e97d22c835c78abf9c2add878e6e1 /src/wallet/api/wallet.cpp | |
parent | Merge pull request #3102 (diff) | |
parent | Wallet API: all recover options with password (diff) | |
download | monero-087a77324770e512eaa8417fb30b9110639783c9.tar.xz |
Merge pull request #3104
939629e8 Wallet API: all recover options with password (m2049r)
Diffstat (limited to 'src/wallet/api/wallet.cpp')
-rw-r--r-- | src/wallet/api/wallet.cpp | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp index 4e389f2e2..fcf5c8844 100644 --- a/src/wallet/api/wallet.cpp +++ b/src/wallet/api/wallet.cpp @@ -458,6 +458,16 @@ bool WalletImpl::recoverFromKeys(const std::string &path, 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"); } @@ -570,6 +580,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(); if (seed.empty()) { @@ -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; |