diff options
Diffstat (limited to 'src/simplewallet')
-rw-r--r-- | src/simplewallet/simplewallet.cpp | 23 | ||||
-rw-r--r-- | src/simplewallet/simplewallet.h | 1 |
2 files changed, 24 insertions, 0 deletions
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index 87dbcf513..81665e6a5 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -398,6 +398,19 @@ bool simple_wallet::change_password(const std::vector<std::string> &args) return true; } +bool simple_wallet::payment_id(const std::vector<std::string> &args/* = std::vector<std::string>()*/) +{ + crypto::hash payment_id; + if (args.size() > 0) + { + fail_msg_writer() << tr("usage: payment_id"); + return true; + } + payment_id = crypto::rand<crypto::hash>(); + success_msg_writer() << tr("Random payment ID: ") << payment_id; + return true; +} + bool simple_wallet::set_always_confirm_transfers(const std::vector<std::string> &args/* = std::vector<std::string>()*/) { const auto pwd_container = get_and_verify_password(); @@ -715,6 +728,7 @@ simple_wallet::simple_wallet() m_cmd_binder.set_handler("import_outputs", boost::bind(&simple_wallet::import_outputs, this, _1), tr("Import set of outputs owned by this wallet")); m_cmd_binder.set_handler("show_transfer", boost::bind(&simple_wallet::show_transfer, this, _1), tr("Show information about a transfer to/from this address")); m_cmd_binder.set_handler("password", boost::bind(&simple_wallet::change_password, this, _1), tr("Change wallet password")); + m_cmd_binder.set_handler("payment_id", boost::bind(&simple_wallet::payment_id, this, _1), tr("Generate a new random full size payment id - these will be unencrypted on the blockchain, see integrated_address for encrypted short payment ids")); m_cmd_binder.set_handler("help", boost::bind(&simple_wallet::help, this, _1), tr("Show this help")); } //---------------------------------------------------------------------------------------------------- @@ -929,6 +943,11 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm) fail_msg_writer() << tr("can't specify both --restore-deterministic-wallet and --non-deterministic"); return false; } + if (!m_wallet_file.empty()) + { + fail_msg_writer() << tr("--restore-deterministic-wallet uses --generate-new-wallet, not --wallet-file"); + return false; + } if (m_electrum_seed.empty()) { @@ -1090,6 +1109,10 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm) } else { + if (m_generate_new.empty()) { + fail_msg_writer() << tr("specify a wallet path with --generate-new-wallet (not --wallet-file)"); + return false; + } m_wallet_file = m_generate_new; bool r = new_wallet(vm, m_recovery_key, m_restore_deterministic_wallet, m_non_deterministic, old_language); CHECK_AND_ASSERT_MES(r, false, tr("account creation failed")); diff --git a/src/simplewallet/simplewallet.h b/src/simplewallet/simplewallet.h index 1b58ff32a..edef47e01 100644 --- a/src/simplewallet/simplewallet.h +++ b/src/simplewallet/simplewallet.h @@ -170,6 +170,7 @@ namespace cryptonote bool import_outputs(const std::vector<std::string> &args); bool show_transfer(const std::vector<std::string> &args); bool change_password(const std::vector<std::string>& args); + bool payment_id(const std::vector<std::string> &args); uint64_t get_daemon_blockchain_height(std::string& err); bool try_connect_to_daemon(bool silent = false, uint32_t* version = nullptr); |