Use IHttpClient in CoinJoinClient.
MODIFY
WalletWasabi/CoinJoin/Client/Clients/AliceClient4.cs
WalletWasabi/CoinJoin/Client/Clients/AliceClient4.cs
@@ -2,7 +2,7 @@ using NBitcoin;
using System;
using System.Collections.Generic;
using System.Linq;
-using System.Net;
+using WalletWasabi.Tor.Http;
using static WalletWasabi.Crypto.SchnorrBlinding;
namespace WalletWasabi.CoinJoin.Client.Clients
@@ -15,9 +15,8 @@ namespace WalletWasabi.CoinJoin.Client.Clients
IEnumerable<PubKey> signerPubKeys,
IEnumerable<Requester> requesters,
Network network,
- Func<Uri> baseUriAction,
- EndPoint torSocks5EndPoint)
- : base(roundId, registeredAddresses, requesters, network, baseUriAction, torSocks5EndPoint)
+ IHttpClient httpClient)
+ : base(roundId, registeredAddresses, requesters, network, httpClient)
{
SignerPubKeys = signerPubKeys.ToArray();
}

MODIFY
WalletWasabi/CoinJoin/Client/Clients/AliceClientBase.cs
WalletWasabi/CoinJoin/Client/Clients/AliceClientBase.cs
@@ -28,10 +28,9 @@ namespace WalletWasabi.CoinJoin.Client.Clients
IEnumerable<BitcoinAddress> registeredAddresses,
IEnumerable<Requester> requesters,
Network network,
- Func<Uri> baseUriAction,
- EndPoint torSocks5EndPoint)
+ IHttpClient httpClient)
{
- TorClient = new TorHttpClient(baseUriAction, torSocks5EndPoint, isolateStream: true);
+ TorClient = httpClient;
RoundId = roundId;
RegisteredAddresses = registeredAddresses.ToArray();
Requesters = requesters.ToArray();
@@ -57,8 +56,7 @@ namespace WalletWasabi.CoinJoin.Client.Clients
BitcoinAddress changeOutput,
IEnumerable<BlindedOutputWithNonceIndex> blindedOutputScriptHashes,
IEnumerable<InputProofModel> inputs,
- Func<Uri> baseUriAction,
- EndPoint torSocks5EndPoint)
+ IHttpClient httpClient)
{
var request = new InputsRequest4
{
@@ -67,7 +65,7 @@ namespace WalletWasabi.CoinJoin.Client.Clients
ChangeOutputAddress = changeOutput,
Inputs = inputs
};
- var client = new AliceClient4(roundId, registeredAddresses, signerPubKeys, requesters, network, baseUriAction, torSocks5EndPoint);
+ var client = new AliceClient4(roundId, registeredAddresses, signerPubKeys, requesters, network, httpClient);
try
{
// Correct it if forgot to set.

MODIFY
WalletWasabi/CoinJoin/Client/Clients/CoinJoinClient.cs
WalletWasabi/CoinJoin/Client/Clients/CoinJoinClient.cs
@@ -59,7 +59,6 @@ namespace WalletWasabi.CoinJoin.Client.Clients
DestinationKeyManager = KeyManager;
Synchronizer = Guard.NotNull(nameof(synchronizer), synchronizer);
CcjHostUriAction = Synchronizer.WasabiClientFactory.BackendUriGetter;
- TorSocks5EndPoint = Synchronizer.WasabiClientFactory.TorEndpoint;
CoordinatorFeepercentToCheck = null;
ExposedLinks = new ConcurrentDictionary<OutPoint, IEnumerable<HdPubKeyBlindedPair>>();
@@ -97,7 +96,6 @@ namespace WalletWasabi.CoinJoin.Client.Clients
public Func<Uri> CcjHostUriAction { get; private set; }
public WasabiSynchronizer Synchronizer { get; private set; }
- protected EndPoint? TorSocks5EndPoint { get; set; }
private decimal? CoordinatorFeepercentToCheck { get; set; }
@@ -507,7 +505,7 @@ namespace WalletWasabi.CoinJoin.Client.Clients
var state = inputRegistrableRound.State;
(HdPubKey change, IEnumerable<HdPubKey> actives) outputAddresses = GetOutputsToRegister(state.Denomination, state.MixLevelCount, registrableCoins);
- AliceClientBase aliceClient = null;
+ AliceClientBase? aliceClient = null;
try
{
aliceClient = await CreateAliceClientAsync(inputRegistrableRound.RoundId, registrableCoins, outputAddresses).ConfigureAwait(false);
@@ -1136,7 +1134,8 @@ namespace WalletWasabi.CoinJoin.Client.Clients
inputProofs.Add(inputProof);
}
- return await AliceClientBase.CreateNewAsync(roundId, registeredAddresses, signerPubKeys, requesters, Network, outputAddresses.change.GetP2wpkhAddress(Network), blindedOutputScriptHashes, inputProofs, CcjHostUriAction, TorSocks5EndPoint).ConfigureAwait(false);
+ IHttpClient httpClient = Synchronizer.WasabiClientFactory.NewHttpClient(CcjHostUriAction, isolateStream: true);
+ return await AliceClientBase.CreateNewAsync(roundId, registeredAddresses, signerPubKeys, requesters, Network, outputAddresses.change.GetP2wpkhAddress(Network), blindedOutputScriptHashes, inputProofs, httpClient).ConfigureAwait(false);
}
}
}

Use IHttpClient in CoinJoinClient.

Signed-off-by: Kiminuo <kiminuo@protonmail.com>