aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet.h
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2019-01-15 14:08:26 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2019-01-15 14:38:23 +0100
commit1b6fc30530459eae8cff2ac95206719e4c664a55 (patch)
tree64f9564d1e1d79084b46597d5e35b758c963366d /src/wallet/wallet.h
parentcf0c67b62c2037dc9e70ea84ffee3b205a9b1bef (diff)
parent645e905c327411555073fa7964b36f652998059f (diff)
Merge #14941: rpc: Make unloadwallet wait for complete wallet unload
645e905c327411555073fa7964b36f652998059f doc: Add release notes for unloadwallet change to synchronous call (João Barbosa) c37851de5752f107c16e19317f28038b6b7ca2dc rpc: Make unloadwallet wait for complete wallet unload (João Barbosa) Pull request description: Currently the `unloadwallet` RPC is asynchronous, it only signals the intent to unload the wallet and then returns the response to the client. The actual unload can happen later and the client has no way to be notified of that. This PR makes the `unloadwallet` RPC synchronous, meaning that it blocks until the wallet is fully unloaded. Replaces #14919, fixes #14917. Tree-SHA512: ad88b980e2f3652809a58f904afbfe020299f3aa6a517f495ba943b8d54d4520f6e70074d6749be8f5967065c0f476e0faedcde64c8b4899e5f99c70f0fd6534
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 3a3ec43c9b..6872fbad2d 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;
}