Add tumbler statemachine
MODIFY
HiddenWallet.ChaumianTumbler/Controllers/TumblerController.cs
HiddenWallet.ChaumianTumbler/Controllers/TumblerController.cs
@@ -23,7 +23,10 @@ namespace HiddenWallet.ChaumianTumbler.Controllers
{
try
{
- throw new NotImplementedException();
+ return new JsonResult(new StatusResponse
+ {
+ Phase = Global.StateMachine.Phase
+ });
}
catch (Exception ex)
{

MODIFY
HiddenWallet.ChaumianTumbler/Global.cs
HiddenWallet.ChaumianTumbler/Global.cs
@@ -8,6 +8,8 @@ namespace HiddenWallet.ChaumianTumbler
{
public static class Global
{
+ public static TumblerStateMachine StateMachine;
+
private static string _dataDir = null;
public static string DataDir
{

MODIFY
HiddenWallet.ChaumianTumbler/Program.cs
HiddenWallet.ChaumianTumbler/Program.cs
@@ -7,6 +7,7 @@ using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
+using System.Threading;
namespace HiddenWallet.ChaumianTumbler
{
@@ -16,11 +17,17 @@ namespace HiddenWallet.ChaumianTumbler
public static async Task Main(string[] args)
#pragma warning restore IDE1006 // Naming Styles
{
- var host = WebHost.CreateDefaultBuilder(args)
+ using (var host = WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
- .Build();
-
+ .Build())
+ using(var ctsSource = new CancellationTokenSource())
+ {
+ Global.StateMachine = new TumblerStateMachine();
+ var stateMachineTask = Global.StateMachine.StartAsync(ctsSource.Token);
await host.RunAsync();
+ ctsSource.Cancel();
+ await stateMachineTask;
+ }
}
}
}

MODIFY
HiddenWallet/ChaumianCoinJoin/TumblerPhase.cs
HiddenWallet/ChaumianCoinJoin/TumblerPhase.cs
@@ -4,11 +4,11 @@ using System.Text;
namespace HiddenWallet.ChaumianCoinJoin
{
- public enum TumblerPhase
+ public static class TumblerPhase
{
- InputRegistration,
- InputConfirmation,
- OutputRegistration,
- Signing
+ public const string InputRegistration = "InputRegistration";
+ public const string InputConfirmation = "InputConfirmation";
+ public const string OutputRegistration = "OutputRegistration";
+ public const string Signing = "Signing";
}
}

Add tumbler statemachine