mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-12-22 21:58:52 +00:00
Merge pull request #187
3dd19c4
prompt for seed language and error handling - "seed" simplewallet command was only displaying seed if wallet was newly generated (warptangent)
This commit is contained in:
commit
220832b791
@ -207,6 +207,13 @@ bool simple_wallet::viewkey(const std::vector<std::string> &args/* = std::vector
|
|||||||
bool simple_wallet::seed(const std::vector<std::string> &args/* = std::vector<std::string>()*/)
|
bool simple_wallet::seed(const std::vector<std::string> &args/* = std::vector<std::string>()*/)
|
||||||
{
|
{
|
||||||
std::string electrum_words;
|
std::string electrum_words;
|
||||||
|
|
||||||
|
if (m_wallet->get_seed_language().empty())
|
||||||
|
{
|
||||||
|
std::string mnemonic_language = get_mnemonic_language();
|
||||||
|
m_wallet->set_seed_language(mnemonic_language);
|
||||||
|
}
|
||||||
|
|
||||||
bool success = m_wallet->get_seed(electrum_words);
|
bool success = m_wallet->get_seed(electrum_words);
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
|
@ -91,6 +91,12 @@ void wallet2::init(const std::string& daemon_address, uint64_t upper_transaction
|
|||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
bool wallet2::get_seed(std::string& electrum_words)
|
bool wallet2::get_seed(std::string& electrum_words)
|
||||||
{
|
{
|
||||||
|
if (seed_language.empty())
|
||||||
|
{
|
||||||
|
std::cout << "seed_language not set" << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
crypto::ElectrumWords::bytes_to_words(get_account().get_keys().m_spend_secret_key, electrum_words, seed_language);
|
crypto::ElectrumWords::bytes_to_words(get_account().get_keys().m_spend_secret_key, electrum_words, seed_language);
|
||||||
|
|
||||||
crypto::secret_key second;
|
crypto::secret_key second;
|
||||||
@ -100,6 +106,13 @@ bool wallet2::get_seed(std::string& electrum_words)
|
|||||||
|
|
||||||
return memcmp(second.data,get_account().get_keys().m_view_secret_key.data, sizeof(crypto::secret_key)) == 0;
|
return memcmp(second.data,get_account().get_keys().m_view_secret_key.data, sizeof(crypto::secret_key)) == 0;
|
||||||
}
|
}
|
||||||
|
/*!
|
||||||
|
* \brief Gets the seed language
|
||||||
|
*/
|
||||||
|
const std::string wallet2::get_seed_language()
|
||||||
|
{
|
||||||
|
return seed_language;
|
||||||
|
}
|
||||||
/*!
|
/*!
|
||||||
* \brief Sets the seed language
|
* \brief Sets the seed language
|
||||||
* \param language Seed language to set to
|
* \param language Seed language to set to
|
||||||
|
@ -169,6 +169,10 @@ namespace tools
|
|||||||
void callback(i_wallet2_callback* callback) { m_callback = callback; }
|
void callback(i_wallet2_callback* callback) { m_callback = callback; }
|
||||||
|
|
||||||
bool get_seed(std::string& electrum_words);
|
bool get_seed(std::string& electrum_words);
|
||||||
|
/*!
|
||||||
|
* \brief Gets the seed language
|
||||||
|
*/
|
||||||
|
const std::string get_seed_language();
|
||||||
/*!
|
/*!
|
||||||
* \brief Sets the seed language
|
* \brief Sets the seed language
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user