AliceClientBase: Rename TorClient -> HttpClient.
Addresses:
MODIFY
WalletWasabi/CoinJoin/Client/Clients/AliceClientBase.cs
WalletWasabi/CoinJoin/Client/Clients/AliceClientBase.cs
@@ -30,7 +30,7 @@ namespace WalletWasabi.CoinJoin.Client.Clients
Network network,
IHttpClient httpClient)
{
- TorClient = httpClient;
+ HttpClient = httpClient;
RoundId = roundId;
RegisteredAddresses = registeredAddresses.ToArray();
Requesters = requesters.ToArray();
@@ -45,7 +45,7 @@ namespace WalletWasabi.CoinJoin.Client.Clients
public BitcoinAddress[] RegisteredAddresses { get; }
public Requester[] Requesters { get; }
- public IHttpClient TorClient { get; }
+ public IHttpClient HttpClient { get; }
public static async Task<AliceClient4> CreateNewAsync(
long roundId,
@@ -80,7 +80,7 @@ namespace WalletWasabi.CoinJoin.Client.Clients
throw new NotSupportedException($"InputRequest {nameof(roundId)} does not match to the provided {nameof(roundId)}: {request.RoundId} != {roundId}.");
}
}
- using HttpResponseMessage response = await client.TorClient.SendAsync(HttpMethod.Post, $"/api/v{WasabiClient.ApiVersion}/btc/chaumiancoinjoin/inputs/", request.ToHttpStringContent()).ConfigureAwait(false);
+ using HttpResponseMessage response = await client.HttpClient.SendAsync(HttpMethod.Post, $"/api/v{WasabiClient.ApiVersion}/btc/chaumiancoinjoin/inputs/", request.ToHttpStringContent()).ConfigureAwait(false);
if (response.StatusCode != HttpStatusCode.OK)
{
await response.ThrowRequestExceptionFromContentAsync().ConfigureAwait(false);
@@ -107,7 +107,7 @@ namespace WalletWasabi.CoinJoin.Client.Clients
public async Task<(RoundPhase currentPhase, IEnumerable<ActiveOutput> activeOutputs)> PostConfirmationAsync()
{
- using HttpResponseMessage response = await TorClient.SendAsync(HttpMethod.Post, $"/api/v{WasabiClient.ApiVersion}/btc/chaumiancoinjoin/confirmation?uniqueId={UniqueId}&roundId={RoundId}").ConfigureAwait(false);
+ using HttpResponseMessage response = await HttpClient.SendAsync(HttpMethod.Post, $"/api/v{WasabiClient.ApiVersion}/btc/chaumiancoinjoin/confirmation?uniqueId={UniqueId}&roundId={RoundId}").ConfigureAwait(false);
if (response.StatusCode != HttpStatusCode.OK)
{
await response.ThrowRequestExceptionFromContentAsync().ConfigureAwait(false);
@@ -161,7 +161,7 @@ namespace WalletWasabi.CoinJoin.Client.Clients
{
try
{
- using HttpResponseMessage response = await TorClient.SendAsync(HttpMethod.Post, $"/api/v{WasabiClient.ApiVersion}/btc/chaumiancoinjoin/unconfirmation?uniqueId={UniqueId}&roundId={RoundId}", cancel: cts.Token).ConfigureAwait(false);
+ using HttpResponseMessage response = await HttpClient.SendAsync(HttpMethod.Post, $"/api/v{WasabiClient.ApiVersion}/btc/chaumiancoinjoin/unconfirmation?uniqueId={UniqueId}&roundId={RoundId}", cancel: cts.Token).ConfigureAwait(false);
if (response.StatusCode is HttpStatusCode.BadRequest or HttpStatusCode.Gone) // Otherwise maybe some internet connection issue there's. Let's consider that as timed out.
{
await response.ThrowRequestExceptionFromContentAsync().ConfigureAwait(false);
@@ -181,7 +181,7 @@ namespace WalletWasabi.CoinJoin.Client.Clients
public async Task<Transaction> GetUnsignedCoinJoinAsync()
{
- using HttpResponseMessage response = await TorClient.SendAsync(HttpMethod.Get, $"/api/v{WasabiClient.ApiVersion}/btc/chaumiancoinjoin/coinjoin?uniqueId={UniqueId}&roundId={RoundId}").ConfigureAwait(false);
+ using HttpResponseMessage response = await HttpClient.SendAsync(HttpMethod.Get, $"/api/v{WasabiClient.ApiVersion}/btc/chaumiancoinjoin/coinjoin?uniqueId={UniqueId}&roundId={RoundId}").ConfigureAwait(false);
if (response.StatusCode != HttpStatusCode.OK)
{
await response.ThrowRequestExceptionFromContentAsync().ConfigureAwait(false);
@@ -199,9 +199,9 @@ namespace WalletWasabi.CoinJoin.Client.Clients
var myDic = signatures.ToDictionary(signature => signature.Key, signature => signature.Value.ToString());
var jsonSignatures = JsonConvert.SerializeObject(myDic, Formatting.None);
- var signatureRequestContent = new StringContent(jsonSignatures, Encoding.UTF8, "application/json");
+ using StringContent signatureRequestContent = new(jsonSignatures, Encoding.UTF8, "application/json");
- using HttpResponseMessage response = await TorClient.SendAsync(HttpMethod.Post, $"/api/v{WasabiClient.ApiVersion}/btc/chaumiancoinjoin/signatures?uniqueId={UniqueId}&roundId={RoundId}", signatureRequestContent).ConfigureAwait(false);
+ using HttpResponseMessage response = await HttpClient.SendAsync(HttpMethod.Post, $"/api/v{WasabiClient.ApiVersion}/btc/chaumiancoinjoin/signatures?uniqueId={UniqueId}&roundId={RoundId}", signatureRequestContent).ConfigureAwait(false);
if (response.StatusCode != HttpStatusCode.NoContent)
{
await response.ThrowRequestExceptionFromContentAsync().ConfigureAwait(false);
@@ -215,7 +215,7 @@ namespace WalletWasabi.CoinJoin.Client.Clients
{
if (disposing)
{
- (TorClient as IDisposable)?.Dispose();
+ (HttpClient as IDisposable)?.Dispose();
}
_disposedValue = true;

AliceClientBase: Rename TorClient -> HttpClient.

Addresses: https://github.com/zkSNACKs/WalletWasabi/pull/5106#discussion_r567938849