Skip to content

Commit

Permalink
Merge pull request #12857 from turbolay/useHelperInPockets
Browse files Browse the repository at this point in the history
[Release] Use helper privacy functions in `GetPockets`
  • Loading branch information
soosr committed Apr 16, 2024
2 parents df9c36a + b642e17 commit f626f7d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
8 changes: 4 additions & 4 deletions WalletWasabi.Fluent/Helpers/CoinPocketHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ public static IEnumerable<(LabelsArray Labels, ICoinsView Coins)> GetPockets(thi
List<(LabelsArray Labels, ICoinsView Coins)> pockets = new();

var clusters = new Dictionary<LabelsArray, List<SmartCoin>>(comparer: LabelsComparer.Instance);
foreach (SmartCoin coin in allCoins.Where(x => x.HdPubKey.AnonymitySet < Constants.SemiPrivateThreshold))

foreach (SmartCoin coin in allCoins.Where(x => x.IsRedCoin()))
{
var cluster = coin.HdPubKey.Cluster.Labels;

Expand Down Expand Up @@ -56,13 +56,13 @@ public static IEnumerable<(LabelsArray Labels, ICoinsView Coins)> GetPockets(thi
pockets.Add(new(UnlabelledFundsText, unLabelledCoins));
}

var privateCoins = new CoinsView(allCoins.Where(x => x.HdPubKey.AnonymitySet >= privateAnonSetThreshold));
var privateCoins = new CoinsView(allCoins.Where(x => x.IsPrivate(privateAnonSetThreshold)));
if (privateCoins.Any())
{
pockets.Add(new(PrivateFundsText, privateCoins));
}

var semiPrivateCoins = new CoinsView(allCoins.Where(x => x.HdPubKey.AnonymitySet >= Constants.SemiPrivateThreshold && x.HdPubKey.AnonymitySet < privateAnonSetThreshold));
var semiPrivateCoins = new CoinsView(allCoins.Where(x => x.IsSemiPrivate(privateAnonSetThreshold)));
if (semiPrivateCoins.Any())
{
pockets.Add(new(SemiPrivateFundsText, semiPrivateCoins));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1394,11 +1394,13 @@ public async Task GetPocketsAsync()
notYetPrivateCoin.SetAnonymitySet(targetAnonSet - 1, 0);

var privateCoin1 = transactionProcessor.NewKey("");
transactionProcessor.Process(CreateCreditingTransaction(privateCoin1.P2wpkhScript, Money.Coins(1.0m)));
var processorResult = transactionProcessor.Process(CreateCreditingTransaction(privateCoin1.P2wpkhScript, Money.Coins(1.0m)));
processorResult.ReceivedCoins.First().IsSufficientlyDistancedFromExternalKeys = true;
privateCoin1.SetAnonymitySet(targetAnonSet, 0);

var privateCoin2 = transactionProcessor.NewKey("");
transactionProcessor.Process(CreateCreditingTransaction(privateCoin2.P2wpkhScript, Money.Coins(1.0m)));
processorResult = transactionProcessor.Process(CreateCreditingTransaction(privateCoin2.P2wpkhScript, Money.Coins(1.0m)));
processorResult.ReceivedCoins.First().IsSufficientlyDistancedFromExternalKeys = true;
privateCoin2.SetAnonymitySet(targetAnonSet, 0);

var pockets = CoinPocketHelper.GetPockets(transactionProcessor.Coins, targetAnonSet);
Expand Down

0 comments on commit f626f7d

Please sign in to comment.