The WabiSabi controller the real request handler
MODIFY
WalletWasabi.Backend/Controllers/WabiSabiController.cs
WalletWasabi.Backend/Controllers/WabiSabiController.cs
@@ -12,7 +12,7 @@ namespace WalletWasabi.Backend.Controllers
[ExceptionTranslate]
[Route("[controller]")]
[Produces("application/json")]
- public class WabiSabiController : ControllerBase
+ public class WabiSabiController : ControllerBase, IArenaRequestHandler
{
private ArenaRequestHandler handler;
@@ -57,9 +57,9 @@ namespace WalletWasabi.Backend.Controllers
}
[HttpGet("status")]
- public RoundState[] GetStatus()
+ public Task<RoundState[]> GetStatusAsync(CancellationToken cancellableToken)
{
- return handler.Arena.Rounds.Values.Select(x => RoundState.FromRound(x)).ToArray();
+ return Task.FromResult(handler.Arena.Rounds.Values.Select(x => RoundState.FromRound(x)).ToArray());
}
}
}

MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Client/AliceClientTests.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Client/AliceClientTests.cs
@@ -4,6 +4,7 @@ using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
+using WalletWasabi.Backend.Controllers;
using WalletWasabi.BitcoinCore.Rpc;
using WalletWasabi.Blockchain.TransactionOutputs;
using WalletWasabi.Crypto.Randomness;
@@ -43,10 +44,11 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Client
});
await using var coordinator = new ArenaRequestHandler(config, new Prison(), arena, mockRpc.Object);
+ var wabiSabiApi = new WabiSabiController(coordinator);
CredentialPool amountCredentialPool = new();
CredentialPool vsizeCredentialPool = new();
- var arenaClient = new ArenaClient(round.AmountCredentialIssuerParameters, round.VsizeCredentialIssuerParameters, amountCredentialPool, vsizeCredentialPool, coordinator, new InsecureRandom());
+ var arenaClient = new ArenaClient(round.AmountCredentialIssuerParameters, round.VsizeCredentialIssuerParameters, amountCredentialPool, vsizeCredentialPool, wabiSabiApi, new InsecureRandom());
Assert.Equal(Phase.InputRegistration, arena.Rounds.First().Value.Phase);
var bitcoinSecret = km.GetSecrets("", coin1.ScriptPubKey).Single().PrivateKey.GetBitcoinSecret(Network.Main);

MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Client/ArenaClientTests.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Client/ArenaClientTests.cs
@@ -5,6 +5,7 @@ using System.Collections.Immutable;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
+using WalletWasabi.Backend.Controllers;
using WalletWasabi.BitcoinCore.Rpc;
using WalletWasabi.Crypto;
using WalletWasabi.Crypto.Randomness;
@@ -46,10 +47,10 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Client
TxOut = new TxOut(Money.Coins(1m), key.PubKey.WitHash.GetAddress(Network.Main)),
});
await using var coordinator = new ArenaRequestHandler(config, new Prison(), arena, mockRpc.Object);
-
+ var wabiSabiApi = new WabiSabiController(coordinator);
CredentialPool amountCredentials = new();
CredentialPool vsizeCredentials = new();
- var aliceArenaClient = new ArenaClient(round.AmountCredentialIssuerParameters, round.VsizeCredentialIssuerParameters, amountCredentials, vsizeCredentials, coordinator, new InsecureRandom());
+ var aliceArenaClient = new ArenaClient(round.AmountCredentialIssuerParameters, round.VsizeCredentialIssuerParameters, amountCredentials, vsizeCredentials, wabiSabiApi, new InsecureRandom());
var aliceId = await aliceArenaClient.RegisterInputAsync(Money.Coins(1m), outpoint, key, round.Id, CancellationToken.None);
@@ -96,7 +97,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Client
await arena.TriggerAndWaitRoundAsync(TimeSpan.FromMinutes(1));
Assert.Equal(Phase.OutputRegistration, round.Phase);
- var bobArenaClient = new ArenaClient(round.AmountCredentialIssuerParameters, round.VsizeCredentialIssuerParameters, amountCredentials, vsizeCredentials, coordinator, new InsecureRandom());
+ var bobArenaClient = new ArenaClient(round.AmountCredentialIssuerParameters, round.VsizeCredentialIssuerParameters, amountCredentials, vsizeCredentials, wabiSabiApi, new InsecureRandom());
Assert.Equal(4, amountCredentials.ZeroValue.Count());
@@ -160,7 +161,8 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Client
using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(config, round);
await using var coordinator = new ArenaRequestHandler(config, new Prison(), arena, arena.Rpc);
- var apiClient = new ArenaClient(null!, null!, coordinator);
+ var wabiSabiApi = new WabiSabiController(coordinator);
+ var apiClient = new ArenaClient(null!, null!, wabiSabiApi);
round.SetPhase(Phase.InputRegistration);
@@ -186,11 +188,12 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Client
var mockRpc = new Mock<IRPCClient>();
await using var coordinator = new ArenaRequestHandler(config, new Prison(), arena, mockRpc.Object);
+ var wabiSabiApi = new WabiSabiController(coordinator);
var rnd = new InsecureRandom();
var amountClient = new WabiSabiClient(round.AmountCredentialIssuerParameters, rnd, 4300000000000ul);
var vsizeClient = new WabiSabiClient(round.VsizeCredentialIssuerParameters, rnd, 2000ul);
- var apiClient = new ArenaClient(amountClient, vsizeClient, coordinator);
+ var apiClient = new ArenaClient(amountClient, vsizeClient, wabiSabiApi);
round.SetPhase(Phase.TransactionSigning);

MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Client/BobClientTests.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Client/BobClientTests.cs
@@ -4,6 +4,7 @@ using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
+using WalletWasabi.Backend.Controllers;
using WalletWasabi.BitcoinCore.Rpc;
using WalletWasabi.Blockchain.TransactionOutputs;
using WalletWasabi.Crypto.Randomness;
@@ -46,8 +47,9 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Client
CredentialPool vsizeCredential = new();
await using var coordinator = new ArenaRequestHandler(config, new Prison(), arena, mockRpc.Object);
- var aliceArenaClient = new ArenaClient(round.AmountCredentialIssuerParameters, round.VsizeCredentialIssuerParameters, amountCredential, vsizeCredential, coordinator, new InsecureRandom());
- var bobArenaClient = new ArenaClient(round.AmountCredentialIssuerParameters, round.VsizeCredentialIssuerParameters, amountCredential, vsizeCredential, coordinator, new InsecureRandom());
+ var wabiSabiApi = new WabiSabiController(coordinator);
+ var aliceArenaClient = new ArenaClient(round.AmountCredentialIssuerParameters, round.VsizeCredentialIssuerParameters, amountCredential, vsizeCredential, wabiSabiApi, new InsecureRandom());
+ var bobArenaClient = new ArenaClient(round.AmountCredentialIssuerParameters, round.VsizeCredentialIssuerParameters, amountCredential, vsizeCredential, wabiSabiApi, new InsecureRandom());
Assert.Equal(Phase.InputRegistration, round.Phase);
var bitcoinSecret = km.GetSecrets("", coin1.ScriptPubKey).Single().PrivateKey.GetBitcoinSecret(Network.Main);

MODIFY
WalletWasabi/WabiSabi/Backend/PostRequests/ArenaRequestHandler.cs
WalletWasabi/WabiSabi/Backend/PostRequests/ArenaRequestHandler.cs
@@ -10,7 +10,7 @@ using WalletWasabi.WabiSabi.Models;
namespace WalletWasabi.WabiSabi.Backend.PostRequests
{
- public class ArenaRequestHandler : IAsyncDisposable, IArenaRequestHandler
+ public class ArenaRequestHandler : IAsyncDisposable
{
public ArenaRequestHandler(WabiSabiConfig config, Prison prison, Arena arena, IRPCClient rpc)
{
@@ -91,11 +91,6 @@ namespace WalletWasabi.WabiSabi.Backend.PostRequests
}
}
- public Task<RoundState[]> GetStatusAsync(CancellationToken cancellationToken)
- {
- throw new NotImplementedException();
- }
-
public async ValueTask DisposeAsync()
{
lock (DisposeStartedLock)

The WabiSabi controller the real request handler