diff options
author | Russell Yanofsky <russ@yanofsky.org> | 2020-03-10 15:46:20 -0400 |
---|---|---|
committer | João Barbosa <joao.paulo.barbosa@gmail.com> | 2020-03-27 15:17:35 +0000 |
commit | ab31b9d6fe7b39713682e3f52d11238dbe042c16 (patch) | |
tree | f719291130d3322eaac867b793309f476d8872c1 /src/wallet/wallet.h | |
parent | 3e50fdbe4e5bb98194e88023468bd77dee78b26e (diff) | |
download | bitcoin-ab31b9d6fe7b39713682e3f52d11238dbe042c16.tar.xz |
Fix wallet unload race condition
Currently it's possible for ReleaseWallet to delete the CWallet pointer while
it is processing BlockConnected, etc chain notifications.
To fix this, unregister from notifications earlier in UnloadWallet instead of
ReleaseWallet, and use a new RegisterSharedValidationInterface function to
prevent the CValidationInterface shared_ptr from being deleted until the last
notification is actually finished.
Diffstat (limited to 'src/wallet/wallet.h')
-rw-r--r-- | src/wallet/wallet.h | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index 75fd14a80e..e3903bfcf4 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -605,7 +605,7 @@ class WalletRescanReserver; //forward declarations for ScanForWalletTransactions /** * A CWallet maintains a set of transactions and balances, and provides the ability to create new transactions. */ -class CWallet final : public WalletStorage, private interfaces::Chain::Notifications +class CWallet final : public WalletStorage, public interfaces::Chain::Notifications { private: CKeyingMaterial vMasterKey GUARDED_BY(cs_wallet); @@ -781,9 +781,6 @@ public: /** Registered interfaces::Chain::Notifications handler. */ std::unique_ptr<interfaces::Handler> m_chain_notifications_handler; - /** Register the wallet for chain notifications */ - void handleNotifications(); - /** Interface for accessing chain state. */ interfaces::Chain& chain() const { assert(m_chain); return *m_chain; } |