Improve ProcessResultAfterConfirmationCorrectAsync with multitx processing
MODIFY
WalletWasabi.Tests/UnitTests/Transactions/TransactionProcessorTests.cs
WalletWasabi.Tests/UnitTests/Transactions/TransactionProcessorTests.cs
@@ -90,70 +90,72 @@ namespace WalletWasabi.Tests.UnitTests.Transactions
var key = transactionProcessor.KeyManager.GetKeys().First();
var tx1 = CreateCreditingTransaction(key.PubKey.WitHash.ScriptPubKey, Money.Coins(1.0m));
- var res = transactionProcessor.Process(tx1);
- Assert.False(res.IsLikelyOwnCoinJoin);
- Assert.Empty(res.NewlyConfirmedReceivedCoins);
- Assert.Empty(res.NewlyConfirmedSpentCoins);
- Assert.Single(res.NewlyReceivedCoins);
- Assert.Empty(res.NewlySpentCoins);
- Assert.Single(res.ReceivedCoins);
- Assert.Empty(res.SpentCoins);
- Assert.Empty(res.ReceivedDusts);
- Assert.Empty(res.ReplacedCoins);
- Assert.Empty(res.RestoredCoins);
- Assert.Empty(res.SuccessfullyDoubleSpentCoins);
- Assert.True(res.IsNews);
- Assert.NotNull(res.Transaction);
-
var blockHeight = new Height(77551);
- tx1 = new SmartTransaction(tx1.Transaction, blockHeight);
- res = transactionProcessor.Process(tx1);
- Assert.False(res.IsLikelyOwnCoinJoin);
- Assert.Single(res.NewlyConfirmedReceivedCoins);
- Assert.Empty(res.NewlyConfirmedSpentCoins);
- Assert.Empty(res.NewlyReceivedCoins);
- Assert.Empty(res.NewlySpentCoins);
- Assert.Single(res.ReceivedCoins);
- Assert.Empty(res.SpentCoins);
- Assert.Empty(res.ReceivedDusts);
- Assert.Empty(res.ReplacedCoins);
- Assert.Empty(res.RestoredCoins);
- Assert.Empty(res.SuccessfullyDoubleSpentCoins);
- Assert.True(res.IsNews);
- Assert.NotNull(res.Transaction);
-
- var tx2 = CreateSpendingTransaction(tx1.Transaction.Outputs.AsCoins().First(), new Key().PubKey.WitHash.ScriptPubKey);
- res = transactionProcessor.Process(tx2);
- Assert.False(res.IsLikelyOwnCoinJoin);
- Assert.Empty(res.NewlyConfirmedReceivedCoins);
- Assert.Empty(res.NewlyConfirmedSpentCoins);
- Assert.Empty(res.NewlyReceivedCoins);
- Assert.Single(res.NewlySpentCoins);
- Assert.Empty(res.ReceivedCoins);
- Assert.Single(res.SpentCoins);
- Assert.Empty(res.ReceivedDusts);
- Assert.Empty(res.ReplacedCoins);
- Assert.Empty(res.RestoredCoins);
- Assert.Empty(res.SuccessfullyDoubleSpentCoins);
- Assert.True(res.IsNews);
- Assert.NotNull(res.Transaction);
-
- blockHeight = new Height(77552);
- tx2 = new SmartTransaction(tx2.Transaction, blockHeight);
- res = transactionProcessor.Process(tx2);
- Assert.False(res.IsLikelyOwnCoinJoin);
- Assert.Empty(res.NewlyConfirmedReceivedCoins);
- Assert.Single(res.NewlyConfirmedSpentCoins);
- Assert.Empty(res.NewlyReceivedCoins);
- Assert.Empty(res.NewlySpentCoins);
- Assert.Empty(res.ReceivedCoins);
- Assert.Single(res.SpentCoins);
- Assert.Empty(res.ReceivedDusts);
- Assert.Empty(res.ReplacedCoins);
- Assert.Empty(res.RestoredCoins);
- Assert.Empty(res.SuccessfullyDoubleSpentCoins);
- Assert.True(res.IsNews);
- Assert.NotNull(res.Transaction);
+ var tx2 = new SmartTransaction(tx1.Transaction, blockHeight);
+ var tx3 = CreateSpendingTransaction(tx2.Transaction.Outputs.AsCoins().First(), new Key().PubKey.WitHash.ScriptPubKey);
+ var blockHeight2 = new Height(77552);
+ var tx4 = new SmartTransaction(tx3.Transaction, blockHeight2);
+ var results = transactionProcessor.Process(tx1, tx2, tx3, tx4).ToArray();
+ var res1 = results[0];
+ var res2 = results[1];
+ var res3 = results[2];
+ var res4 = results[3];
+
+ Assert.False(res1.IsLikelyOwnCoinJoin);
+ Assert.Empty(res1.NewlyConfirmedReceivedCoins);
+ Assert.Empty(res1.NewlyConfirmedSpentCoins);
+ Assert.Single(res1.NewlyReceivedCoins);
+ Assert.Empty(res1.NewlySpentCoins);
+ Assert.Single(res1.ReceivedCoins);
+ Assert.Empty(res1.SpentCoins);
+ Assert.Empty(res1.ReceivedDusts);
+ Assert.Empty(res1.ReplacedCoins);
+ Assert.Empty(res1.RestoredCoins);
+ Assert.Empty(res1.SuccessfullyDoubleSpentCoins);
+ Assert.True(res1.IsNews);
+ Assert.NotNull(res1.Transaction);
+
+ Assert.False(res2.IsLikelyOwnCoinJoin);
+ Assert.Single(res2.NewlyConfirmedReceivedCoins);
+ Assert.Empty(res2.NewlyConfirmedSpentCoins);
+ Assert.Empty(res2.NewlyReceivedCoins);
+ Assert.Empty(res2.NewlySpentCoins);
+ Assert.Single(res2.ReceivedCoins);
+ Assert.Empty(res2.SpentCoins);
+ Assert.Empty(res2.ReceivedDusts);
+ Assert.Empty(res2.ReplacedCoins);
+ Assert.Empty(res2.RestoredCoins);
+ Assert.Empty(res2.SuccessfullyDoubleSpentCoins);
+ Assert.True(res2.IsNews);
+ Assert.NotNull(res2.Transaction);
+
+ Assert.False(res3.IsLikelyOwnCoinJoin);
+ Assert.Empty(res3.NewlyConfirmedReceivedCoins);
+ Assert.Empty(res3.NewlyConfirmedSpentCoins);
+ Assert.Empty(res3.NewlyReceivedCoins);
+ Assert.Single(res3.NewlySpentCoins);
+ Assert.Empty(res3.ReceivedCoins);
+ Assert.Single(res3.SpentCoins);
+ Assert.Empty(res3.ReceivedDusts);
+ Assert.Empty(res3.ReplacedCoins);
+ Assert.Empty(res3.RestoredCoins);
+ Assert.Empty(res3.SuccessfullyDoubleSpentCoins);
+ Assert.True(res3.IsNews);
+ Assert.NotNull(res3.Transaction);
+
+ Assert.False(res4.IsLikelyOwnCoinJoin);
+ Assert.Empty(res4.NewlyConfirmedReceivedCoins);
+ Assert.Single(res4.NewlyConfirmedSpentCoins);
+ Assert.Empty(res4.NewlyReceivedCoins);
+ Assert.Empty(res4.NewlySpentCoins);
+ Assert.Empty(res4.ReceivedCoins);
+ Assert.Single(res4.SpentCoins);
+ Assert.Empty(res4.ReceivedDusts);
+ Assert.Empty(res4.ReplacedCoins);
+ Assert.Empty(res4.RestoredCoins);
+ Assert.Empty(res4.SuccessfullyDoubleSpentCoins);
+ Assert.True(res4.IsNews);
+ Assert.NotNull(res4.Transaction);
}
[Fact]

Improve ProcessResultAfterConfirmationCorrectAsync with multitx processing