aboutsummaryrefslogtreecommitdiff
path: root/src/simplewallet/simplewallet.cpp
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2019-08-21 15:08:10 -0500
committerluigi1111 <luigi1111w@gmail.com>2019-08-21 15:08:10 -0500
commit65e937168e2626bf4d9069d87e76d805516f356f (patch)
treed3e8d4ea91d21c324d70170289f90b14ebb4bc07 /src/simplewallet/simplewallet.cpp
parentMerge pull request #5702 (diff)
parentsimplewallet: optional all flag to export_outputs/export_key_images (diff)
downloadmonero-65e937168e2626bf4d9069d87e76d805516f356f.tar.xz
Merge pull request #5722
8be5fea simplewallet: optional all flag to export_outputs/export_key_images (moneromooo-monero)
Diffstat (limited to 'src/simplewallet/simplewallet.cpp')
-rw-r--r--src/simplewallet/simplewallet.cpp39
1 files changed, 29 insertions, 10 deletions
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp
index 9bae6c028..fa85cc887 100644
--- a/src/simplewallet/simplewallet.cpp
+++ b/src/simplewallet/simplewallet.cpp
@@ -201,11 +201,11 @@ namespace
const char* USAGE_SET_DESCRIPTION("set_description [free text note]");
const char* USAGE_SIGN("sign <filename>");
const char* USAGE_VERIFY("verify <filename> <address> <signature>");
- const char* USAGE_EXPORT_KEY_IMAGES("export_key_images <filename>");
+ const char* USAGE_EXPORT_KEY_IMAGES("export_key_images [all] <filename>");
const char* USAGE_IMPORT_KEY_IMAGES("import_key_images <filename>");
const char* USAGE_HW_KEY_IMAGES_SYNC("hw_key_images_sync");
const char* USAGE_HW_RECONNECT("hw_reconnect");
- const char* USAGE_EXPORT_OUTPUTS("export_outputs <filename>");
+ const char* USAGE_EXPORT_OUTPUTS("export_outputs [all] <filename>");
const char* USAGE_IMPORT_OUTPUTS("import_outputs <filename>");
const char* USAGE_SHOW_TRANSFER("show_transfer <txid>");
const char* USAGE_MAKE_MULTISIG("make_multisig <threshold> <string1> [<string>...]");
@@ -9044,21 +9044,31 @@ bool simple_wallet::verify(const std::vector<std::string> &args)
return true;
}
//----------------------------------------------------------------------------------------------------
-bool simple_wallet::export_key_images(const std::vector<std::string> &args)
+bool simple_wallet::export_key_images(const std::vector<std::string> &args_)
{
if (m_wallet->key_on_device())
{
fail_msg_writer() << tr("command not supported by HW wallet");
return true;
}
- if (args.size() != 1)
+ auto args = args_;
+
+ if (m_wallet->watch_only())
{
- PRINT_USAGE(USAGE_EXPORT_KEY_IMAGES);
+ fail_msg_writer() << tr("wallet is watch-only and cannot export key images");
return true;
}
- if (m_wallet->watch_only())
+
+ bool all = false;
+ if (args.size() >= 2 && args[0] == "all")
{
- fail_msg_writer() << tr("wallet is watch-only and cannot export key images");
+ all = true;
+ args.erase(args.begin());
+ }
+
+ if (args.size() != 1)
+ {
+ PRINT_USAGE(USAGE_EXPORT_KEY_IMAGES);
return true;
}
@@ -9070,7 +9080,7 @@ bool simple_wallet::export_key_images(const std::vector<std::string> &args)
try
{
- if (!m_wallet->export_key_images(filename))
+ if (!m_wallet->export_key_images(filename, all))
{
fail_msg_writer() << tr("failed to save file ") << filename;
return true;
@@ -9195,13 +9205,22 @@ bool simple_wallet::hw_reconnect(const std::vector<std::string> &args)
return true;
}
//----------------------------------------------------------------------------------------------------
-bool simple_wallet::export_outputs(const std::vector<std::string> &args)
+bool simple_wallet::export_outputs(const std::vector<std::string> &args_)
{
if (m_wallet->key_on_device())
{
fail_msg_writer() << tr("command not supported by HW wallet");
return true;
}
+ auto args = args_;
+
+ bool all = false;
+ if (args.size() >= 2 && args[0] == "all")
+ {
+ all = true;
+ args.erase(args.begin());
+ }
+
if (args.size() != 1)
{
PRINT_USAGE(USAGE_EXPORT_OUTPUTS);
@@ -9216,7 +9235,7 @@ bool simple_wallet::export_outputs(const std::vector<std::string> &args)
try
{
- std::string data = m_wallet->export_outputs_to_str();
+ std::string data = m_wallet->export_outputs_to_str(all);
bool r = epee::file_io_utils::save_string_to_file(filename, data);
if (!r)
{