diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2019-01-15 14:08:26 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2019-01-15 14:38:23 +0100 |
commit | 1b6fc30530459eae8cff2ac95206719e4c664a55 (patch) | |
tree | 64f9564d1e1d79084b46597d5e35b758c963366d /src/wallet/init.cpp | |
parent | cf0c67b62c2037dc9e70ea84ffee3b205a9b1bef (diff) | |
parent | 645e905c327411555073fa7964b36f652998059f (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/init.cpp')
-rw-r--r-- | src/wallet/init.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/wallet/init.cpp b/src/wallet/init.cpp index 14d811c6cd..87cd264c3d 100644 --- a/src/wallet/init.cpp +++ b/src/wallet/init.cpp @@ -242,7 +242,11 @@ void StopWallets() void UnloadWallets() { - for (const std::shared_ptr<CWallet>& pwallet : GetWallets()) { - RemoveWallet(pwallet); + auto wallets = GetWallets(); + while (!wallets.empty()) { + auto wallet = wallets.back(); + wallets.pop_back(); + RemoveWallet(wallet); + UnloadWallet(std::move(wallet)); } } |