mirror of
https://github.com/monero-project/monero.git
synced 2026-01-19 16:10:35 -08:00
simplewallet: add a new --restore-from-keys option
It is similar in use to --restore-from-view-key, but also expects a spend private key. Requested by luigi1112, and useful to restore MyMonero wallets.
This commit is contained in:
@@ -93,9 +93,10 @@ DISABLE_VS_WARNINGS(4244 4345)
|
||||
return first;
|
||||
}
|
||||
//-----------------------------------------------------------------
|
||||
void account_base::create_from_viewkey(const cryptonote::account_public_address& address, const crypto::secret_key& viewkey)
|
||||
void account_base::create_from_keys(const cryptonote::account_public_address& address, const crypto::secret_key& spendkey, const crypto::secret_key& viewkey)
|
||||
{
|
||||
m_keys.m_account_address = address;
|
||||
m_keys.m_spend_secret_key = spendkey;
|
||||
m_keys.m_view_secret_key = viewkey;
|
||||
|
||||
struct tm timestamp;
|
||||
@@ -109,6 +110,13 @@ DISABLE_VS_WARNINGS(4244 4345)
|
||||
m_creation_timestamp = mktime(×tamp);
|
||||
}
|
||||
//-----------------------------------------------------------------
|
||||
void account_base::create_from_viewkey(const cryptonote::account_public_address& address, const crypto::secret_key& viewkey)
|
||||
{
|
||||
crypto::secret_key fake;
|
||||
memset(&fake, 0, sizeof(fake));
|
||||
create_from_keys(address, fake, viewkey);
|
||||
}
|
||||
//-----------------------------------------------------------------
|
||||
const account_keys& account_base::get_keys() const
|
||||
{
|
||||
return m_keys;
|
||||
|
||||
Reference in New Issue
Block a user