aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/test/wallet_test_fixture.cpp
diff options
context:
space:
mode:
authorRussell Yanofsky <russ@yanofsky.org>2020-03-10 15:46:20 -0400
committerJoão Barbosa <joao.paulo.barbosa@gmail.com>2020-03-27 15:17:35 +0000
commitab31b9d6fe7b39713682e3f52d11238dbe042c16 (patch)
treef719291130d3322eaac867b793309f476d8872c1 /src/wallet/test/wallet_test_fixture.cpp
parent3e50fdbe4e5bb98194e88023468bd77dee78b26e (diff)
Fix wallet unload race condition
Currently it's possible for ReleaseWallet to delete the CWallet pointer while it is processing BlockConnected, etc chain notifications. To fix this, unregister from notifications earlier in UnloadWallet instead of ReleaseWallet, and use a new RegisterSharedValidationInterface function to prevent the CValidationInterface shared_ptr from being deleted until the last notification is actually finished.
Diffstat (limited to 'src/wallet/test/wallet_test_fixture.cpp')
-rw-r--r--src/wallet/test/wallet_test_fixture.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/wallet/test/wallet_test_fixture.cpp b/src/wallet/test/wallet_test_fixture.cpp
index ba0843f352..b9e714946d 100644
--- a/src/wallet/test/wallet_test_fixture.cpp
+++ b/src/wallet/test/wallet_test_fixture.cpp
@@ -10,7 +10,6 @@ WalletTestingSetup::WalletTestingSetup(const std::string& chainName)
{
bool fFirstRun;
m_wallet.LoadWallet(fFirstRun);
- m_wallet.handleNotifications();
-
+ m_chain_notifications_handler = m_chain->handleNotifications({ &m_wallet, [](CWallet*) {} });
m_chain_client->registerRpcs();
}