aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet.h
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2019-01-31 15:35:26 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2019-01-31 15:35:30 +0100
commit30db5cc6418aa104c05b21ceceea3f04d1066b5f (patch)
treecc1e5be832e20b396b0f15500f134cf531f186df /src/wallet/wallet.h
parent09a9238c045670ce22a2798a717925248d1483f4 (diff)
parent0cd9ad208c327127cc4616ccdc37557fad3cf381 (diff)
downloadbitcoin-30db5cc6418aa104c05b21ceceea3f04d1066b5f.tar.xz
Merge #15002: 0.17: Backport #14941
0cd9ad208c327127cc4616ccdc37557fad3cf381 rpc: Make unloadwallet wait for complete wallet unload (João Barbosa) Pull request description: #14941 makes `unloadwallet` a synchronous call meaning that it waits for the wallet to fully unload/delete. Tree-SHA512: df7a490306ee2cca399129a4ebfba4b19b65fe67d1657ec3518352fe453327cb347010f94cf7fe4a60aeb51c928cb9ad6b24c40123fd0b9dc0aab5920a59f48d
Diffstat (limited to 'src/wallet/wallet.h')
-rw-r--r--src/wallet/wallet.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h
index 7b791ae416..1f20834843 100644
--- a/src/wallet/wallet.h
+++ b/src/wallet/wallet.h
@@ -33,6 +33,13 @@
#include <utility>
#include <vector>
+//! Explicitly unload and delete the wallet.
+// Blocks the current thread after signaling the unload intent so that all
+// wallet clients release the wallet.
+// Note that, when blocking is not required, the wallet is implicitly unloaded
+// by the shared pointer deleter.
+void UnloadWallet(std::shared_ptr<CWallet>&& wallet);
+
bool AddWallet(const std::shared_ptr<CWallet>& wallet);
bool RemoveWallet(const std::shared_ptr<CWallet>& wallet);
bool HasWallets();
@@ -817,6 +824,8 @@ public:
~CWallet()
{
+ // Should not have slots connected at this point.
+ assert(NotifyUnload.empty());
delete encrypted_batch;
encrypted_batch = nullptr;
}