Replace some more TxoRef in clien-side code and tests
MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/SendControlViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/SendControlViewModel.cs
@@ -262,7 +262,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
}
var selectedCoinViewModels = CoinList.Coins.Where(cvm => cvm.IsSelected);
- var selectedCoinReferences = selectedCoinViewModels.Select(cvm => new TxoRef(cvm.Model.TransactionId, cvm.Model.Index)).ToList();
+ var selectedCoinReferences = selectedCoinViewModels.Select(cvm => cvm.Model.OutPoint).ToList();
if (!selectedCoinReferences.Any())
{

MODIFY
WalletWasabi.Gui/Rpc/WasabiJsonRpcService.cs
WalletWasabi.Gui/Rpc/WasabiJsonRpcService.cs
@@ -112,7 +112,7 @@ namespace WalletWasabi.Gui.Rpc
}
[JsonRpcMethod("build")]
- public string BuildTransaction(PaymentInfo[] payments, TxoRef[] coins, int feeTarget, string password = null)
+ public string BuildTransaction(PaymentInfo[] payments, OutPoint[] coins, int feeTarget, string password = null)
{
Guard.NotNull(nameof(payments), payments);
Guard.NotNull(nameof(coins), coins);
@@ -136,14 +136,14 @@ namespace WalletWasabi.Gui.Rpc
}
[JsonRpcMethod("send")]
- public async Task<object> SendTransactionAsync(PaymentInfo[] payments, TxoRef[] coins, int feeTarget, string password = null)
+ public async Task<object> SendTransactionAsync(PaymentInfo[] payments, OutPoint[] coins, int feeTarget, string password = null)
{
var txHex = BuildTransaction(payments, coins, feeTarget, password);
var smartTx = new SmartTransaction(Transaction.Parse(txHex, Global.Network), Height.Mempool);
// dequeue the coins we are going to spend
var toDequeue = Global.Wallet.Coins
- .Where(x => x.CoinJoinInProgress && coins.Contains(x.GetTxoRef()))
+ .Where(x => x.CoinJoinInProgress && coins.Contains(x.OutPoint))
.ToArray();
if (toDequeue.Any())
{
@@ -192,22 +192,22 @@ namespace WalletWasabi.Gui.Rpc
}
[JsonRpcMethod("enqueue")]
- public async Task EnqueueForCoinJoinAsync(TxoRef[] coins)
+ public async Task EnqueueForCoinJoinAsync(OutPoint[] coins)
{
Guard.NotNull(nameof(coins), coins);
AssertWalletIsLoaded();
- var coinsToMix = Global.Wallet.Coins.Where(x => coins.Any(y => y.TransactionId == x.TransactionId && y.Index == x.Index));
+ var coinsToMix = Global.Wallet.Coins.Where(x => coins.Any(y => y == x.OutPoint));
await Global.Wallet.ChaumianClient.QueueCoinsToMixAsync(coinsToMix.ToArray()).ConfigureAwait(false);
}
[JsonRpcMethod("dequeue")]
- public async Task DequeueForCoinJoinAsync(TxoRef[] coins)
+ public async Task DequeueForCoinJoinAsync(OutPoint[] coins)
{
Guard.NotNull(nameof(coins), coins);
AssertWalletIsLoaded();
- var coinsToDequeue = Global.Wallet.Coins.Where(x => coins.Any(y => y.TransactionId == x.TransactionId && y.Index == x.Index));
+ var coinsToDequeue = Global.Wallet.Coins.Where(x => coins.Any(y => y == x.OutPoint));
await Global.Wallet.ChaumianClient.DequeueCoinsFromMixAsync(coinsToDequeue, DequeueReason.UserRequested).ConfigureAwait(false);
}

MODIFY
WalletWasabi.Tests/RegressionTests/BuildTests.cs
WalletWasabi.Tests/RegressionTests/BuildTests.cs
@@ -102,7 +102,7 @@ namespace WalletWasabi.Tests.RegressionTests
FeeStrategy.TwentyMinutesConfirmationTargetStrategy));
// allowedInputs cannot be empty
- Assert.Throws<ArgumentException>(() => wallet.BuildTransaction(null, validIntent, FeeStrategy.TwentyMinutesConfirmationTargetStrategy, allowedInputs: Array.Empty<TxoRef>()));
+ Assert.Throws<ArgumentException>(() => wallet.BuildTransaction(null, validIntent, FeeStrategy.TwentyMinutesConfirmationTargetStrategy, allowedInputs: Array.Empty<OutPoint>()));
// "Only one element can contain the AllRemaining flag.
Assert.Throws<ArgumentException>(() => wallet.BuildTransaction(

MODIFY
WalletWasabi.Tests/RegressionTests/SendTests.cs
WalletWasabi.Tests/RegressionTests/SendTests.cs
@@ -331,7 +331,7 @@ namespace WalletWasabi.Tests.RegressionTests
res = wallet.BuildTransaction(password, new PaymentIntent(receive, MoneyRequest.CreateAllRemaining(), "foo"), FeeStrategy.SevenDaysConfirmationTargetStrategy,
allowUnconfirmed: true,
- allowedInputs: wallet.Coins.Where(x => !x.Unavailable).Select(x => new TxoRef(x.TransactionId, x.Index)).Take(1));
+ allowedInputs: wallet.Coins.Where(x => !x.Unavailable).Select(x => x.OutPoint).Take(1));
Assert.Single(res.InnerWalletOutputs);
Assert.Empty(res.OuterWalletOutputs);
@@ -351,7 +351,7 @@ namespace WalletWasabi.Tests.RegressionTests
res = wallet.BuildTransaction(password, new PaymentIntent(receive, MoneyRequest.CreateAllRemaining(), "foo"), FeeStrategy.SevenDaysConfirmationTargetStrategy,
allowUnconfirmed: true,
- allowedInputs: new[] { res.SpentCoins.Select(x => new TxoRef(x.TransactionId, x.Index)).First() });
+ allowedInputs: new[] { res.SpentCoins.Select(x => x.OutPoint).First() });
Assert.Single(res.InnerWalletOutputs);
Assert.Empty(res.OuterWalletOutputs);
@@ -416,7 +416,7 @@ namespace WalletWasabi.Tests.RegressionTests
receive = keyManager.GetNextReceiveKey("AllowedInputsDisallowUnconfirmed", out _).P2wpkhScript;
- var allowedInputs = wallet.Coins.Where(x => !x.Unavailable).Select(x => new TxoRef(x.TransactionId, x.Index)).Take(1);
+ var allowedInputs = wallet.Coins.Where(x => !x.Unavailable).Select(x => x.OutPoint).Take(1);
var toSend = new PaymentIntent(receive, MoneyRequest.CreateAllRemaining(), "fizz");
// covers:

