update nostr

This commit is contained in:
Kukks
2023-05-09 13:33:50 +02:00
parent 287000518a
commit 9960ae6aeb
2 changed files with 7 additions and 3 deletions

View File

@@ -194,13 +194,17 @@ public class BTCPayCoinjoinCoinSelector : IRoundCoinSelector
{ {
continue; continue;
} }
//if we have less than the max suggested output registration, we should add more coins to reach that number to avoid breaking up into too many coins?
var isLessThanMaxOutputRegistration = solution.Coins.Count < 8;
var rand = Random.Shared.Next(1, 101); var rand = Random.Shared.Next(1, 101);
//let's check how many coins we are allowed to add max and how many we added, and use that percentage as the random chance of not adding it. //let's check how many coins we are allowed to add max and how many we added, and use that percentage as the random chance of not adding it.
// if max coins = 20, and current coins = 5 then 5/20 = 0.25 * 100 = 25 // if max coins = 20, and current coins = 5 then 5/20 = 0.25 * 100 = 25
var maxCoinCapacityPercentage = Math.Floor((solution.Coins.Count / (decimal)maxCoins) * 100); var maxCoinCapacityPercentage = Math.Floor((solution.Coins.Count / (decimal)maxCoins) * 100);
//aggressively attempt to reach max coin target if consolidation mode is on //aggressively attempt to reach max coin target if consolidation mode is on
var chance = consolidationMode ? 90 : 100 - maxCoinCapacityPercentage; //if we're less than the max output registration, we should be more aggressive in adding coins
var chance = consolidationMode ? 90 : 100m - Math.Min(maxCoinCapacityPercentage, isLessThanMaxOutputRegistration ? 50m : maxCoinCapacityPercentage);
_logger.LogDebug( _logger.LogDebug(
$"coin selection: no payms left but at {solution.Coins.Count()} coins. random chance to add another coin if: {chance} <= {rand} (random 0-100) "); $"coin selection: no payms left but at {solution.Coins.Count()} coins. random chance to add another coin if: {chance} <= {rand} (random 0-100) ");
if (chance <= rand) if (chance <= rand)

View File

@@ -13,7 +13,7 @@
<PropertyGroup> <PropertyGroup>
<Product>Wabisabi Coinjoin</Product> <Product>Wabisabi Coinjoin</Product>
<Description>Allows you to integrate your btcpayserver store with coinjoins.</Description> <Description>Allows you to integrate your btcpayserver store with coinjoins.</Description>
<Version>1.0.34</Version> <Version>1.0.35</Version>
</PropertyGroup> </PropertyGroup>
<!-- Plugin development properties --> <!-- Plugin development properties -->
@@ -43,7 +43,7 @@
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="NNostr.Client" Version="0.0.24" /> <PackageReference Include="NNostr.Client" Version="0.0.25" />
<PackageReference Include="WabiSabi" Version="1.0.1.2" /> <PackageReference Include="WabiSabi" Version="1.0.1.2" />
</ItemGroup> </ItemGroup>
<Target Name="DeleteExampleFile" AfterTargets="Publish"> <Target Name="DeleteExampleFile" AfterTargets="Publish">