aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet.h
diff options
context:
space:
mode:
authorJoão Barbosa <joao.paulo.barbosa@gmail.com>2018-12-12 23:21:19 +0000
committerJoão Barbosa <joao.paulo.barbosa@gmail.com>2019-01-15 00:01:00 +0000
commitc37851de5752f107c16e19317f28038b6b7ca2dc (patch)
tree9630a18acef413ea7fed27268037db1a84ead1f5 /src/wallet/wallet.h
parente7b88ecbc920321290941bc68e4a71634889c3cb (diff)
downloadbitcoin-c37851de5752f107c16e19317f28038b6b7ca2dc.tar.xz
rpc: Make unloadwallet wait for complete wallet unload
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 95a2c833f8..fc88b1bae8 100644
--- a/src/wallet/wallet.h
+++ b/src/wallet/wallet.h
@@ -54,6 +54,13 @@ void StopWallets();
//! Close all wallets.
void UnloadWallets();
+//! 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();
@@ -770,6 +777,8 @@ public:
~CWallet()
{
+ // Should not have slots connected at this point.
+ assert(NotifyUnload.empty());
delete encrypted_batch;
encrypted_batch = nullptr;
}