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
This commit is contained in:
moneromooo-monero 2018-03-07 13:54:18 +00:00
parent c102c49da5
commit 1979d53d78
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3
3 changed files with 18 additions and 8 deletions

View file

@ -3143,7 +3143,17 @@ bool simple_wallet::save_watch_only(const std::vector<std::string> &args/* = std
return true;
}
m_wallet->write_watch_only_wallet(m_wallet_file, pwd_container->password());
try
{
std::string new_keys_filename;
m_wallet->write_watch_only_wallet(m_wallet_file, pwd_container->password(), new_keys_filename);
success_msg_writer() << tr("Watch only wallet saved as: ") << new_keys_filename;
}
catch (const std::exception &e)
{
fail_msg_writer() << tr("Failed to save watch only wallet: ") << e.what();
return true;
}
return true;
}