wallet: WaitForDeleteWallet, do not expect thread safety

Multiple threads could try to delete the wallet at the same time.
This commit is contained in:
Ryan Ofsky authored and furszy committed 2024-08-14 16:14:54 -03:00
1 parent 8872b4a6ca
commit 64e736d79e
1 file changed
+3 -2
+3 -2
View File
@@ -250,8 +250,9 @@ void WaitForDeleteWallet(std::shared_ptr<CWallet>&& wallet)
const std::string name = wallet->GetName(); const std::string name = wallet->GetName();
{ {
LOCK(g_wallet_release_mutex); LOCK(g_wallet_release_mutex);
auto it = g_unloading_wallet_set.insert(name); g_unloading_wallet_set.insert(name);
assert(it.second); // Do not expect to be the only one removing this wallet.
// Multiple threads could simultaneously be waiting for deletion.
} }
// Time to ditch our shared_ptr and wait for ReleaseWallet call. // Time to ditch our shared_ptr and wait for ReleaseWallet call.