diff options
author | Riccardo Spagni <ric@spagni.net> | 2016-02-08 18:34:39 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2016-02-08 18:34:40 +0200 |
commit | 1cfe0bdbef9bf594c4bcadbf7f759dd2b1abe265 (patch) | |
tree | be715efae2feb11e755af084007fcf3a840fd102 /src | |
parent | Merge pull request #646 (diff) | |
parent | simplewallet: check watch-only view key matches standard address (diff) | |
download | monero-1cfe0bdbef9bf594c4bcadbf7f759dd2b1abe265.tar.xz |
Merge pull request #648
f6abc53 simplewallet: check watch-only view key matches standard address (moneromooo-monero)
Diffstat (limited to 'src')
-rw-r--r-- | src/simplewallet/simplewallet.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index 9e82d29de..f4dcb6a35 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -897,6 +897,17 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm) for (size_t n = 3; n < parts.size(); ++n) m_wallet_file += std::string(":") + parts[n]; + // check the view key matches the given address + crypto::public_key pkey; + if (!crypto::secret_key_to_public_key(viewkey, pkey)) { + fail_msg_writer() << tr("failed to verify view key secret key"); + return false; + } + if (address.m_view_public_key != pkey) { + fail_msg_writer() << tr("view key does not match standard address"); + return false; + } + bool r = new_wallet(m_wallet_file, pwd_container.password(), address, viewkey, testnet); CHECK_AND_ASSERT_MES(r, false, tr("account creation failed")); } |