aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet2.cpp
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-03-07 13:54:18 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-03-07 14:24:14 +0000
commit1979d53d78bf0f94e442191c8766fcbc79778be6 (patch)
tree336ed9670ab062dd98ee870e2767433d0080f0bc /src/wallet/wallet2.cpp
parentMerge pull request #3253 (diff)
downloadmonero-1979d53d78bf0f94e442191c8766fcbc79778be6.tar.xz
wallet: fixes and tweaks to the save_watch_only command
- save the new keys file as FOO-watchonly.keys, not FOO.keys-watchonly - catch any exception (eg, I/O errors) and error out - print the new keys filename in simplewallet
Diffstat (limited to 'src/wallet/wallet2.cpp')
-rw-r--r--src/wallet/wallet2.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index 4a6c6fad2..c22dd4b6e 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -3415,15 +3415,15 @@ void wallet2::rewrite(const std::string& wallet_name, const epee::wipeable_strin
* \param wallet_name Base name of wallet file
* \param password Password for wallet file
*/
-void wallet2::write_watch_only_wallet(const std::string& wallet_name, const epee::wipeable_string& password)
+void wallet2::write_watch_only_wallet(const std::string& wallet_name, const epee::wipeable_string& password, std::string &new_keys_filename)
{
prepare_file_names(wallet_name);
boost::system::error_code ignored_ec;
- std::string filename = m_keys_file + "-watchonly";
- bool watch_only_keys_file_exists = boost::filesystem::exists(filename, ignored_ec);
- THROW_WALLET_EXCEPTION_IF(watch_only_keys_file_exists, error::file_save_error, filename);
- bool r = store_keys(filename, password, true);
- THROW_WALLET_EXCEPTION_IF(!r, error::file_save_error, filename);
+ new_keys_filename = m_wallet_file + "-watchonly.keys";
+ bool watch_only_keys_file_exists = boost::filesystem::exists(new_keys_filename, ignored_ec);
+ THROW_WALLET_EXCEPTION_IF(watch_only_keys_file_exists, error::file_save_error, new_keys_filename);
+ bool r = store_keys(new_keys_filename, password, true);
+ THROW_WALLET_EXCEPTION_IF(!r, error::file_save_error, new_keys_filename);
}
//----------------------------------------------------------------------------------------------------
void wallet2::wallet_exists(const std::string& file_path, bool& keys_file_exists, bool& wallet_file_exists)