|
|
@ -1186,6 +1186,7 @@ wallet2::wallet2(network_type nettype, uint64_t kdf_rounds, bool unattended):
|
|
|
|
m_ringdb(),
|
|
|
|
m_ringdb(),
|
|
|
|
m_last_block_reward(0),
|
|
|
|
m_last_block_reward(0),
|
|
|
|
m_encrypt_keys_after_refresh(boost::none),
|
|
|
|
m_encrypt_keys_after_refresh(boost::none),
|
|
|
|
|
|
|
|
m_decrypt_keys_lockers(0),
|
|
|
|
m_unattended(unattended),
|
|
|
|
m_unattended(unattended),
|
|
|
|
m_devices_registered(false),
|
|
|
|
m_devices_registered(false),
|
|
|
|
m_device_last_key_image_sync(0),
|
|
|
|
m_device_last_key_image_sync(0),
|
|
|
@ -4371,12 +4372,18 @@ bool wallet2::verify_password(const std::string& keys_file_name, const epee::wip
|
|
|
|
|
|
|
|
|
|
|
|
void wallet2::encrypt_keys(const crypto::chacha_key &key)
|
|
|
|
void wallet2::encrypt_keys(const crypto::chacha_key &key)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
boost::lock_guard<boost::mutex> lock(m_decrypt_keys_lock);
|
|
|
|
|
|
|
|
if (--m_decrypt_keys_lockers) // another lock left ?
|
|
|
|
|
|
|
|
return;
|
|
|
|
m_account.encrypt_keys(key);
|
|
|
|
m_account.encrypt_keys(key);
|
|
|
|
m_account.decrypt_viewkey(key);
|
|
|
|
m_account.decrypt_viewkey(key);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void wallet2::decrypt_keys(const crypto::chacha_key &key)
|
|
|
|
void wallet2::decrypt_keys(const crypto::chacha_key &key)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
boost::lock_guard<boost::mutex> lock(m_decrypt_keys_lock);
|
|
|
|
|
|
|
|
if (m_decrypt_keys_lockers++) // already unlocked ?
|
|
|
|
|
|
|
|
return;
|
|
|
|
m_account.encrypt_viewkey(key);
|
|
|
|
m_account.encrypt_viewkey(key);
|
|
|
|
m_account.decrypt_keys(key);
|
|
|
|
m_account.decrypt_keys(key);
|
|
|
|
}
|
|
|
|
}
|
|
|
|