MODIFY
WalletWasabi.Tests/UnitTests/Transactions/TransactionFactoryTests.cs
WalletWasabi.Tests/UnitTests/Transactions/TransactionFactoryTests.cs
@@ -422,7 +422,7 @@ namespace WalletWasabi.Tests.UnitTests.Transactions
coins.Single(x => x.Label == "Maria"),
coins.Single(x => x.Label == "Suyin")
}.ToArray();
- var result = transactionFactory.BuildTransaction(payment, feeRate, allowedCoins.Select(x => x.GetTxoRef()));
+ var result = transactionFactory.BuildTransaction(payment, feeRate, allowedCoins.Select(x => x.OutPoint));
Assert.True(result.Signed);
Assert.Equal(Money.Coins(0.12m), result.SpentCoins.Select(x => x.Amount).Sum());
@@ -452,7 +452,7 @@ namespace WalletWasabi.Tests.UnitTests.Transactions
coins.Single(x => x.Label == "Maria"),
coins.Single(x => x.Label == "Suyin")
}.ToArray();
- var result = transactionFactory.BuildTransaction(payment, feeRate, allowedCoins.Select(x => x.GetTxoRef()));
+ var result = transactionFactory.BuildTransaction(payment, feeRate, allowedCoins.Select(x => x.OutPoint));
Assert.True(result.Signed);
Assert.Equal(Money.Coins(0.13m), result.SpentCoins.Select(x => x.Amount).Sum());
@@ -485,7 +485,7 @@ namespace WalletWasabi.Tests.UnitTests.Transactions
var payment = new PaymentIntent(new Key().ScriptPubKey, amount);
var ex = Assert.Throws<InsufficientBalanceException>(() =>
- transactionFactory.BuildTransaction(payment, new FeeRate(2m), allowedCoins.Select(x => x.GetTxoRef())));
+ transactionFactory.BuildTransaction(payment, new FeeRate(2m), allowedCoins.Select(x => x.OutPoint)));
Assert.Equal(ex.Minimum, amount);
Assert.Equal(ex.Actual, allowedCoins[0].Amount);
@@ -511,8 +511,8 @@ namespace WalletWasabi.Tests.UnitTests.Transactions
// one unselected coins. That unselected coin has to be spent too.
var allowedInputs = new[]
{
- coins.Single(x => x.Amount == Money.Coins(0.08m)).GetTxoRef(),
- coins.Single(x => x.Amount == Money.Coins(0.02m)).GetTxoRef()
+ coins.Single(x => x.Amount == Money.Coins(0.08m)).OutPoint,
+ coins.Single(x => x.Amount == Money.Coins(0.02m)).OutPoint
}.ToArray();
var result = transactionFactory.BuildTransaction(payment, feeRate, allowedInputs);

