aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2017-11-14 14:56:07 +0200
committerRiccardo Spagni <ric@spagni.net>2017-11-14 14:56:07 +0200
commit395025bb23e245a29dcb0b3760bcfd4eca375d72 (patch)
tree0ff9732390ba5b935ee95571a8fa2768c69cb38a /src/wallet
parentMerge pull request #2630 (diff)
parentwallet-cli: added --generate-from-spend-key option (diff)
downloadmonero-395025bb23e245a29dcb0b3760bcfd4eca375d72.tar.xz
Merge pull request #2633
ad96c478 wallet-cli: added --generate-from-spend-key option (stoffu)
Diffstat (limited to 'src/wallet')
-rw-r--r--src/wallet/wallet2.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index 5e747e7f6..4d9de3bc5 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