diff options
author | stoffu <stoffu@protonmail.ch> | 2017-10-10 08:31:46 +0900 |
---|---|---|
committer | stoffu <stoffu@protonmail.ch> | 2017-11-14 16:30:59 +0900 |
commit | ad96c478b1cd03bd3efc03ea8fb26c1177a3c778 (patch) | |
tree | b8dffca1df9d67dd5e4b81e861a3ed3c9a4b009b /src/wallet/wallet2.cpp | |
parent | Merge pull request #2694 (diff) | |
download | monero-ad96c478b1cd03bd3efc03ea8fb26c1177a3c778.tar.xz |
wallet-cli: added --generate-from-spend-key option
Diffstat (limited to '')
-rw-r--r-- | src/wallet/wallet2.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index a87803206..54ec73692 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -305,9 +305,9 @@ std::unique_ptr<tools::wallet2> generate_from_json(const std::string& json_file, GET_FIELD_FROM_JSON_RETURN_ON_ERROR(json, address, std::string, String, false, std::string()); // compatibility checks - if (!field_seed_found && !field_viewkey_found) + if (!field_seed_found && !field_viewkey_found && !field_spendkey_found) { - tools::fail_msg_writer() << tools::wallet2::tr("At least one of Electrum-style word list and private view key must be specified"); + tools::fail_msg_writer() << tools::wallet2::tr("At least one of Electrum-style word list and private view key and private spend key must be specified"); return false; } if (field_seed_found && (field_viewkey_found || field_spendkey_found)) @@ -368,6 +368,10 @@ std::unique_ptr<tools::wallet2> generate_from_json(const std::string& json_file, { wallet->generate(field_filename, field_password, recovery_key, recover, false); } + else if (field_viewkey.empty() && !field_spendkey.empty()) + { + wallet->generate(field_filename, field_password, spendkey, recover, false); + } else { cryptonote::account_public_address address; @@ -390,6 +394,11 @@ std::unique_ptr<tools::wallet2> generate_from_json(const std::string& json_file, } address.m_spend_public_key = info.address.m_spend_public_key; } + else + { + tools::fail_msg_writer() << tools::wallet2::tr("Address must be specified in order to create watch-only wallet"); + return false; + } wallet->generate(field_filename, field_password, address, viewkey); } else |