MODIFY
WalletWasabi/Blockchain/Transactions/TransactionFactory.cs
WalletWasabi/Blockchain/Transactions/TransactionFactory.cs
@@ -38,7 +38,7 @@ namespace WalletWasabi.Blockchain.Transactions
public BuildTransactionResult BuildTransaction(
PaymentIntent payments,
FeeRate feeRate,
- IEnumerable<TxoRef> allowedInputs = null)
+ IEnumerable<OutPoint> allowedInputs = null)
=> BuildTransaction(payments, () => feeRate, allowedInputs, () => LockTime.Zero);
/// <exception cref="ArgumentException"></exception>
@@ -47,7 +47,7 @@ namespace WalletWasabi.Blockchain.Transactions
public BuildTransactionResult BuildTransaction(
PaymentIntent payments,
Func<FeeRate> feeRateFetcher,
- IEnumerable<TxoRef> allowedInputs = null,
+ IEnumerable<OutPoint> allowedInputs = null,
Func<LockTime> lockTimeSelector = null)
{
payments = Guard.NotNull(nameof(payments), payments);
@@ -72,7 +72,7 @@ namespace WalletWasabi.Blockchain.Transactions
}
allowedSmartCoinInputs = allowedSmartCoinInputs
- .Where(x => allowedInputs.Any(y => y.TransactionId == x.TransactionId && y.Index == x.Index))
+ .Where(x => allowedInputs.Any(y => y.Hash == x.TransactionId && y.N == x.Index))
.ToList();
// Add those that have the same script, because common ownership is already exposed.

MODIFY
WalletWasabi/CoinJoin/Client/Rounds/ClientState.cs
WalletWasabi/CoinJoin/Client/Rounds/ClientState.cs
@@ -70,15 +70,15 @@ namespace WalletWasabi.CoinJoin.Client.Rounds
}
}
- public bool Contains(IEnumerable<TxoRef> txos)
+ public bool Contains(IEnumerable<OutPoint> outpoints)
{
lock (StateLock)
{
- foreach (TxoRef txo in txos)
+ foreach (OutPoint txo in outpoints)
{
if (WaitingList.Keys
.Concat(Rounds.SelectMany(x => x.CoinsRegistered))
- .Any(x => x.GetTxoRef() == txo))
+ .Any(x => x.OutPoint == txo))
{
return true;
}
@@ -152,19 +152,19 @@ namespace WalletWasabi.CoinJoin.Client.Rounds
}
}
- public IEnumerable<TxoRef> GetAllWaitingCoins()
+ public IEnumerable<OutPoint> GetAllWaitingCoins()
{
lock (StateLock)
{
- return WaitingList.Keys.Select(x => x.GetTxoRef()).ToArray();
+ return WaitingList.Keys.Select(x => x.OutPoint).ToArray();
}
}
- public IEnumerable<TxoRef> GetAllRegisteredCoins()
+ public IEnumerable<OutPoint> GetAllRegisteredCoins()
{
lock (StateLock)
{
- return Rounds.SelectMany(x => x.CoinsRegistered).Select(x => x.GetTxoRef()).ToArray();
+ return Rounds.SelectMany(x => x.CoinsRegistered).Select(x => x.OutPoint).ToArray();
}
}

MODIFY
WalletWasabi/Wallets/Wallet.cs
WalletWasabi/Wallets/Wallet.cs
@@ -255,7 +255,7 @@ namespace WalletWasabi.Wallets
PaymentIntent payments,
FeeStrategy feeStrategy,
bool allowUnconfirmed = false,
- IEnumerable<TxoRef> allowedInputs = null)
+ IEnumerable<OutPoint> allowedInputs = null)
{
var builder = new TransactionFactory(Network, KeyManager, Coins, password, allowUnconfirmed);
return builder.BuildTransaction(
@@ -376,7 +376,7 @@ namespace WalletWasabi.Wallets
IEnumerable<SmartCoin> newCoins = e.NewlyReceivedCoins.Concat(e.RestoredCoins).Distinct();
if (newCoins.Any())
{
- if (ChaumianClient.State.Contains(e.Transaction.Transaction.Inputs.Select(x => x.PrevOut.ToTxoRef())))
+ if (ChaumianClient.State.Contains(e.Transaction.Transaction.Inputs.Select(x => x.PrevOut)))
{
var coinsToQueue = new HashSet<SmartCoin>();
foreach (var newCoin in newCoins)

Replace some more TxoRef in clien-side code and tests