Skip to content

Commit

Permalink
Increase same tx allowance to 2 on average. (WalletWasabi#13215)
Browse files Browse the repository at this point in the history
  • Loading branch information
Turbolay authored Jul 1, 2024
1 parent ffee7be commit bf0cbd3
Showing 1 changed file with 2 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,40 +210,8 @@ public ImmutableList<TCoin> SelectCoinsForRound<TCoin>(IEnumerable<TCoin> coins,
}
Logger.LogDebug($"Selected the final selection candidate: {finalCandidate.Count()} coins, {string.Join(", ", finalCandidate.Select(x => x.Amount.ToString(false, true)).ToArray())} BTC.");

// Let's remove some coins coming from the same tx in the final candidate:
// The smaller our balance is the more privacy we gain and the more the user cares about the costs, so more interconnectedness allowance makes sense.
var toRegister = finalCandidate.Sum(x => x.Amount);
int percent;
if (toRegister < 10_000)
{
percent = 20;
}
else if (toRegister < 100_000)
{
percent = 30;
}
else if (toRegister < 1_000_000)
{
percent = 40;
}
else if (toRegister < 10_000_000)
{
percent = 50;
}
else if (toRegister < 100_000_000) // 1 BTC
{
percent = 60;
}
else if (toRegister < 1_000_000_000)
{
percent = 70;
}
else
{
percent = 80;
}

int sameTxAllowance = Generator.GetRandomBiasedSameTxAllowance(percent);
// Let's remove some coins coming from the same tx in the final candidate, allow 2 on average.
int sameTxAllowance = Generator.GetRandomBiasedSameTxAllowance(67);

List<TCoin> winner = new()
{
Expand Down

0 comments on commit bf0cbd3

Please sign in to comment.