Put RsaKey into Coordinator instead of Global
MODIFY
WalletWasabi.Backend/Controllers/ChaumianCoinJoinController.cs
WalletWasabi.Backend/Controllers/ChaumianCoinJoinController.cs
@@ -31,7 +31,7 @@ namespace WalletWasabi.Backend.Controllers
private static CcjCoordinator Coordinator => Global.Coordinator;
- private static BlindingRsaKey RsaKey => Global.RsaKey;
+ private static BlindingRsaKey RsaKey => Coordinator.RsaKey;
/// <summary>
/// Satoshi gets various status information.

MODIFY
WalletWasabi.Backend/Global.cs
WalletWasabi.Backend/Global.cs
@@ -32,8 +32,6 @@ namespace WalletWasabi.Backend
public static RPCClient RpcClient { get; private set; }
- public static BlindingRsaKey RsaKey { get; private set; }
-
public static IndexBuilderService IndexBuilderService { get; private set; }
public static CcjCoordinator Coordinator { get; private set; }
@@ -50,20 +48,6 @@ namespace WalletWasabi.Backend
RoundConfig = Guard.NotNull(nameof(roundConfig), roundConfig);
RpcClient = Guard.NotNull(nameof(rpc), rpc);
- // Initialize RsaKey
- string rsaKeyPath = Path.Combine(DataDir, "RsaKey.json");
- if (File.Exists(rsaKeyPath))
- {
- string rsaKeyJson = await File.ReadAllTextAsync(rsaKeyPath, encoding: Encoding.UTF8);
- RsaKey = BlindingRsaKey.CreateFromJson(rsaKeyJson);
- }
- else
- {
- RsaKey = new BlindingRsaKey();
- await File.WriteAllTextAsync(rsaKeyPath, RsaKey.ToJson(), encoding: Encoding.UTF8);
- Logger.LogInfo($"Created RSA key at: {rsaKeyPath}", nameof(Global));
- }
-
await AssertRpcNodeFullyInitializedAsync();
// Initialize index building

MODIFY
WalletWasabi/Services/CcjCoordinator.cs
WalletWasabi/Services/CcjCoordinator.cs
@@ -9,6 +9,7 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
using WalletWasabi.ChaumianCoinJoin;
+using WalletWasabi.Crypto;
using WalletWasabi.Helpers;
using WalletWasabi.Logging;
@@ -31,6 +32,8 @@ namespace WalletWasabi.Services
public Network Network { get; }
public string FolderPath { get; }
+ public BlindingRsaKey RsaKey { get; }
+
public CcjCoordinator(Network network, string folderPath, RPCClient rpc, CcjRoundConfig roundConfig)
{
Network = Guard.NotNull(nameof(network), network);
@@ -46,6 +49,21 @@ namespace WalletWasabi.Services
CoinJoinsLock = new AsyncLock();
Directory.CreateDirectory(FolderPath);
+
+ // Initialize RsaKey
+ string rsaKeyPath = Path.Combine(FolderPath, "RsaKey.json");
+ if (File.Exists(rsaKeyPath))
+ {
+ string rsaKeyJson = File.ReadAllText(rsaKeyPath, encoding: Encoding.UTF8);
+ RsaKey = BlindingRsaKey.CreateFromJson(rsaKeyJson);
+ }
+ else
+ {
+ RsaKey = new BlindingRsaKey();
+ File.WriteAllText(rsaKeyPath, RsaKey.ToJson(), encoding: Encoding.UTF8);
+ Logger.LogInfo<CcjCoordinator>($"Created RSA key at: {rsaKeyPath}");
+ }
+
if(File.Exists(CoinJoinsFilePath))
{
try

Put RsaKey into Coordinator instead of Global