@@ -188,7 +188,16 @@ void WalletInit::Construct(InitInterfaces& interfaces) const
188
188
if (default_wallet.Exists ()) {
189
189
gArgs .SoftSetArg (" -wallet" , " " );
190
190
}
191
- interfaces.chain_clients .emplace_back (interfaces::MakeWalletClient (*interfaces.chain , gArgs .GetArgs (" -wallet" )));
191
+ std::vector<std::string> wallets = gArgs .GetArgs (" -wallet" );
192
+ std::stringstream ss (gArgs .GetArg (" -loadedwallet" , " " ));
193
+ std::string loaded_wallet;
194
+ while (std::getline (ss, loaded_wallet, ' ,' )) {
195
+ if (std::find (wallets.begin (), wallets.end (), loaded_wallet) == wallets.end ()) {
196
+ wallets.push_back (loaded_wallet);
197
+ }
198
+ }
199
+
200
+ interfaces.chain_clients .emplace_back (interfaces::MakeWalletClient (*interfaces.chain , wallets));
192
201
}
193
202
194
203
bool LoadWallets (interfaces::Chain& chain, const std::vector<std::string>& wallet_files)
@@ -231,10 +240,19 @@ void StopWallets()
231
240
void UnloadWallets ()
232
241
{
233
242
auto wallets = GetWallets ();
243
+ std::string loaded_wallets = " " ;
234
244
while (!wallets.empty ()) {
235
245
auto wallet = wallets.back ();
246
+
247
+ // Write the wallet name to rw conf
248
+ if (!loaded_wallets.empty ()) {
249
+ loaded_wallets += " ," ;
250
+ }
251
+ loaded_wallets += wallet->GetName ();
252
+
236
253
wallets.pop_back ();
237
254
RemoveWallet (wallet);
238
255
UnloadWallet (std::move (wallet));
239
256
}
257
+ gArgs .ModifyRWConfigFile (" loadedwallet" , loaded_wallets);
240
258
}
0 commit comments