Remobe `ActiveRounds` property from arena
It was used only for unit testing so, it had to be moved to somewhere
else.
MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/PhaseStepping/StepConnectionConfirmationTests.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/PhaseStepping/StepConnectionConfirmationTests.cs
@@ -131,7 +131,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PhaseStepping
using Arena arena = await ArenaBuilder.From(cfg, prison).CreateAndStartAsync(round);
await arena.TriggerAndWaitRoundAsync(TimeSpan.FromSeconds(21));
- Assert.DoesNotContain(round, arena.ActiveRounds);
+ Assert.DoesNotContain(round, arena.GetActiveRounds());
Assert.Equal(3, prison.CountInmates().noted);
Assert.Equal(0, prison.CountInmates().banned);

MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/PhaseStepping/StepInputRegistrationTests.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/PhaseStepping/StepInputRegistrationTests.cs
using System;
+using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Moq;
@@ -159,7 +160,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PhaseStepping
round.Alices.Add(WabiSabiFactory.CreateAlice(round));
await arena.TriggerAndWaitRoundAsync(TimeSpan.FromSeconds(21));
Assert.Equal(Phase.Ended, round.Phase);
- Assert.DoesNotContain(round, arena.ActiveRounds);
+ Assert.DoesNotContain(round, arena.GetActiveRounds());
await arena.StopAsync(CancellationToken.None);
}
@@ -188,7 +189,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PhaseStepping
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(cfg, blameRound);
await arena.TriggerAndWaitRoundAsync(TimeSpan.FromSeconds(21));
Assert.Equal(Phase.Ended, blameRound.Phase);
- Assert.DoesNotContain(blameRound, arena.ActiveRounds);
+ Assert.DoesNotContain(blameRound, arena.GetActiveRounds());
await arena.StopAsync(CancellationToken.None);
}

MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/PhaseStepping/StepTransactionSigningTests.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/PhaseStepping/StepTransactionSigningTests.cs
@@ -45,7 +45,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PhaseStepping
await aliceClient1.SignTransactionAsync(signedCoinJoin, CancellationToken.None);
await aliceClient2.SignTransactionAsync(signedCoinJoin, CancellationToken.None);
await arena.TriggerAndWaitRoundAsync(TimeSpan.FromSeconds(21));
- Assert.DoesNotContain(round, arena.ActiveRounds);
+ Assert.DoesNotContain(round, arena.GetActiveRounds());
Assert.Equal(Phase.Ended, round.Phase);
await arena.StopAsync(CancellationToken.None);
@@ -81,7 +81,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PhaseStepping
await aliceClient1.SignTransactionAsync(signedCoinJoin, CancellationToken.None);
await aliceClient2.SignTransactionAsync(signedCoinJoin, CancellationToken.None);
await arena.TriggerAndWaitRoundAsync(TimeSpan.FromSeconds(21));
- Assert.DoesNotContain(round, arena.ActiveRounds);
+ Assert.DoesNotContain(round, arena.Rounds.Where(x => x.Phase != Phase.Ended));
Assert.Equal(Phase.Ended, round.Phase);
Assert.False(round.WasTransactionBroadcast);
Assert.Empty(prison.GetInmates());
@@ -120,7 +120,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PhaseStepping
await aliceClient1.SignTransactionAsync(signedCoinJoin, CancellationToken.None);
await aliceClient2.SignTransactionAsync(signedCoinJoin, CancellationToken.None);
await arena.TriggerAndWaitRoundAsync(TimeSpan.FromSeconds(21));
- Assert.DoesNotContain(round, arena.ActiveRounds);
+ Assert.DoesNotContain(round, arena.Rounds.Where(x => x.Phase != Phase.Ended));
Assert.Equal(Phase.Ended, round.Phase);
Assert.False(round.WasTransactionBroadcast);
@@ -161,7 +161,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PhaseStepping
var signedCoinJoin = round.Assert<SigningState>().CreateTransaction();
await aliceClient1.SignTransactionAsync(signedCoinJoin, CancellationToken.None);
await arena.TriggerAndWaitRoundAsync(TimeSpan.FromSeconds(21));
- Assert.DoesNotContain(round, arena.ActiveRounds);
+ Assert.DoesNotContain(round, arena.Rounds.Where(x => x.Phase != Phase.Ended));
Assert.Equal(Phase.Ended, round.Phase);
Assert.False(round.WasTransactionBroadcast);
Assert.Empty(arena.Rounds.Where(x => x is BlameRound));
@@ -203,7 +203,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend.PhaseStepping
await aliceClient1.SignTransactionAsync(signedCoinJoin, CancellationToken.None);
await aliceClient2.SignTransactionAsync(signedCoinJoin, CancellationToken.None);
await arena.TriggerAndWaitRoundAsync(TimeSpan.FromSeconds(21));
- Assert.DoesNotContain(round, arena.ActiveRounds);
+ Assert.DoesNotContain(round, arena.Rounds.Where(x => x.Phase != Phase.Ended));
Assert.Single(arena.Rounds.Where(x => x is BlameRound));
var badOutpoint = alice3.Coin.Outpoint;
Assert.Contains(badOutpoint, prison.GetInmates().Select(x => x.Utxo));

ADD
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/Rounds/Utils/ArenaExtensions.cs
+using System.Linq;
+using System.Collections.Generic;
+using WalletWasabi.WabiSabi.Backend.Rounds;
+
+namespace WalletWasabi.Tests.UnitTests.WabiSabi.Backend
+{
+ public static class ArenaExtensions
+ {
+ public static IEnumerable<Round> GetActiveRounds(this Arena arena)
+ => arena.Rounds.Where(x => x.Phase != Phase.Ended);
+ }
+}

MODIFY
WalletWasabi/WabiSabi/Backend/Rounds/Arena.cs
WalletWasabi/WabiSabi/Backend/Rounds/Arena.cs
@@ -19,7 +19,13 @@ namespace WalletWasabi.WabiSabi.Backend.Rounds
{
public partial class Arena : PeriodicRunner
{
- public Arena(TimeSpan period, Network network, WabiSabiConfig config, IRPCClient rpc, Prison prison, CoinJoinTransactionArchiver? archiver = null) : base(period)
+ public Arena(
+ TimeSpan period,
+ Network network,
+ WabiSabiConfig config,
+ IRPCClient rpc,
+ Prison prison,
+ CoinJoinTransactionArchiver? archiver = null) : base(period)
{
Network = network;
Config = config;
@@ -38,8 +44,6 @@ namespace WalletWasabi.WabiSabi.Backend.Rounds
private SecureRandom Random { get; }
private CoinJoinTransactionArchiver? TransactionArchiver { get; }
- public IEnumerable<Round> ActiveRounds => Rounds.Where(x => x.Phase != Phase.Ended);
-
protected override async Task ActionAsync(CancellationToken cancel)
{
using (await AsyncLock.LockAsync(cancel).ConfigureAwait(false))

Remobe `ActiveRounds` property from arena

It was used only for unit testing so, it had to be moved to somewhere
else.