mirror of
https://github.com/aljazceru/BTCPayServerPlugins.git
synced 2025-12-18 16:14:25 +01:00
ws coin select
This commit is contained in:
@@ -13,7 +13,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Product>Coinjoin</Product>
|
<Product>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.74</Version>
|
<Version>1.0.75</Version>
|
||||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -446,29 +446,29 @@ namespace BTCPayServer.Plugins.Wabisabi
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// coinSelect:
|
coinSelect:
|
||||||
var selectedCoinSum = selectedCoins.Sum(coin => ((Money)coin.Amount).ToDecimal(MoneyUnit.BTC));
|
var selectedCoinSum = selectedCoins.Sum(coin => ((Money)coin.Amount).ToDecimal(MoneyUnit.BTC));
|
||||||
var remaining = amount - selectedCoinSum;
|
var remaining = amount - selectedCoinSum;
|
||||||
var remainingCoins = coins.FilterBy(coin => !selectedCoins.Contains(coin.Coin)).Available().ToList();
|
var remainingCoins = coins.FilterBy(coin => !selectedCoins.Contains(coin.Coin)).Available().ToList();
|
||||||
// if (remaining > 0 && remainingCoins.Any())
|
if (remaining > 0 && remainingCoins.Any())
|
||||||
// {
|
{
|
||||||
// //try to select the closest coin to the remaining amount while also prioritizing privacy
|
//try to select the closest coin to the remaining amount while also prioritizing privacy
|
||||||
// //so filter rby the highest anonymity set first and then by closest amount
|
//so filter rby the highest anonymity set first and then by closest amount
|
||||||
// var closestCoin = remainingCoins
|
var closestCoin = remainingCoins
|
||||||
// .OrderByDescending(coin => coin.AnonymitySet)
|
.OrderByDescending(coin => coin.AnonymitySet)
|
||||||
// .ThenBy(coin => Math.Abs(coin.Amount.ToDecimal(MoneyUnit.BTC) - remaining))
|
.ThenBy(coin => Math.Abs(coin.Amount.ToDecimal(MoneyUnit.BTC) - remaining))
|
||||||
// .FirstOrDefault();
|
.FirstOrDefault();
|
||||||
// if (closestCoin is not null)
|
if (closestCoin is not null)
|
||||||
// {
|
{
|
||||||
// selectedCoins.Add(closestCoin.Coin);
|
selectedCoins.Add(closestCoin.Coin);
|
||||||
// remainingCoins.Remove(closestCoin);
|
remainingCoins.Remove(closestCoin);
|
||||||
//
|
|
||||||
// goto coinSelect;
|
goto coinSelect;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// return Ok(selectedCoins.Select(coin => coin.Outpoint.ToString()).ToArray());
|
return Ok(selectedCoins.Select(coin => coin.Outpoint.ToString()).ToArray());
|
||||||
|
|
||||||
var defaultCoinSelector = new DefaultCoinSelector();
|
var defaultCoinSelector = new DefaultCoinSelector();
|
||||||
var defaultSelection =
|
var defaultSelection =
|
||||||
|
|||||||
Reference in New Issue
Block a user