aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_basic
diff options
context:
space:
mode:
authortobtoht <tob@featherwallet.org>2025-02-13 17:43:24 +0000
committertobtoht <tob@featherwallet.org>2025-02-13 17:43:24 +0000
commit5b045d70e0cb336eef9b962e53c827df3dcf469b (patch)
tree2b087e184c5fdc6ce1d0f226104e89aa2d1dff25 /src/cryptonote_basic
parent903e4fa3608a7432b47124bda9eb21aba1b2187e (diff)
parente44e8b164030cfbddb9ae8b39251c1ccf396e2b6 (diff)
downloadmonzero-core-5b045d70e0cb336eef9b962e53c827df3dcf469b.tar.gz
monzero-core-5b045d70e0cb336eef9b962e53c827df3dcf469b.tar.xz
monzero-core-5b045d70e0cb336eef9b962e53c827df3dcf469b.zip
Merge pull request #8617
e44e8b164 wallet: background sync with just the view key (j-berman)
Diffstat (limited to 'src/cryptonote_basic')
-rw-r--r--src/cryptonote_basic/account.cpp11
-rw-r--r--src/cryptonote_basic/account.h1
2 files changed, 12 insertions, 0 deletions
diff --git a/src/cryptonote_basic/account.cpp b/src/cryptonote_basic/account.cpp
index 2ac455fda..4e87d4477 100644
--- a/src/cryptonote_basic/account.cpp
+++ b/src/cryptonote_basic/account.cpp
@@ -152,6 +152,17 @@ DISABLE_VS_WARNINGS(4244 4345)
m_keys.m_multisig_keys.clear();
}
//-----------------------------------------------------------------
+ void account_base::set_spend_key(const crypto::secret_key& spend_secret_key)
+ {
+ // make sure derived spend public key matches saved public spend key
+ crypto::public_key spend_public_key;
+ crypto::secret_key_to_public_key(spend_secret_key, spend_public_key);
+ CHECK_AND_ASSERT_THROW_MES(m_keys.m_account_address.m_spend_public_key == spend_public_key,
+ "Unexpected derived public spend key");
+
+ m_keys.m_spend_secret_key = spend_secret_key;
+ }
+ //-----------------------------------------------------------------
crypto::secret_key account_base::generate(const crypto::secret_key& recovery_key, bool recover, bool two_random)
{
crypto::secret_key first = generate_keys(m_keys.m_account_address.m_spend_public_key, m_keys.m_spend_secret_key, recovery_key, recover);
diff --git a/src/cryptonote_basic/account.h b/src/cryptonote_basic/account.h
index 2ee9545d4..93d1d28f0 100644
--- a/src/cryptonote_basic/account.h
+++ b/src/cryptonote_basic/account.h
@@ -95,6 +95,7 @@ namespace cryptonote
bool store(const std::string& file_path);
void forget_spend_key();
+ void set_spend_key(const crypto::secret_key& spend_secret_key);
const std::vector<crypto::secret_key> &get_multisig_keys() const { return m_keys.m_multisig_keys; }
void encrypt_keys(const crypto::chacha_key &key) { m_keys.encrypt(key); }