Some cleanup
Moved AliceInputMappings to GetAliceInputData method.
Using tuple to assign vars to reduce amount of code
MODIFY
WalletWasabi.Tests/LiveServerTests.cs
WalletWasabi.Tests/LiveServerTests.cs
@@ -79,23 +79,18 @@ namespace WalletWasabi.Tests
[InlineData(NetworkType.Testnet)]
public async Task RegisterAliceInputThenUnConfirmAsync(NetworkType networkType)
{
- var aliceInputData = LiveServerTestsFixture.GetAliceInputData(networkType);
+ (BitcoinPubKeyAddress activeOutputAddress, BitcoinPubKeyAddress changeOutputAddress, string blindedDataHex, string proof, List<TxoRef> utxos) = LiveServerTestsFixture.GetAliceInputData(networkType);
- // blinded data created using activeOutputAddress ScriptPubKey
- var blindedDataAsHex = aliceInputData.blindedDataHex;
+ // blinded activeOutputAddress.ScriptPubKey
+ byte[] blinded = ByteHelpers.FromHex(blindedDataHex);
- byte[] blinded = ByteHelpers.FromHex(blindedDataAsHex);
-
- // signed with private key that owns the utxos
- var proof = aliceInputData.proof;
-
- var inputProofModels = aliceInputData.utxos.Select(txrf => new InputProofModel
+ var inputProofModels = utxos.Select(txrf => new InputProofModel
{
Input = txrf,
- Proof = proof
+ Proof = proof // blinded.BlindedData signed with private key owning utxos
});
- var aliceClient = await AliceClient.CreateNewAsync(aliceInputData.changeOutputAddress, blinded, inputProofModels, LiveServerTestsFixture.UriMappings[networkType]);
+ var aliceClient = await AliceClient.CreateNewAsync(changeOutputAddress, blinded, inputProofModels, LiveServerTestsFixture.UriMappings[networkType]);
Assert.NotNull(aliceClient?.RoundId);
Assert.NotNull(aliceClient?.UniqueId);
@@ -110,23 +105,18 @@ namespace WalletWasabi.Tests
[InlineData(NetworkType.Mainnet)]
public async Task RegisterAliceInputThenConfirmAsync(NetworkType networkType)
{
- var aliceInputData = LiveServerTestsFixture.GetAliceInputData(networkType);
-
- // blinded data created using activeOutputAddress ScriptPubKey
- var blindedDataAsHex = aliceInputData.blindedDataHex;
-
- byte[] blinded = ByteHelpers.FromHex(blindedDataAsHex);
+ (BitcoinPubKeyAddress activeOutputAddress, BitcoinPubKeyAddress changeOutputAddress, string blindedDataHex, string proof, List<TxoRef> utxos) = LiveServerTestsFixture.GetAliceInputData(networkType);
- // signed with private key that owns the utxos
- var proof = aliceInputData.proof;
+ // blinded activeOutputAddress.ScriptPubKey
+ byte[] blinded = ByteHelpers.FromHex(blindedDataHex);
- var inputProofModels = aliceInputData.utxos.Select(txrf => new InputProofModel
+ var inputProofModels = utxos.Select(txrf => new InputProofModel
{
Input = txrf,
- Proof = proof
+ Proof = proof // blinded.BlindedData signed with private key owning utxos
});
- var aliceClient = await AliceClient.CreateNewAsync(aliceInputData.changeOutputAddress, blinded, inputProofModels, LiveServerTestsFixture.UriMappings[networkType]);
+ var aliceClient = await AliceClient.CreateNewAsync(changeOutputAddress, blinded, inputProofModels, LiveServerTestsFixture.UriMappings[networkType]);
Assert.NotNull(aliceClient?.RoundId);
Assert.NotNull(aliceClient?.UniqueId);

MODIFY
WalletWasabi.Tests/XunitConfiguration/LiveServerTestsFixture.cs
WalletWasabi.Tests/XunitConfiguration/LiveServerTestsFixture.cs
@@ -9,7 +9,6 @@ namespace WalletWasabi.Tests.XunitConfiguration
public class LiveServerTestsFixture : IDisposable
{
public Dictionary<NetworkType, Uri> UriMappings { get; internal set; }
- public Dictionary<NetworkType, (BitcoinPubKeyAddress activeOutputAddress, BitcoinPubKeyAddress changeOutputAddress, string blindedDataHex, string proof, List<TxoRef> utxos)> AliceInputMappings { get; internal set; }
public LiveServerTestsFixture()
{
@@ -18,8 +17,11 @@ namespace WalletWasabi.Tests.XunitConfiguration
{ NetworkType.Mainnet, new Uri("http://4jsmnfcsmbrlm7l7.onion") },
{ NetworkType.Testnet, new Uri("http://wtgjmaol3io5ijii.onion") }
};
+ }
- AliceInputMappings = new Dictionary<NetworkType, (BitcoinPubKeyAddress activeOutputAddress, BitcoinPubKeyAddress changeOutputAddress, string blindedDataHex, string proof, List<TxoRef> utxos)>
+ public (BitcoinPubKeyAddress activeOutputAddress, BitcoinPubKeyAddress changeOutputAddress, string blindedDataHex, string proof, List<TxoRef> utxos) GetAliceInputData(NetworkType networkType)
+ {
+ var aliceInputMappings = new Dictionary<NetworkType, (BitcoinPubKeyAddress activeOutputAddress, BitcoinPubKeyAddress changeOutputAddress, string blindedDataHex, string proof, List<TxoRef> utxos)>
{
{
NetworkType.Testnet,
@@ -51,11 +53,8 @@ namespace WalletWasabi.Tests.XunitConfiguration
})
}
};
- }
- public (BitcoinPubKeyAddress activeOutputAddress, BitcoinPubKeyAddress changeOutputAddress, string blindedDataHex, string proof, List<TxoRef> utxos) GetAliceInputData(NetworkType networkType)
- {
- return AliceInputMappings[networkType];
+ return aliceInputMappings[networkType];
}
public void Dispose()

Some cleanup

Moved AliceInputMappings to GetAliceInputData method.
Using tuple to assign vars to reduce amount of code