@@ -84,7 +84,10 @@ static RPCHelpMan coinjoin_reset()
84
84
ValidateCoinJoinArguments ();
85
85
86
86
CHECK_NONFATAL (node.coinjoin_loader );
87
- auto cj_clientman = node.coinjoin_loader ->walletman ().Get (wallet->GetName ());
87
+ auto cj_clientman = [&](){
88
+ LOCK (node.coinjoin_loader ->walletman ().cs_wallet_manager_map );
89
+ return node.coinjoin_loader ->walletman ().Get (wallet->GetName ());
90
+ }();
88
91
89
92
CHECK_NONFATAL (cj_clientman);
90
93
cj_clientman->ResetPool ();
@@ -127,7 +130,10 @@ static RPCHelpMan coinjoin_start()
127
130
}
128
131
129
132
CHECK_NONFATAL (node.coinjoin_loader );
130
- auto cj_clientman = node.coinjoin_loader ->walletman ().Get (wallet->GetName ());
133
+ auto cj_clientman = [&](){
134
+ LOCK (node.coinjoin_loader ->walletman ().cs_wallet_manager_map );
135
+ return node.coinjoin_loader ->walletman ().Get (wallet->GetName ());
136
+ }();
131
137
132
138
CHECK_NONFATAL (cj_clientman);
133
139
if (!cj_clientman->StartMixing ()) {
@@ -169,7 +175,10 @@ static RPCHelpMan coinjoin_stop()
169
175
ValidateCoinJoinArguments ();
170
176
171
177
CHECK_NONFATAL (node.coinjoin_loader );
172
- auto cj_clientman = node.coinjoin_loader ->walletman ().Get (wallet->GetName ());
178
+ auto cj_clientman = [&](){
179
+ LOCK (node.coinjoin_loader ->walletman ().cs_wallet_manager_map );
180
+ return node.coinjoin_loader ->walletman ().Get (wallet->GetName ());
181
+ }();
173
182
174
183
CHECK_NONFATAL (cj_clientman);
175
184
if (!cj_clientman->IsMixing ()) {
@@ -239,7 +248,10 @@ static RPCHelpMan coinjoinsalt_generate()
239
248
240
249
const NodeContext& node = EnsureAnyNodeContext (request.context );
241
250
if (node.coinjoin_loader != nullptr ) {
242
- auto cj_clientman = node.coinjoin_loader ->walletman ().Get (wallet->GetName ());
251
+ auto cj_clientman = [&](){
252
+ LOCK (node.coinjoin_loader ->walletman ().cs_wallet_manager_map );
253
+ return node.coinjoin_loader ->walletman ().Get (wallet->GetName ());
254
+ }();
243
255
if (cj_clientman != nullptr && cj_clientman->IsMixing ()) {
244
256
throw JSONRPCError (RPC_WALLET_ERROR,
245
257
strprintf (" Wallet \" %s\" is currently mixing, cannot change salt!" , str_wallet));
@@ -341,7 +353,10 @@ static RPCHelpMan coinjoinsalt_set()
341
353
342
354
const NodeContext& node = EnsureAnyNodeContext (request.context );
343
355
if (node.coinjoin_loader != nullptr ) {
344
- auto cj_clientman = node.coinjoin_loader ->walletman ().Get (wallet->GetName ());
356
+ auto cj_clientman = [&](){
357
+ LOCK (node.coinjoin_loader ->walletman ().cs_wallet_manager_map );
358
+ return node.coinjoin_loader ->walletman ().Get (wallet->GetName ());
359
+ }();
345
360
if (cj_clientman != nullptr && cj_clientman->IsMixing ()) {
346
361
throw JSONRPCError (RPC_WALLET_ERROR,
347
362
strprintf (" Wallet \" %s\" is currently mixing, cannot change salt!" , str_wallet));
@@ -450,7 +465,10 @@ static RPCHelpMan getcoinjoininfo()
450
465
return obj;
451
466
}
452
467
453
- auto manager = node.coinjoin_loader ->walletman ().Get (wallet->GetName ());
468
+ auto manager = [&](){
469
+ LOCK (node.coinjoin_loader ->walletman ().cs_wallet_manager_map );
470
+ return node.coinjoin_loader ->walletman ().Get (wallet->GetName ());
471
+ }();
454
472
CHECK_NONFATAL (manager != nullptr );
455
473
manager->GetJsonInfo (obj);
456
474
0 commit comments