diff options
author | João Barbosa <joao.paulo.barbosa@gmail.com> | 2018-12-12 23:21:19 +0000 |
---|---|---|
committer | João Barbosa <joao.paulo.barbosa@gmail.com> | 2019-01-16 00:33:32 +0000 |
commit | 0cd9ad208c327127cc4616ccdc37557fad3cf381 (patch) | |
tree | 41393ae40812ce24475b650c89b70858d88f0336 /src/wallet/wallet.h | |
parent | 0a0b2ea11fde7becbdd1c04205336c3a39bffbc0 (diff) | |
download | bitcoin-0cd9ad208c327127cc4616ccdc37557fad3cf381.tar.xz |
rpc: Make unloadwallet wait for complete wallet unload
Github-Pull: #14941
Rebased-From: c37851d
Diffstat (limited to 'src/wallet/wallet.h')
-rw-r--r-- | src/wallet/wallet.h | 9 |
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; } |