Daemon no longer accesses Global.WalletService.
MODIFY
WalletWasabi.Gui/CommandLine/Daemon.cs
WalletWasabi.Gui/CommandLine/Daemon.cs
using System;
-using System.Diagnostics;
using System.IO;
-using System.Linq;
-using System.Text;
using System.Threading.Tasks;
using WalletWasabi.Blockchain.Keys;
using WalletWasabi.CoinJoin.Client.Clients.Queuing;
using WalletWasabi.Helpers;
using WalletWasabi.Logging;
+using WalletWasabi.Services;
namespace WalletWasabi.Gui.CommandLine
{
public class Daemon
{
- public Global Global { get; }
-
public Daemon(Global global)
{
Global = global;
}
+ private Global Global { get; }
+
+ private WalletService WalletService { get; set; }
+
internal async Task RunAsync(string walletName, bool mixAll, bool keepMixAlive)
{
try
@@ -78,7 +78,7 @@ namespace WalletWasabi.Gui.CommandLine
return;
}
- await Global.InitializeWalletServiceAsync(keyManager);
+ WalletService = await Global.CreateWalletServiceAsync(keyManager);
if (Global.KillRequested)
{
return;
@@ -100,7 +100,7 @@ namespace WalletWasabi.Gui.CommandLine
break;
}
- bool anyCoinsQueued = Global.WalletService.ChaumianClient.State.AnyCoinsQueued();
+ bool anyCoinsQueued = WalletService.ChaumianClient.State.AnyCoinsQueued();
if (!anyCoinsQueued && keepMixAlive) // If no coins queued and mixing is asked to be kept alive then try to queue coins.
{
await TryQueueCoinsToMixAsync(mixAll, password);
@@ -117,7 +117,7 @@ namespace WalletWasabi.Gui.CommandLine
if (!Global.KillRequested) // This only has to run if it finishes by itself. Otherwise the Ctrl+c runs it.
{
- await Global.WalletService.ChaumianClient?.DequeueAllCoinsFromMixAsync(DequeueReason.ApplicationExit);
+ await WalletService.ChaumianClient?.DequeueAllCoinsFromMixAsync(DequeueReason.ApplicationExit);
}
}
catch
@@ -178,13 +178,13 @@ namespace WalletWasabi.Gui.CommandLine
{
try
{
- var coinsView = Global.WalletService.Coins;
+ var coinsView = WalletService.Coins;
var coinsToMix = coinsView.Available();
if (!mixAll)
{
- coinsToMix = coinsToMix.FilterBy(x => x.AnonymitySet < Global.WalletService.ServiceConfiguration.MixUntilAnonymitySet);
+ coinsToMix = coinsToMix.FilterBy(x => x.AnonymitySet < WalletService.ServiceConfiguration.MixUntilAnonymitySet);
}
- await Global.WalletService.ChaumianClient.QueueCoinsToMixAsync(password, coinsToMix.ToArray());
+ await WalletService.ChaumianClient.QueueCoinsToMixAsync(password, coinsToMix.ToArray());
}
catch (Exception ex)
{

Daemon no longer accesses Global.WalletService.