Unify type of credential values as `long`
MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Client/ArenaClientTests.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Client/ArenaClientTests.cs
@@ -59,7 +59,7 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Client
{
Money.Coins(.75m) - round.FeeRate.GetFee(Constants.P2wpkhInputVirtualSize),
Money.Coins(.25m)
- };
+ }.Select(x => x.Satoshi).ToArray();
var inputVsize = Constants.P2wpkhInputVirtualSize;
var vsizesToRequest = new[] { ProtocolConstants.MaxVsizePerAlice - inputVsize };
@@ -97,13 +97,12 @@ namespace WalletWasabi.Tests.UnitTests.WabiSabi.Client
// Phase: Output Registration
using var destinationKey1 = new Key();
using var destinationKey2 = new Key();
+ var p2pwkhScriptSize = (long)destinationKey1.PubKey.WitHash.ScriptPubKey.EstimateOutputVsize();
var reissuanceResponse = await bobArenaClient.ReissueCredentialAsync(
round.Id,
- amountsToRequest[0],
- amountsToRequest[1],
- destinationKey1.PubKey.WitHash.ScriptPubKey.EstimateOutputVsize(),
- destinationKey2.PubKey.WitHash.ScriptPubKey.EstimateOutputVsize(),
+ amountsToRequest,
+ Enumerable.Repeat(p2pwkhScriptSize, 2),
connectionConfirmationResponse2.RealAmountCredentials,
connectionConfirmationResponse2.RealVsizeCredentials,
CancellationToken.None);

MODIFY
WalletWasabi/WabiSabi/Client/AliceClient.cs
WalletWasabi/WabiSabi/Client/AliceClient.cs
@@ -68,7 +68,7 @@ namespace WalletWasabi.WabiSabi.Client
throw new InvalidOperationException($"Round({ RoundId }), Alice({ AliceId}): Not enough funds to pay for the fees.");
}
- var amountsToRequest = new[] { effectiveAmount };
+ var amountsToRequest = new[] { effectiveAmount.Satoshi };
var response = await ArenaClient
.ConfirmConnectionAsync(

MODIFY
WalletWasabi/WabiSabi/Client/ArenaClient.cs
WalletWasabi/WabiSabi/Client/ArenaClient.cs
@@ -75,7 +75,7 @@ namespace WalletWasabi.WabiSabi.Client
public async Task<ArenaResponse> RegisterOutputAsync(
uint256 roundId,
- long value,
+ long amount,
Script scriptPubKey,
IEnumerable<Credential> amountCredentialsToPresent,
IEnumerable<Credential> vsizeCredentialsToPresent,
@@ -86,7 +86,7 @@ namespace WalletWasabi.WabiSabi.Client
var presentedAmount = amountCredentialsToPresent.Sum(x => (long)x.Amount.ToUlong());
var (realAmountCredentialRequest, realAmountCredentialResponseValidation) = AmountCredentialClient.CreateRequest(
- new[] { presentedAmount - value },
+ new[] { presentedAmount - amount },
amountCredentialsToPresent,
cancellationToken);
@@ -112,10 +112,8 @@ namespace WalletWasabi.WabiSabi.Client
public async Task<ArenaResponse> ReissueCredentialAsync(
uint256 roundId,
- long amount1,
- long amount2,
- long vsize1,
- long vsize2,
+ IEnumerable<long> amountsToRequest,
+ IEnumerable<long> vsizesToRequest,
IEnumerable<Credential> amountCredentialsToPresent,
IEnumerable<Credential> vsizeCredentialsToPresent,
CancellationToken cancellationToken)
@@ -123,19 +121,19 @@ namespace WalletWasabi.WabiSabi.Client
Guard.InRange(nameof(amountCredentialsToPresent), amountCredentialsToPresent, 0, AmountCredentialClient.NumberOfCredentials);
var presentedAmount = amountCredentialsToPresent.Sum(x => (long)x.Amount.ToUlong());
- if (amount1 + amount2 != presentedAmount)
+ if (amountsToRequest.Sum() != presentedAmount)
{
throw new InvalidOperationException($"Reissuence amounts must equal with the sum of the presented ones.");
}
var presentedVsize = vsizeCredentialsToPresent.Sum(x => (long)x.Amount.ToUlong());
var (realVsizeCredentialRequest, realVsizeCredentialResponseValidation) = VsizeCredentialClient.CreateRequest(
- new[] { vsize1, vsize2 },
+ vsizesToRequest,
vsizeCredentialsToPresent,
cancellationToken);
var (realAmountCredentialRequest, realAmountCredentialResponseValidation) = AmountCredentialClient.CreateRequest(
- new[] { amount1, amount2 },
+ amountsToRequest,
amountCredentialsToPresent,
cancellationToken);
@@ -162,7 +160,7 @@ namespace WalletWasabi.WabiSabi.Client
public async Task<ArenaResponse<bool>> ConfirmConnectionAsync(
uint256 roundId,
uint256 aliceId,
- IEnumerable<Money> amountsToRequest,
+ IEnumerable<long> amountsToRequest,
IEnumerable<long> vsizesToRequest,
IEnumerable<Credential> amountCredentialsToPresent,
IEnumerable<Credential> vsizeCredentialsToPresent,
@@ -174,7 +172,7 @@ namespace WalletWasabi.WabiSabi.Client
Guard.InRange(nameof(vsizesToRequest), vsizesToRequest, 1, VsizeCredentialClient.NumberOfCredentials);
var realAmountCredentialRequestData = AmountCredentialClient.CreateRequest(
- amountsToRequest.Select(x => x.Satoshi),
+ amountsToRequest,
amountCredentialsToPresent,
cancellationToken);

MODIFY
WalletWasabi/WabiSabi/Client/BobClient.cs
WalletWasabi/WabiSabi/Client/BobClient.cs
@@ -41,10 +41,8 @@ namespace WalletWasabi.WabiSabi.Client
{
var response = await ArenaClient.ReissueCredentialAsync(
RoundId,
- amount1,
- amount2,
- vsize1,
- vsize2,
+ new[] { amount1, amount2 },
+ new[] { vsize1, vsize2 },
amountCredential,
vsizeCredential,
cancellationToken)

Unify type of credential values as `long`