mirror of
https://github.com/monero-project/monero.git
synced 2026-06-12 19:11:36 -07:00
Merge pull request #10577
9a18697 wallet: roll back unlocker count on decrypt failure (fuyua9)
This commit is contained in:
+12
-2
@@ -1121,10 +1121,20 @@ wallet_keys_unlocker::wallet_keys_unlocker(wallet2 &w, const epee::wipeable_stri
|
||||
w.generate_chacha_key_from_password(*password, key);
|
||||
|
||||
boost::lock_guard<boost::mutex> lock(lockers_lock);
|
||||
if (lockers_per_wallet[std::addressof(w)]++ > 0)
|
||||
wallet2* w_ptr = std::addressof(w);
|
||||
if (lockers_per_wallet[w_ptr]++ > 0)
|
||||
return;
|
||||
|
||||
w.decrypt_keys(key);
|
||||
try
|
||||
{
|
||||
w.decrypt_keys(key);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
if (--lockers_per_wallet[w_ptr] == 0)
|
||||
lockers_per_wallet.erase(w_ptr);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
wallet_keys_unlocker::~wallet_keys_unlocker()
|
||||
|
||||
Reference in New Issue
Block a user