group unlabelled funds and private funds
MODIFY
WalletWasabi.Fluent/Helpers/CoinPocketHelper.cs
WalletWasabi.Fluent/Helpers/CoinPocketHelper.cs
@@ -10,9 +10,10 @@ namespace WalletWasabi.Fluent.Helpers
{
public static class CoinPocketHelper
{
- public static IEnumerable<(string Labels, ICoinsView Coins)> GetPockets(ICoinsView allCoins)
+ public static IEnumerable<(string Labels, ICoinsView Coins)> GetPockets(this ICoinsView allCoins, int anonymitySet)
{
- var clusters = allCoins.GroupBy(x => x.HdPubKey.Cluster.Labels);
+ var clusters = allCoins.Where(x=>x.HdPubKey.AnonymitySet < anonymitySet)
+ .GroupBy(x => x.HdPubKey.Cluster.Labels);
List<(string Labels, ICoinsView Coins)> pockets = new();
@@ -24,16 +25,16 @@ namespace WalletWasabi.Fluent.Helpers
if (string.IsNullOrWhiteSpace(allLabels))
{
// If the Label is empty then add every coin as a separate pocket
- foreach (var coin in coins)
- {
- pockets.Add(new("", new CoinsView(new[] { coin })));
- }
+ pockets.Add(new("Unlabelled Funds", new CoinsView(coins)));
}
else
{
pockets.Add(new(allLabels, new CoinsView(coins)));
}
}
+
+ pockets.Add(new("Private Funds", new CoinsView(allCoins.Where(x=>x.HdPubKey.AnonymitySet >= anonymitySet))));
+
return pockets;
}
}

MODIFY
WalletWasabi.Tests/UnitTests/Transactions/TransactionProcessorTests.cs
WalletWasabi.Tests/UnitTests/Transactions/TransactionProcessorTests.cs
@@ -1086,7 +1086,7 @@ namespace WalletWasabi.Tests.UnitTests.Transactions
transactionProcessor.Process(CreateCreditingTransaction(transactionProcessor.NewKey("").P2wpkhScript, Money.Coins(1.0m)));
transactionProcessor.Process(CreateCreditingTransaction(transactionProcessor.NewKey("").P2wpkhScript, Money.Coins(1.0m)));
- IEnumerable<(string Labels, ICoinsView Coins)> pockets = CoinPocketHelper.GetPockets(transactionProcessor.Coins);
+ IEnumerable<(string Labels, ICoinsView Coins)> pockets = CoinPocketHelper.GetPockets(transactionProcessor.Coins, 2);
(string Labels, ICoinsView Coins) aPocket = pockets.Single(x => x.Labels == "A");
Assert.Equal(3, aPocket.Coins.Count());
Assert.Equal(Money.Coins(3.0m), aPocket.Coins.TotalAmount());

group unlabelled funds and private funds