diff --git a/ConfigBuilder/Program.cs b/ConfigBuilder/Program.cs index efbed20..0a4bb22 100644 --- a/ConfigBuilder/Program.cs +++ b/ConfigBuilder/Program.cs @@ -1,12 +1,24 @@ using System.Text.Json; var plugins = Directory.GetDirectories("../../../../Plugins"); -Console.WriteLine(string.Join(',',plugins)); -var p = string.Join(';', plugins.Select(s => $"{Path.GetFullPath(s)}/bin/Altcoins-Debug/net6.0/{Path.GetFileName(s)}.dll" ));; -var fileContents = $"{{ \"DEBUG_PLUGINS\": \"{p}\"}}"; +var p = ""; +foreach (var plugin in plugins) +{ + var x = Directory.GetDirectories(Path.Combine(plugin,"bin")); + if (x.Any(s => s.EndsWith("Altcoins-Debug"))) + { + p += $"{Path.GetFullPath(plugin)}/bin/Altcoins-Debug/net6.0/{Path.GetFileName(plugin)}.dll;"; + } + else + { + p += $"{Path.GetFullPath(plugin)}/bin/Debug/net6.0/{Path.GetFileName(plugin)}.dll;"; + } +} + var content = JsonSerializer.Serialize(new { DEBUG_PLUGINS = p }); +Console.WriteLine(content); await File.WriteAllTextAsync("../../../../submodules/BTCPayServer/BTCPayServer/appsettings.dev.json", content); \ No newline at end of file diff --git a/Plugins/BTCPayServer.Plugins.Wabisabi/BTCPayWallet.cs b/Plugins/BTCPayServer.Plugins.Wabisabi/BTCPayWallet.cs index 243406b..131d907 100644 --- a/Plugins/BTCPayServer.Plugins.Wabisabi/BTCPayWallet.cs +++ b/Plugins/BTCPayServer.Plugins.Wabisabi/BTCPayWallet.cs @@ -292,6 +292,7 @@ public class BTCPayWallet : IWallet, IDestinationProvider } } + anonset = anonset < 1 ? 1 : anonset; return (labels, anonset, cjData); }); @@ -324,12 +325,12 @@ public class BTCPayWallet : IWallet, IDestinationProvider private Task _savingProgress = Task.CompletedTask; - public async Task RegisterCoinjoinTransaction(CoinJoinResult result, string coordinatorName) + public async Task RegisterCoinjoinTransaction(SuccessfulCoinJoinResult result, string coordinatorName) { _savingProgress = RegisterCoinjoinTransactionInternal(result, coordinatorName); await _savingProgress; } - private async Task RegisterCoinjoinTransactionInternal(CoinJoinResult result, string coordinatorName) + private async Task RegisterCoinjoinTransactionInternal(SuccessfulCoinJoinResult result, string coordinatorName) { try { @@ -351,7 +352,7 @@ public class BTCPayWallet : IWallet, IDestinationProvider Dictionary indexToPayment = new(); - foreach (var script in result.RegisteredOutputs) + foreach (var script in result.OutputScripts) { var txout = result.UnsignedCoinJoin.Outputs.AsIndexedOutputs() .Single(@out => @out.TxOut.ScriptPubKey == script); @@ -372,13 +373,13 @@ public class BTCPayWallet : IWallet, IDestinationProvider await Task.WhenAll(scriptInfos.Select(t => t.Item2)); var scriptInfos2 = scriptInfos.Where(tuple => tuple.Item2.Result is not null).ToDictionary(tuple => tuple.txout.TxOut.ScriptPubKey); var smartTx = new SmartTransaction(result.UnsignedCoinJoin, new Height(HeightType.Unknown)); - result.RegisteredCoins.ForEach(coin => + result.Coins.ForEach(coin => { coin.HdPubKey.SetKeyState(KeyState.Used); coin.SpenderTransaction = smartTx; smartTx.TryAddWalletInput(coin); }); - result.RegisteredOutputs.ForEach(s => + result.OutputScripts.ForEach(s => { if (scriptInfos2.TryGetValue(s, out var si)) { @@ -446,6 +447,10 @@ public class BTCPayWallet : IWallet, IDestinationProvider new WalletId(StoreId, "BTC"), result.UnsignedCoinJoin.GetHash(), attachments); + + + var mixedCoins = smartTx.WalletOutputs.Where(coin => + coin.AnonymitySet > 1 && BlockchainAnalyzer.StdDenoms.Contains(coin.TxOut.Value.Satoshi)); if (storeIdForutxo != StoreId) { await _walletRepository.AddWalletTransactionAttachment( @@ -453,20 +458,32 @@ public class BTCPayWallet : IWallet, IDestinationProvider result.UnsignedCoinJoin.GetHash(), new List() { - new Attachment("coinjoin", result.RoundId.ToString(), null), + new Attachment("coinjoin", result.RoundId.ToString(), JObject.FromObject(new CoinjoinData() + { + Transaction = result.UnsignedCoinJoin.GetHash().ToString(), + Round = result.RoundId.ToString(), + CoinsOut = mixedCoins.Select(coin => new CoinjoinData.CoinjoinDataCoin() + { + AnonymitySet = coin.AnonymitySet, + Amount = coin.Amount.ToDecimal(MoneyUnit.BTC), + Outpoint = coin.Outpoint.ToString() + }).ToArray(), + CoordinatorName = coordinatorName + })), new Attachment(coordinatorName, null, null) }); } - var mixedCoins = smartTx.WalletOutputs.Where(coin => - coin.AnonymitySet > 1 && BlockchainAnalyzer.StdDenoms.Contains(coin.TxOut.Value.Satoshi)); foreach (var mixedCoin in mixedCoins) { await _walletRepository.AddWalletTransactionAttachment(new WalletId(storeIdForutxo, "BTC"), mixedCoin.Outpoint.ToString(), - new[] {new Attachment("anonset", mixedCoin.AnonymitySet.ToString())}, "utxo"); + new[] {new Attachment("anonset", mixedCoin.AnonymitySet.ToString(), JObject.FromObject(new + { + Tooltip = $"This coin has an anonset score of {mixedCoin.AnonymitySet.ToString()} (anonset-{mixedCoin.AnonymitySet.ToString()})" + }))}, "utxo"); } diff --git a/Plugins/BTCPayServer.Plugins.Wabisabi/Coordinator/WabisabiCoordinatorConfigController.cs b/Plugins/BTCPayServer.Plugins.Wabisabi/Coordinator/WabisabiCoordinatorConfigController.cs index bd4e999..29bc577 100644 --- a/Plugins/BTCPayServer.Plugins.Wabisabi/Coordinator/WabisabiCoordinatorConfigController.cs +++ b/Plugins/BTCPayServer.Plugins.Wabisabi/Coordinator/WabisabiCoordinatorConfigController.cs @@ -46,6 +46,8 @@ Reputation risks: as the coordinator, the user may be associated with illegal ac { Wabisabi = await _wabisabiCoordinatorService.GetSettings(); + ViewBag.Config = _wabisabiCoordinatorService.WabiSabiCoordinator.Config.ToString(); + } catch (Exception) { @@ -80,6 +82,7 @@ Reputation risks: as the coordinator, the user may be associated with illegal ac public async Task UpdateWabisabiSettings(WabisabiCoordinatorSettings vm, string command, string config) { + ViewBag.Config = config; switch (command) { case "nostr-current-url": diff --git a/Plugins/BTCPayServer.Plugins.Wabisabi/Views/WabisabiCoordinatorConfig/UpdateWabisabiSettings.cshtml b/Plugins/BTCPayServer.Plugins.Wabisabi/Views/WabisabiCoordinatorConfig/UpdateWabisabiSettings.cshtml index 5ab9533..d4c238e 100644 --- a/Plugins/BTCPayServer.Plugins.Wabisabi/Views/WabisabiCoordinatorConfig/UpdateWabisabiSettings.cshtml +++ b/Plugins/BTCPayServer.Plugins.Wabisabi/Views/WabisabiCoordinatorConfig/UpdateWabisabiSettings.cshtml @@ -28,7 +28,7 @@ @string.Join("\n", error.Errors) }
diff --git a/Plugins/BTCPayServer.Plugins.Wabisabi/Views/WabisabiStore/UpdateWabisabiStoreSettings.cshtml b/Plugins/BTCPayServer.Plugins.Wabisabi/Views/WabisabiStore/UpdateWabisabiStoreSettings.cshtml index 185d048..b9b330f 100644 --- a/Plugins/BTCPayServer.Plugins.Wabisabi/Views/WabisabiStore/UpdateWabisabiStoreSettings.cshtml +++ b/Plugins/BTCPayServer.Plugins.Wabisabi/Views/WabisabiStore/UpdateWabisabiStoreSettings.cshtml @@ -281,7 +281,10 @@ Minimum inputs@round.MinInputCountByRound - Max inputs@round.MaxInputCountByRound + Maximum inputs@round.MaxInputCountByRound + + + Maximum round registration time@round.StandardInputRegistrationTimeout.ToString() @@ -293,7 +296,7 @@
- Coordinator Config @@ -302,7 +305,7 @@