Simplify bitcoinsecrets
MODIFY
WalletWasabi/WabiSabi/Client/AliceClient.cs
WalletWasabi/WabiSabi/Client/AliceClient.cs
@@ -11,13 +11,14 @@ namespace WalletWasabi.WabiSabi.Client
{
public class AliceClient
{
- public AliceClient(Guid aliceId, Guid roundId, ArenaClient arenaClient, Coin coin, FeeRate feeRate)
+ public AliceClient(Guid aliceId, Guid roundId, ArenaClient arenaClient, Coin coin, FeeRate feeRate, BitcoinSecret bitcoinSecret)
{
AliceId = aliceId;
RoundId = roundId;
ArenaClient = arenaClient;
Coin = coin;
FeeRate = feeRate;
+ BitcoinSecret = bitcoinSecret;
}
public Guid AliceId { get; }
@@ -25,6 +26,7 @@ namespace WalletWasabi.WabiSabi.Client
private ArenaClient ArenaClient { get; }
private Coin Coin { get; }
private FeeRate FeeRate { get; }
+ private BitcoinSecret BitcoinSecret { get; }
public async Task ConfirmConnectionAsync(TimeSpan confirmInterval, CancellationToken token)
{
@@ -68,9 +70,9 @@ namespace WalletWasabi.WabiSabi.Client
Logger.LogInfo($"Round ({RoundId}), Alice ({AliceId}): Inputs removed.");
}
- public async Task SignTransactionAsync(BitcoinSecret bitcoinSecret, Transaction unsignedCoinJoin)
+ public async Task SignTransactionAsync(Transaction unsignedCoinJoin)
{
- await ArenaClient.SignTransactionAsync(RoundId, Coin, bitcoinSecret, unsignedCoinJoin).ConfigureAwait(false);
+ await ArenaClient.SignTransactionAsync(RoundId, Coin, BitcoinSecret, unsignedCoinJoin).ConfigureAwait(false);
Logger.LogInfo($"Round ({RoundId}), Alice ({AliceId}): Posted a signature.");
}
@@ -85,7 +87,7 @@ namespace WalletWasabi.WabiSabi.Client
{
Guid aliceId = await arenaClient.RegisterInputAsync(coin.Amount, coin.Outpoint, bitcoinSecret.PrivateKey, roundId, roundHash).ConfigureAwait(false);
- AliceClient client = new(aliceId, roundId, arenaClient, coin, feeRate);
+ AliceClient client = new(aliceId, roundId, arenaClient, coin, feeRate, bitcoinSecret);
Logger.LogInfo($"Round ({roundId}), Alice ({aliceId}): Registered an input.");

MODIFY
WalletWasabi/WabiSabi/Client/CoinJoinClient.cs
WalletWasabi/WabiSabi/Client/CoinJoinClient.cs
@@ -23,7 +23,7 @@ namespace WalletWasabi.WabiSabi.Client
private CredentialPool VsizeCredentialPool { get; } = new();
private Round Round { get; }
public IArenaRequestHandler ArenaRequestHandler { get; }
- private BitcoinSecret BitcoinSecret { get; }
+ public Kitchen Kitchen { get; }
public KeyManager Keymanager { get; }
private SecureRandom SecureRandom { get; }
private CancellationTokenSource DisposeCts { get; } = new();
@@ -32,13 +32,13 @@ namespace WalletWasabi.WabiSabi.Client
public CoinJoinClient(
Round round,
IArenaRequestHandler arenaRequestHandler,
- BitcoinSecret bitcoinSecret,
IEnumerable<Coin> coins,
+ Kitchen kitchen,
KeyManager keymanager)
{
Round = round;
ArenaRequestHandler = arenaRequestHandler;
- BitcoinSecret = bitcoinSecret;
+ Kitchen = kitchen;
Keymanager = keymanager;
SecureRandom = new SecureRandom();
Coins = coins.ToArray();
@@ -91,7 +91,8 @@ namespace WalletWasabi.WabiSabi.Client
foreach (var coin in Coins)
{
// Parallelize or Random delay?
- aliceClients.Add(await AliceClient.CreateNewAsync(aliceArenaClient, coin, BitcoinSecret, Round.Id, Round.Hash, Round.FeeRate).ConfigureAwait(false));
+ var secret = Keymanager.GetSecrets(Kitchen.SaltSoup(), coin.ScriptPubKey.WitHash.ScriptPubKey).First().PrivateKey.GetBitcoinSecret(Keymanager.GetNetwork());
+ aliceClients.Add(await AliceClient.CreateNewAsync(aliceArenaClient, coin, secret, Round.Id, Round.Hash, Round.FeeRate).ConfigureAwait(false));
}
}
catch (Exception)
@@ -139,7 +140,7 @@ namespace WalletWasabi.WabiSabi.Client
foreach (var output in outputs)
{
- BobClient bobClient = new BobClient(Round.Id, bobArenaClient);
+ BobClient bobClient = new(Round.Id, bobArenaClient);
await bobClient.RegisterOutputAsync(output.Amount, output.Pubkey.PubKey.WitHash.ScriptPubKey).ConfigureAwait(false);
// Random delay?
}
@@ -158,7 +159,7 @@ namespace WalletWasabi.WabiSabi.Client
{
foreach (var aliceClient in aliceClients)
{
- await aliceClient.SignTransactionAsync(BitcoinSecret, unsignedCoinJoinTransaction).ConfigureAwait(false);
+ await aliceClient.SignTransactionAsync(unsignedCoinJoinTransaction).ConfigureAwait(false);
}
}

Simplify bitcoinsecrets