Add password parameter
MODIFY
WalletWasabi.Fluent/Rpc/WasabiJsonRpcService.cs
WalletWasabi.Fluent/Rpc/WasabiJsonRpcService.cs
@@ -250,13 +250,13 @@ public class WasabiJsonRpcService : IJsonRpcService
}
[JsonRpcMethod("startcoinjoin")]
- public void StartCoinJoining(bool stopWhenAllMixed = true, bool overridePlebStop = true)
+ public void StartCoinJoining(string? password = null, bool stopWhenAllMixed = true, bool overridePlebStop = true)
{
var coinJoinManager = Global.HostedServices.Get<CoinJoinManager>();
var activeWallet = Guard.NotNull(nameof(ActiveWallet), ActiveWallet);
AssertWalletIsLoaded();
-
+ AssertWalletIsLoggedIn(activeWallet, password ?? "");
coinJoinManager.StartAsync(activeWallet, stopWhenAllMixed, overridePlebStop, CancellationToken.None).ConfigureAwait(false);
}
@@ -305,4 +305,12 @@ public class WasabiJsonRpcService : IJsonRpcService
throw new InvalidOperationException("There is no wallet loaded.");
}
}
+
+ private void AssertWalletIsLoggedIn(Wallet activeWallet, string password)
+ {
+ if (!activeWallet.IsLoggedIn && !activeWallet.TryLogin(password, out _))
+ {
+ throw new Exception($"'{activeWallet.WalletName}' wallet requires the password to start coinjoining.");
+ }
+ }
}

Add password parameter (#8962)