aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/context.h
diff options
context:
space:
mode:
authorJoão Barbosa <joao.paulo.barbosa@gmail.com>2021-09-02 23:11:50 +0100
committerJoão Barbosa <joao.paulo.barbosa@gmail.com>2021-11-22 09:42:36 +0000
commitf13a22a631efe01e1fbae4ae78a4901d14ebda3c (patch)
treee92718930ac203042bc4945de54d476a3a3e5ce5 /src/wallet/context.h
parent47fe7445e7f54aee10ec6dbc53f1db1adbeb43de (diff)
downloadbitcoin-f13a22a631efe01e1fbae4ae78a4901d14ebda3c.tar.xz
wallet: Call load handlers without cs_wallet locked
Co-authored-by: Russell Yanofsky <russ@yanofsky.org>
Diffstat (limited to 'src/wallet/context.h')
-rw-r--r--src/wallet/context.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/wallet/context.h b/src/wallet/context.h
index a382fb9021..dbd172e88e 100644
--- a/src/wallet/context.h
+++ b/src/wallet/context.h
@@ -34,6 +34,8 @@ using LoadWalletFn = std::function<void(std::unique_ptr<interfaces::Wallet> wall
struct WalletContext {
interfaces::Chain* chain{nullptr};
ArgsManager* args{nullptr}; // Currently a raw pointer because the memory is not managed by this struct
+ // It is unsafe to lock this after locking a CWallet::cs_wallet mutex because
+ // this could introduce inconsistent lock ordering and cause deadlocks.
Mutex wallets_mutex;
std::vector<std::shared_ptr<CWallet>> wallets GUARDED_BY(wallets_mutex);
std::list<LoadWalletFn> wallet_load_fns GUARDED_BY(wallets_mutex);