mirror of
https://github.com/monero-project/monero.git
synced 2024-11-17 16:27:39 +00:00
check its deterministic wallet before printing seed
when running the seed command
This commit is contained in:
parent
d0c8532819
commit
6575d4ebe5
1 changed files with 19 additions and 3 deletions
|
@ -46,7 +46,11 @@
|
|||
#include "version.h"
|
||||
#include "crypto/crypto.h" // for crypto::secret_key definition
|
||||
#include "crypto/electrum-words.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "crypto/keccak.h"
|
||||
#include "crypto/crypto-ops.h"
|
||||
}
|
||||
#if defined(WIN32)
|
||||
#include <crtdbg.h>
|
||||
#endif
|
||||
|
@ -193,8 +197,20 @@ bool simple_wallet::seed(const std::vector<std::string> &args/* = std::vector<st
|
|||
std::string electrum_words;
|
||||
crypto::ElectrumWords::bytes_to_words(m_wallet->get_account().get_keys().m_spend_secret_key, electrum_words);
|
||||
|
||||
success_msg_writer(true) << "\nPLEASE NOTE: the following 24 words can be used to recover access to your wallet. Please write them down and store them somewhere safe and secure. Please do not store them in your email or on file storage services outside of your immediate control.\n";
|
||||
std::cout << electrum_words << std::endl;
|
||||
crypto::secret_key second;
|
||||
keccak((uint8_t *)&m_wallet->get_account().get_keys().m_spend_secret_key, sizeof(crypto::secret_key), (uint8_t *)&second, sizeof(crypto::secret_key));
|
||||
|
||||
sc_reduce32((uint8_t *)&second);
|
||||
|
||||
if (memcmp(second.data,m_wallet->get_account().get_keys().m_view_secret_key.data, sizeof(crypto::secret_key))==0)
|
||||
{
|
||||
success_msg_writer(true) << "\nPLEASE NOTE: the following 24 words can be used to recover access to your wallet. Please write them down and store them somewhere safe and secure. Please do not store them in your email or on file storage services outside of your immediate control.\n";
|
||||
std::cout << electrum_words << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
fail_msg_writer() << "The wallet is non-deterministic. Cannot display seed.";
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue