Pick up bannedutxos from file on the fly
MODIFY
HiddenWallet.ChaumianTumbler/Global.cs
HiddenWallet.ChaumianTumbler/Global.cs
@@ -21,7 +21,6 @@ namespace HiddenWallet.ChaumianTumbler
{
_dataDir = null;
CoinJoinStorePath = Path.Combine(DataDir, "CoinJoins.json");
- UtxoRefereePath = Path.Combine(DataDir, "BannedUtxos.json");
await InitializeConfigAsync();
@@ -55,6 +54,23 @@ namespace HiddenWallet.ChaumianTumbler
CoinJoinStore = new CoinJoinStore();
}
+ await InitializeUtxoRefereeAsync();
+
+ StateMachine = new TumblerStateMachine();
+ StateMachineJobCancel = new CancellationTokenSource();
+ StateMachineJob = StateMachine.StartAsync(StateMachineJobCancel.Token);
+ }
+
+ public static async Task InitializeUtxoRefereeAsync()
+ {
+ UtxoRefereeJobCancel?.Cancel();
+ if (UtxoRefereeJob != null)
+ {
+ await UtxoRefereeJob;
+ UtxoRefereeJobCancel?.Dispose();
+ }
+
+ UtxoRefereePath = Path.Combine(DataDir, "BannedUtxos.json");
if (File.Exists(UtxoRefereePath))
{
UtxoReferee = await UtxoReferee.CreateFromFileAsync(UtxoRefereePath);
@@ -65,10 +81,6 @@ namespace HiddenWallet.ChaumianTumbler
}
UtxoRefereeJobCancel = new CancellationTokenSource();
UtxoRefereeJob = UtxoReferee.StartAsync(UtxoRefereeJobCancel.Token);
-
- StateMachine = new TumblerStateMachine();
- StateMachineJobCancel = new CancellationTokenSource();
- StateMachineJob = StateMachine.StartAsync(StateMachineJobCancel.Token);
}
public static async Task InitializeConfigAsync()

MODIFY
HiddenWallet.ChaumianTumbler/TumblerStateMachine.cs
HiddenWallet.ChaumianTumbler/TumblerStateMachine.cs
@@ -98,6 +98,7 @@ namespace HiddenWallet.ChaumianTumbler
case TumblerPhase.InputRegistration:
{
await Global.InitializeConfigAsync();
+ await Global.InitializeUtxoRefereeAsync();
RoundId++;
Console.WriteLine($"New Round: {RoundId}");

Pick up bannedutxos from file on the fly